Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Terminals inside or outside Loops

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info

Inputs pass data into a loop at the start of loop execution. Outputs pass data out of a loop only after the loop completes all iterations. If you want the loop to check the value of a terminal on each iteration, place the terminal inside the loop.

When you place the terminal of a front panel Boolean control inside a While Loop or a For Loop with a conditional terminal and wire the terminal to the conditional terminal of the loop, the loop checks the value of the terminal at every iteration to determine if it must iterate again. You can stop the While Loop shown in the following example by changing the value of the front panel control to FALSE.

If you wire the conditional terminal of a While Loop set to Continue if True to a Boolean terminal set to TRUE and placed outside the loop, you cause an infinite loop, as shown in the following block diagram. You also cause an infinite loop if you wire the conditional terminal of a While Loop set to Stop if True to a Boolean terminal set to FALSE and placed outside the loop.

Changing the value of the control does not stop the infinite loop because the value is not propagated until the loop stops and you run the VI again. To stop an infinite loop, you must abort the VI by clicking the Abort button on the toolbar. You cannot cause an infinite loop in a For Loop since you must wire the count terminal or auto-index an input array to set the maximum number of iterations for the loop.


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit