LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why can a timed loop stop for several seconds and then continue?

I have a vi with 2 timed loops. The first is my data aquisition loop running at 100ms. The second does some housekeeping and data collection at 1000ms. The 100ms loop has a higher priority.
 
I have two USB modules connected:  USB-6009 and USB-9211A. The 6009 is set up to collect data every 100ms and the 9211 is set at 1000ms.
 
ONCE IN A WHILE, the 100ms loop, and possibly the 1000ms loop, just stop for several seconds and then start up again. tHE
 
How can I prevent this from happening?
 
The computer is running XP SP2, I have cleaned out as many services and other programs as possible. This a a fairly bare bones system. Other than my vi, the only other open program is My Computer. Is XP preempting my program?
0 Kudos
Message 1 of 2
(2,305 Views)
Hello cdreike,

Have you monitored the CPU usage under the Windows Task Manager?  Is the CPU usage ever approaching 100%?

Make sure you are creating and configuring your tasks before the timed loop, clearing them after the timed loop, and only doing the reads within the timed loop.  This way the tasks are only created once at the beginning of your program, and the overhead associated with creating and configuring the task is minimized.  Maybe you could post your code and we could make some suggestions.

If you are using the DAQmx Sample Clock VI or have your task configured for finite or continuous acquisition (as opposed to On Demand), you are doing hardware timed acquisition.  If you have two DAQmx Read VIs in your timed loop, one for each device, the loop will not go on to the next iteration until each DAQmx Read has executed.  If you have one task that is acquiring a single data point every 100ms and another task that is acquiring a single data point every 1000ms, and you are reading a single data point from both tasks every iteration of the timed loop, the second DAQmx Read will take up to 1000ms before a data point is available to read, and your loop will only execute every 1000ms.  Take a look at the error clusters passed around inside your Timed Loop and see if the loop is finishing late at all.

I hope this helps and let us know if you have any further questions,

Travis G.
Applications Engineering
National Instruments
www.ni.com/support
0 Kudos
Message 2 of 2
(2,280 Views)