Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

Timed loop misses data from USB-6009.

I am using a timed loop in LabView 8.0 to read data from a USB-6009. Occasionally, the data from the 6009 seems to be either all zeros or divided by 10. The gap between bad reads ranges from minutes to many hours. A very vexing problem. My timed loop is set at 98ms and the 6009 is sampling at 100ms. If I set the timed loop to 100ms, eventually a buffer overflows and I get an error.
How can I set up a loop, either a While or a Timed, such that good data is received every time and the buffer does not overflow. Is there a way to poll the 6009 to find out when data is ready?
What is the recommended method of retreiving data from the 6009?
0 Kudos
Message 1 of 3
How does LabView time its loops? If LabView is assuming "0" run time for the loop, and sleeping a fixed 98ms before running it again (as opposed to sleeping 98-[actual looptime] ms), then you should be very close to but under 100ms/loop. A polling read from the 6009 took about 1.5ms to execute. 98+~1.5 puts your loop very very slightly faster than the sampling time. Eventually, it will get enough ahead that you could do 2 reads between a single pair of samples, and the second would give you all 0's. With a 100ms loop, your loop could very slightly too slow, and eventually the device would sample twice without any reads in between.

Of course this is speculation and makes assumptions about how LabView might do timed loops, but I've seen similar errors in timing code in C++ that produced "weird" clock skew over long time spans. I'm sure about the polling read time of 1.5-2ms though because I fought it for a few weeks (even re-wrote my entire DAQ library in C++ instead of C#) with my 6009 before realizing it's a limitation of the USB interface. On that note, my C++ and C# code ended up running at the same speed, since the real delays were not in my code but in the USB requests.

Message Edited by 280Z28 on 05-23-2006 11:37 PM

Message Edited by 280Z28 on 05-23-2006 11:37 PM

0 Kudos
Message 2 of 3
Hi Chris,

Could you try running the Timed-Loop Example Program that installs with the driver (attached).  You can find that VI on your machine by going to Help > Find Examples > Search 'timed-loop' > Cont Acq&Graph Voltage-Int Clk-Timed

If the behavior still exists, then it could definitely indicate a problem with something bigger.  Otherwise it's likely to be something related to the code that you are running, and then I would try to get it to emulate this example as much as possible.

0 Kudos
Message 3 of 3