LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stop while from outside loop

Hello
I hava an application with a while loop. Outside this loop there is a subVI, that contains also a while loop. This subVI can be stoped when the main VI loop stops. This works correctly.
But the subvi, can also stop itself, and when it happens I want the main VI loop to stop also.
How can I do this?
(The idea is that the loop in the subvi has to stop the main VI loop)
Thank you very much!!
0 Kudos
Message 1 of 3
(2,804 Views)
Hello.
A simple way would be to use global variables, but here is another way. Please note that in this example, the main VI cannot stop the loop in the subVI; since you said you had already achieved that I didn't worry about that part, just the part of the subVI stopping the main VI's loop.
Here are a pair of VIs. When the subVI's loop finishes, the subVI finishes execution (which is a requirement for this method) and changes an indicator in the main VI. The value of this indicator is read by a local variable and used to stop the loop in the main VI.
Hope this helps.
Download All
Message 2 of 3
(2,804 Views)
Thanks, this was what I wanted to do. I thougth on this method, by I thought the value of the local variable won't be inside the loop in the main VI, because this loop was running. I was wrong.
Thanks again!!
0 Kudos
Message 3 of 3
(2,804 Views)