07-19-2013 08:41 AM - edited 07-19-2013 09:11 AM
I am new in Labview and trying to sycnronize 3 tasks together one of which is reading analog input from 6 channels (I use cDaQ-9178 with two NI-9239 modules for Analog Voltage reading). I have a sampling rate of 1 kHz and in a while loop (working parallel to two other while loops) I read 100 samples per iteration. When I view the loop iteration time I see 60 ms for iteration which is quite strange as the task is started automatically inside the loop with DAQmx read VI so I expect to have at least 100 ms per loop iteration to be able to capture 100 samples. Have you ever had such an experience?
07-19-2013 10:12 AM
You can see a simple vi similar to what I am doing. If I use the channels from a simulated DAQ card, the loop always iterates around 100 ms. Whenever I use the installed NI9239 modules, it ends up 60 ms. Any ideas?
07-19-2013 04:19 PM
You might be being bitten by the "Data Flow Gotcha". The first clock will be read before you take the first sample. The second clock will be read before you finish acquiring 100 samples, formatting them, and writing to a file, but there's nothing that says exactly when in that 100msec "window" the read will occur.
Try putting the inner clock inside a Frame (I, personally, don't like frames, but this is one place they are needed). Wire the output from the DAQmx Read "through" it (so it is forced to wait until the DAQ Read finishes, and then reads the clock, and then hands the data off to be processed) -- I'll bet this solves your dilemma.
Bob Schor
07-30-2013 04:14 AM
Hello TUDelft,
I tried it at my side with a simulated cDAQ-9178 and also with the simulated one I got a loop rate of around 60 ms.
However, this is completely logical in this case.
The 9239 has a minimal sample rate of 1612,9 S/s (see http://sine.ni.com/ds/app/doc/p/id/ds-199/lang/nl) when using the internal timebase.
You indeed tried to set a sample rate of 1000 S/s, but DAQmx corrected this to the lowest possible sample rate (1612.9 S/s).
Measuring 100 samples at a rate of 1613 S/s comes down to a loop period of around 60 ms.