LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sub-VI execution termination

I have a super-VI that calls several sub-VIs. At certain points during the super-VI execution, I would like to arbitrarily halt the execution of the sub-VI currently running. That is, I would like to be able to depress a Boolean Control, have the sub-VI stop and have control remain in the super-VI. Unfortunately, I have not been able to make this work. Perhaps functionality exists in Labview that I an not familiar with.
0 Kudos
Message 1 of 5
(3,079 Views)
As long as i can see, you can use two methods for that. One is to make your subVI execution depend on a global variable, and set this true or false depending you want it to stop or start. The other one is to use VI server to set your boolean control value, so you can make it true or false. If you need more info or an example, just ask.
Hope this helps
0 Kudos
Message 2 of 5
(3,079 Views)
Actually, I could use an example. I understand about using global variables. However, while the sub-VI is executing, how do I insure that the controller in the super-VI has registered its change of the global variable? Control is inside the sub-VI, right? From what I understand, this means that control remains there until the sub-VI finishes.
0 Kudos
Message 4 of 5
(3,079 Views)
If you have a control inside a subVI, you can generate a global variable of it. Then, in the "SuperVI" (that sounds great!) you can create a boolean control and wire it to the write global variable, so, next time the subVI checks it, it will have the same value as the SuperVI's control. It can be said that you have the control in both Sub and SuperVI.
0 Kudos
Message 5 of 5
(3,079 Views)
You can solve this in different ways.
The best is to let the subvi halt itself. In this way you keep control to the place where it should be. Normally you can do this by looking at some boolean on the frontpanel and stop your while according to that boolean.
If you want boolean buttons on your main vi you can send that information to a global variable and react in your subvi on the state of this global variable. No you are in the non dataflow region of labview and race conditions should taken care of.
There are better methods with queues and other messaging tools but only use them if the former approach is to easy.
greetings from the Netherlands
0 Kudos
Message 3 of 5
(3,079 Views)