From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sampling rate on data acquisition

Solved!
Go to solution

Hello everyone,

 

I am experimenting with interfacing a data acquisition device through its ActiveX controls. There is external software coming with the device that operates as kind of an oscilloscope, and on which you can set units, sampling rate (up to 240Hz combined) and enable/disable channels etc. The software runs in the background and the labview code exists to manipulate whatever data is observed and log it. Eventually, I will add more hardware elements etc, but the signal I will be observing will be coming out of a lock in amplifier.

For testing purposes, I disabled all but one channels so I'm sampling at a rate of 240Samples/singleChannel/second. I connected the output of a signal generator and have obtained data for frequencies ranging from 1Hz to 200Hz. I wasn't expecting anything above 80Hz maximum to even work -I was reading about the Nyquist theorem- , but I find myself puzzled on 2 fronts:

1) even on low frequencies (as low as 20Hz), the graph doesn't represent the true signal. Very few graphs in LV give out the true period (ex. the 1Hz), even when the software displays the correct data. At 240Hz sampling rate, should I have issues like that (and/or partially reconstructed waveforms that look 'broken') ? 

2) the LV code array datapoints seem to contain an ubnormally large amount of data. Keeping in mind that the way i understand it information is stored in the shift registers, RAM will eventually flood. 

 

I have attached a vi sniplet as well as several pictures showing the issues for varying frequencies, accompanied by the software equivalent pictures. I'm thinking I am either producing a timestamp in the wrong way, or I have misunderstood the way the XY graph matches data points (it also looks as in the higher frequencies data is obtained only on edge points). An express vi with the same time as x axis produces equally unmatched graphs.

 

Any advice would be appreciated,

Nafsika

0 Kudos
Message 1 of 3
(2,802 Views)
Solution
Accepted by topic author Nafsika

The incorrect waveforms are probably because you are only getting a single data point every time your while loop runs. At 240Hz you only have 4.17ms between points. If your while loop takes longer than that amount of time to run, you are going to miss some samples.

0 Kudos
Message 2 of 3
(2,780 Views)

Thank you, I was not thinking about the execution time. I will try to improve that aspect.

0 Kudos
Message 3 of 3
(2,740 Views)