From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping a SubVI without stopping the main VI

Hi,

 

I have a VI with two SubVIs which are being executed sequently, with the second SubVI waiting for an user event in the first SubVI. The SubVI front panels are open and used as the user interface when they are executed. When I push the stop button on the second SubVI's front panel, I do not want the whole VI to stop, but only that SubVI and execute the first SubVI once again.

 

Does anyone have any idea how to achieve that?

 

Thanks,

 

LordSnow.

0 Kudos
Message 1 of 14
(4,081 Views)

@LordSnow wrote:

Hi,

 

I have a VI with two SubVIs which are being executed sequently, with the second SubVI waiting for an user event in the first SubVI. The SubVI front panels are open and used as the user interface when they are executed. When I push the stop button on the second SubVI's front panel, I do not want the whole VI to stop, but only that SubVI and execute the first SubVI once again.

 

Does anyone have any idea how to achieve that?

 

Thanks,

 

LordSnow.


I am bit confused of what you try to achive. How you are executing your sub vi's if you can attach your ode it would be easy to see what you are trying to do.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 14
(4,071 Views)

Oh Lord!

 

Do you mean you are pressing the "Abort" button in the ribbon bar?  (I shook the magic 8-ball it said "it is very likely")

 

Do not do that!  (Stoping your vi with the abort button is like stoping your car with a tree.  It will stop but, there may be consequences.)

 

Abort instantly ends the LabVIEW RTE so all executing VIs are killed at the point and in the state they are currently in. (zero clean-up)  You really need to exit your vi's with some condition.


"Should be" isn't "Is" -Jay
Message 3 of 14
(4,060 Views)

@JÞB wrote:

Oh Lord!

 

Do you mean you are pressing the "Abort" button in the ribbon bar?  (I shook the magic 8-ball it said "it is very likely")

 

Do not do that!  (Stoping your vi with the abort button is like stoping your car with a tree.  It will stop but, there may be consequences.)

 

Abort instantly ends the LabVIEW RTE so all executing VIs are killed at the point and in the state they are currently in. (zero clean-up)  You really need to exit your vi's with some condition.


Sorry for being that blunt, but right now I feel it's necessary: I'm not an idiot... With "stop button" I meant the control which one can place on the front panel!

Message 4 of 14
(4,053 Views)

P@Anand wrote:

@LordSnow wrote:

Hi,

 

I have a VI with two SubVIs which are being executed sequently, with the second SubVI waiting for an user event in the first SubVI. The SubVI front panels are open and used as the user interface when they are executed. When I push the stop button on the second SubVI's front panel, I do not want the whole VI to stop, but only that SubVI and execute the first SubVI once again.

 

Does anyone have any idea how to achieve that?

 

Thanks,

 

LordSnow.


I am bit confused of what you try to achive. How you are executing your sub vi's if you can attach your ode it would be easy to see what you are trying to do.


Regretfully, I can't upload my code. Therefore, I will try to be more precise in my description. I open the main VI and execute it. This opens and executes the first SubVI, which waits for the user to interact with the front panel. Once this interaction has taken place, the second SubVI is executed which includes pretty much all the code there is. When I did everything I wanted to do in this second SubVI I push the previously mentioned stop button in order to stop that SubVI and that SubVI only, but right now all the VIs stop. My intention is to open the first SubVI again after I stopped the second SubVI.

 

Does that help?

0 Kudos
Message 5 of 14
(4,053 Views)

I believe you have a while loop in the 2nd sub vi you mentioned and also I am not sure if you have a while loop in the main vi. In your 2nd sub vi create a stop button of your own and wire it to the stop terminal of the loop then use a while loop in the main vi. So now you have your main vi running continously which means once your 2nd sub vi is done your 1st sub vi again starts running. This is what you want right?

-----

The best solution is the one you find it by yourself
0 Kudos
Message 6 of 14
(4,046 Views)

Do you mean something like a simple state machine?

bb.png


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 14
(4,041 Views)

Oh.. Yeah.. 🙂

-----

The best solution is the one you find it by yourself
0 Kudos
Message 8 of 14
(4,032 Views)
I have a while loop both in the second SubVI and in the main VI. Both loops have terminals which are not interdependently wired, therefore I thought that the while loop in the main VI would continue to run even if I terminate the while loop in the second SubVI. Apparently, I was wrong, because the whole program stops when I push the stop button.
Both SubVIs are in the main VI's while loop. Is it possible that this is why it is not working as intended, that terminating a VI within a while loop causes the while loop to terminate as well?



 

0 Kudos
Message 9 of 14
(4,031 Views)

Launch you sub VIs with: Start Asynchronous Call

0 Kudos
Message 10 of 14
(4,028 Views)