Showing results for 
Search instead for 
Did you mean: 

How to design loops so as to avoid missing iterations ?

I have multiple while loops in my VI, one of them driving the watchdog timer (say loop1). I have also tried using timed while loops. But in any case I see the LED (from loop1) blinking inconsistently usually when some other process takes up time. This happens even when using timed loops when I have assigned it the highest priority.

I read several articles on the NI website and then one final one " Using the Timed Loop to Write Multirate Applications in LabVIEW" which says "Occasionally, an iteration of a Timed Loop might execute later than the time you specified".

Is there any way to avoid this especially when designing time critical loops?

THank you,
0 Kudos
Message 1 of 4
(Are you already using RT hardware? Depending on your requirements, you might need to switch to LabVIEW RT.)

It is difficult to tell without seeing your code. What else is going on in the other loops? Anything communicating with devices?

First of all, don't rely on the "quality" of a blinking LED. The UI runs in it's own thread and FP updates might get skipped if cpu is tight. Use a timer and a shift register and measure the actual loop rate.

What kind of loop rate do you need in the high priority loop?

What is happening in the less important other loops? Make sure each of the other loops contains a wait statement. What is the CPU usage during the run?

It would really help if you could attach a small sample VI that demonstrates your point. Thanks!

Message Edited by altenbach on 03-03-2005 07:07 PM

0 Kudos
Message 2 of 4
If you have DAQ hardware or know hot to fire a pin on the serial or parallel port on and off, you can do a sanity check by toggling a bit within the loop and then using an oscillocope or frequency counter to look for REAL loop iteration inconsistancies.

As was stated, just because it looks inconsistent on the monitor does not mean it actually is, especially if you graphics system is being taxed.
"It’s the questions that drive us.”
0 Kudos
Message 3 of 4
Oh, that explains the delayed LED blinking. I am indeed toggling a DAQ port bit in this loop and if it was getting delayed in its execution the watchdog timer would have halted the entire execution. But it is not doing so. And thanks for suggesting a way to verify that by checking the frequency of toggling bit. That sure helps.

- Sharmila
0 Kudos
Message 4 of 4