LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stop subvi without stopping toplevel vi

hello
 
I stop a subvi wth a Stop command (stop sign) but when tis executes it also stops the top level vi, is there another way. The stop command is used as a skip option.
 
Thnx
Bart Bakels
Labview CLD , Engineer/Manager

Promedes and DSM
using LV 7.1, 8.0, 8.2, 8.5 and 2009 SP1
http://www.promedes.nl
0 Kudos
Message 1 of 11
(10,769 Views)

Hi,

The stop.vi is not a normal way to stop a vi. It works the same way as if you would press teh stop button in LabVIEW.

Just terminate your sub-vi normally, it will stop and the top level will continue.

By terminate normally I mean that it don't have any more operations to do.

Paulo

 

Message Edited by PauloM on 07-13-2005 04:02 PM

0 Kudos
Message 2 of 11
(10,761 Views)
The Stop sign is not a stop command, it's an abort button and should only be used while building and debugging your application. It stops all running VIs instantly and can leave any hardware you using in an unsafe or unknown state because it does not allow your clean up code to run. There is no way to change the way it works.

What you'll need to do is add a control to your front panel that stops the VI properly. Once the subVI stops, the main VI will resume running. Normally you'll have all your code in a While loop to keep it running and connect a Stop button from the front panel to the loops conditional terminal to stop it when needed.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 3 of 11
(10,757 Views)
You should never use the "Stop" function in a stop VI (or at all for that matter). You need to stop the subVI's while loop by passing a value to the termination terminal so that the subVI can return execution normally to the main. What are you trying to skip in the subVI. Using a state machine architecture will allow this and if you're using the sequence structure, is a much better method. There are shipping examples of state machines.
0 Kudos
Message 4 of 11
(10,753 Views)
As everyone as mentionned...
 
Typically, sub-vi's stop because they meet a certain condition, whether it is a boolean from a control (stop button - not the stop sign), or a condition to exit a loop, or merely completing the task which causes to end (thus exit)  the sub-vi.
 
Experiment with some examples.  You will see that ending and exiting a sub-vi does not stop the main vi.  Unless of course that the main vi only has the sub-vi, then they will both terminate.  😉
 
JLV
Message 5 of 11
(10,734 Views)
the problem is that I want to have a sort of abort fuction within that subvi. the subvi consists of a lot of loops in a sequence.  and I want to abort them al at once if an error occurs. (user resses top button) The frontpanel is displayed in the top level vi with a VI panel.
 
 
Labview CLD , Engineer/Manager

Promedes and DSM
using LV 7.1, 8.0, 8.2, 8.5 and 2009 SP1
http://www.promedes.nl
0 Kudos
Message 6 of 11
(10,731 Views)
This is only one of the reasons that Sequence Structures are generally not used. There is no way to stop one mid execution. It will always run to the last frame. There is no way around that without using the Abort button, which as you've seen kills everything.

You're best choice would be to rewrite the subVI and get rid of the Sequence structures. You can use dataflow between the loops to control what order they execute in, and if you carry an error cluster through the loops, you can use that to propagate your stop signal from one loop the next so they dont run.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 7 of 11
(10,725 Views)
Do NOT use a sequence structure. A sequence structure cannot be aborted prematurely except by the Stop function and that will stop your main. Replace the sequence structure with a state machine or combine an event stucture with a state machine. That will do exactly what you want.
Message 8 of 11
(10,724 Views)

in the mean time.....one year later :P... I never use sequence structures anymore. State machines are the way to do this. But i have one question.. I want a sequence of states to be run ( so state 1 then state 4 then state 8 , etc..).. and that sequence will be determind @ a state of that state machine....

for example I have a state machine VI that runs a test in every state. And the last state you can select to run the tests again that failed.. Is there a simple way to do this? maybe by using an array of states?

Greetz Bart

Message Edited by bartb on 05-30-2006 03:04 PM

Labview CLD , Engineer/Manager

Promedes and DSM
using LV 7.1, 8.0, 8.2, 8.5 and 2009 SP1
http://www.promedes.nl
0 Kudos
Message 9 of 11
(10,537 Views)

It sounds like you're looking for a "Queued State Machine."  I think there's a shipping example and I'm sure you'll get several hits by searching on ni.com

A Queued State Machine will let you queue up a whole sequence of individual states.  Another nice feature I've found is related to error handling.  Suppose you have an Error Handler state.  Whenever you detect an error, you can use "Enqueue at Opposite End" to put the Error Handler state immediately to the front of the line.

-Kevin P.

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 10 of 11
(10,519 Views)