LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stop subVI without stopping main VI

Solved!
Go to solution

HI

 

  I have a Vi that has a subVI inside an event structure, and that subVI runs a measurement, and to stop it I have set up the code so that ater the measurement ends that the program aborts, by using the STOP button, which is the same as pressing the abort execution button.  But that is also stopping the main VI.  What I want to know is is there a way to stop this subVI without stopping the main VI

0 Kudos
Message 1 of 13
(4,861 Views)
Solution
Accepted by topic author fghfghgfhfhg

You should never use the STOP node unless you're using it for debugging.

 

Your code should follow data flow best practices and you can stop all of your loops using boolean logic. Within your subVI, you'll need to figure out a way to stop the loop(s) using booleans. This can be done in a million different ways depending on your code.

 

It sounds like maybe you need to tell the subVI to stop from outside the subVI? This can be done using a Queue architecture, a Notifier, or similar. I suggest you take a look at different architectures if you're unfamiliar.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 13
(4,857 Views)

Why would you use an event structure in the subVI? By definition, it is for responding to front panel events and if you don't show the front panel, a user can't interact with it. You certainly hack something up but you should either remove the event structure or have it in the main.

0 Kudos
Message 3 of 13
(4,827 Views)

@Dennis_Knutson wrote:

Why would you use an event structure in the subVI? By definition, it is for responding to front panel events and if you don't show the front panel, a user can't interact with it. You certainly hack something up but you should either remove the event structure or have it in the main.


I read it as the subVI is within the event structure, so the event structure is in the main VI.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 4 of 13
(4,812 Views)

the event structure is in the main VI

 

0 Kudos
Message 5 of 13
(4,783 Views)
If the event structure is in the main, why would you need to use the Abbott button? Does the subVI have a while loop that needs to be stopped?
0 Kudos
Message 6 of 13
(4,731 Views)

Dennis, he posted a new thread here...

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 7 of 13
(4,727 Views)
Just saw that. Silly to start a new thread.
0 Kudos
Message 8 of 13
(4,723 Views)

yup

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 9 of 13
(4,718 Views)
please does anyone have an example of how to use the notifier, queue architecture etc as mentioned above by James to stop the SubVi from the main vi.

I am a beginner so kindly include as much details as possible so I can understand the concept.

[BADGE NAME]

0 Kudos
Message 10 of 13
(4,376 Views)