I am building my first Labview application and I think I arrived to a enough good solution. But I have some problem with the timing
of my application. Is a very basic problem, I guess.
In a few words, I have basically a while loop that performs the following operation sequencially:
a0) Read a waveform data stored in a shift register
b0) Analize the waveform in a0 with the extract tone Vi;
c0) Send one voltage output to the AO0
d0) Read some voltage data from the DAQ (AI0-2) in continuous samples mode 1Dwavef,NChan,Nsamples;
e0) Save the data to hard disk in ASCII for the results (a few lines in DBL) and in binary for the array of waveform
f0) Send one of the acquired waveform to the shift register
Everything work perfectly, but my problem is that i acquire 250S at 10kS/s (25 ms of acquisition required), and I calculate the time required
for the while loop to execute. The program gives me a distribuiton of execution times, ranging from 30-35 ms to 15-20 ms. The 30-35 ms
is fine, considering 25 ms of acquisition and processing. I don't understand the 15-20 ms of execution time, once the only acquisiton lasts
25 ms. 30-35 and 15-20 execution times almost appear consecutively apart some random exceptions.
I think that the program is working BUT is not doing what I want, ie acquire new data every 25ms+processing&saving time, but is using data
in the DAQ card memory.
In attachement I send the program.
Thank you for the assistance.
I think you are a bit confused.
The time required for the while loop to execute has nothing to do with the rate of your acquisition. By choosing a sample rate of 10KS/s, you start storing your data in a buffer (PC buffer) with that rate, just after the data left your device until DAQmx READ VI is ready to retrieve it. So, the rate above, is not the rate that you read the data, but the rate you put the data into the buffer before you read them (acquisition rate-before you get into the while loop).
Hardware time means that you can be sure that you will acquire 1sample every 0.1milisecond but in 250 Samples sometimes you acquire less sometimes you acquire more.
Now, when it has to do about while loop execution time, you can not be sure, especially when you use all these mathematic functions inside. It just happens that the execution time is near the the acquisition time and confuses you. You can not be sure about the execution time, it is normal.