LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

while loop containing subpanel does not stop promptly as expected

I'm new to labview and have had many questions but those I can fix on my own. However, I could not find an answer for this one. I'm trying to make a user friendly interface for an application with several main functions by running every main functions on the subpanel of the host.vi. After I put the main menu on the subpanel. I want the exit button to quit the main menu.vi as well as the host.vi by using reference. This is where I got an unexpected behavior which I have to click the exit button twice to quit. I don't know what went wrong. Thanks a lot in advance.

 

I am using Labview full development 2012 on window 7 home premium

Download All
0 Kudos
Message 1 of 2
(2,379 Views)

 

My first guess is a race condition, because the stop button in the main VI gets read right away (while still false) at the beginning of the iteration, so the changes occuring from within the subVI are only seen one iteration later. You need to ensure that the stop button gets read only after the subVI completes execution.

 

Why do you insert the VI with every iteration of the while loop?

What is the point of the value property node at the bottom? (since it executes in parallel to the main loop, the order of operations is not predictable. In fact, if the stop button happens to be true when the program starts, the loop might read a true before the value property has a chance to set it to false. You need to enforce correct execution order.

Message 2 of 2
(2,371 Views)