10-10-2012 09:48 AM
Hello everyone!
I am unsure how Labview is handling the following situation:
I have a timed loop with a period of 1000 ms. It is configured to discard lost iterations and keep the original phase. I have created a task that should read continuously at a 1 kHz rate. In the timed loop there is the DAQmx - Read function ( analog signal, 1 channel, N samples)
Now, if I set the number of samples per channel to e.g. 1500 (so that it takes 1500 * 1 ms = 1500 ms > timed_loop_period to read them), I notice that the timed loop takes ~1500 ms to complete. The same happens with any other number larger than the loop period.
Does this mean that the loop period is changed to 1500 ms? Or is something different happening?
Thank you!
Best wishes,
Samuel Lopez Santamaria
Solved! Go to Solution.
10-10-2012 10:02 AM
You are going to wind up with a loop iteration of 2000 msec.
A loop iteration will always take as long as it needs to complete. If you tell it to maintain original phase and it runs long, then it will wait until the next 1000 msec have passed as well before going to the next loop iteration.
Now with your situation, later iterations may not take as long. If you are continuously acquiring data, the DAQ mx buffer is filling up while the loop is still waiting. So when it runs again, there may already be 500 msec worth of data in the buffer, and it just needs to wait another 1000 msec until you've acquired the total of 1500 msec of data you requested.
The situation for the third loop iteration will depend if the second one got done within the 1000 msec, or ran just a bit long. Then it will behave either more like the first iteration, or like the 2nd iteration.
My question to you is why are you using the timed while loop? What feature of it do you require that a regular while loop is not? I think mixing and matching the features of a timed while loop with your DAQ acquisition is going to cause continually varying behavior in loop times that is probably not what you want, or could cause you problems down the road if what you are trying to do is get smooth, continuous acquisition from your DAQ device.
10-11-2012 04:16 AM
I have to use the timed loop because I don't need the data directly, but only some features of it, in real time. I am recording brain signals, and I am interested e.g. in the instantaneous phase and amplitude. So my idea was to put the recording and the analysis diagrams together in a single timed loop. I expected that the loop would give me these instantaneous features at regular intervals with a constant delay.
So, thanks for your answer! I wasn't sure about what Labview was doing.