I am acquiring data within a loop using DAQ Assistant (4-20mA signal) and then writing this data to a file in each loop iteration (file is opened and closed outside the while loop). To control the sampling rate of the loop, I use the Wait Until Next ms Multiple vi and in DAQ Assistant, I use the 1 sample On Demand option.
At slower sampling rates (100 ms or 10Hz), the program is doing an okay job at capturing the data at equal time increments. However, at higher sampling rates (10 ms or 100Hz, which is what we're shooting for in our application), some of the time points are repeated, even though the corresponding data for those time points are different. For example, when collecting at 100Hz, we'd see something like this in the output file:
Time (s) Data (units)
0.015625 1.5
0.015625 2.8
0.03125 6.3
0.046875 3.1
0.046875 7.2
Overall, we are, in fact, seeing about 100 samples in a 1 second period, but we keep seeing these repeated time points.
For our application, we would like to collect the data at 100Hz and then perform an FFT on this data, however, we would like the time vector to contain equal time increments.
Is this timing issue a common problem? Any suggestions on how to fix it, or if not, how to perform an FFT within a program that is writing each data point to a file within each loop iteration? Should we just use the Tick Count for our time data?