LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I stop a subvi from the front panel?

I need to be able to stop execution inside various sub-vi's and have everything shut down nicely. Currently I am doing that with a global "stop" button, but that is a bit of a pain because that stop button global variable exists in a separate window and has to be put on top then hit. How can I do this from my vi front panel? If I simply put a stop button there it is ignored until the program returns from the sub-vis.

Thanks
0 Kudos
Message 1 of 3
(2,888 Views)
Put the stop button on the front panel and on the diagram put it in a while
loop (running in parallel with the subvi) and writing to a stop global. Be
sure to put a 100msec delay in the loop with it so you dont use up too much
cpu time.

"jpartee" wrote in message
news:5065000000080000009F1E0000-986697009000@quiq.com...
> I need to be able to stop execution inside various sub-vi's and have
> everything shut down nicely. Currently I am doing that with a global
> "stop" button, but that is a bit of a pain because that stop button
> global variable exists in a separate window and has to be put on top
> then hit. How can I do this from my vi front panel? If I simply put
> a stop button there it is ignored until the program returns from the
> sub-vis.

>
> Thanks
Message 2 of 3
(2,888 Views)
jpartee wrote in message news:<5065000000080000009F1E0000-986697009000@quiq.com>...
> I need to be able to stop execution inside various sub-vi's and have
> everything shut down nicely. Currently I am doing that with a global
> "stop" button, but that is a bit of a pain because that stop button
> global variable exists in a separate window and has to be put on top
> then hit. How can I do this from my vi front panel? If I simply put
> a stop button there it is ignored until the program returns from the
> sub-vis.
>
> Thanks


I presume your subvis are running while loops with a stop button. The
best way is to use occurrences (under synchronization pallet). Creat
the occurrence in your main vi and wire the refnum to every subvi you
want to stop. Wire the "wa
it on occurrence" parallel to the stop
button. You can raise the occurrence when you want to stop the subvis.
The beauty is it will bypass the x millisecond delay in your while
loop and the exit is immediate. Take a look on the example on
occurrence in Labview.
0 Kudos
Message 3 of 3
(2,888 Views)