LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you terminate parallel while loops by the same case?

I have two parallel while loops that I wish to terminate by the same case. One while loop continually reads an analog input channel and displays the readings to an indicator. The other parallel while loop contains the structure for the program and continues until the operator is finished testing. Right now, I have to have a separate stop button for the while loop containing the real-time psotion of the unit under test. I wish to have both loops terminate when the operator is done testing and eliminate the repetative stop buttons.
0 Kudos
Message 1 of 2
(2,505 Views)
The easy way is to use a local variable of the stop button for your main loop. Right click and point to Create>>Local variable. Move the local into the other loop and wire it to the stop terminal of the loop.

In order to get away from using locals (or globals for that matter) you could use a semaphore. You need to create one first, pass it to both while loop and allow the first while loop the ability to destroy the semaphore. When it is destroyed, the 'timed out' terminal will be true. This case in your other loop will stop the loop. The false case of the 'timed out' terminal will be your code.

Jared
0 Kudos
Message 2 of 2
(2,505 Views)