LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Update inside a while loop

Hi

I have build a VI containing a while loop. When I execute the program it works perfectly, but when I use that VI in an other program it seems not to be possible to update the Boolean switch to stop the loop. The value of the Boolean control is read in the first loop and it�s not updated later. Is there anything I can do to overcome this problem?

I�ve tried with local variables, but since I�ll be using several of these VIs I can�t use global variables.

Thanks
0 Kudos
Message 1 of 2
(2,513 Views)
First of all there must not be anything data flow related that prevents the update to happen...the VIs must run in parallell, you can't have the VI be a sub-VI and then try to stop it in the loop in which the sub-VI was called, as that loop would then be waiting for the sub-VI...

If that's out of the way you can use a global, you can read the global in as many VIs you want...just write the stop condition to it whereever you want. There may be race conditions etc...but that could be a problem even with just one VI. However normally I would use a functional global instead...or in this case e.g. the notify functions.
0 Kudos
Message 2 of 2
(2,513 Views)