LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to run the SubVIs?

In my program a subVI must opened when I press a button. When I run my program and press the button, the subVI dowsn't continue running until I press on the run button again. How can I do that subVI continued running?
Download All
0 Kudos
Message 1 of 5
(2,613 Views)

Hi Tar

 

Try using a While loop. See the attached.

 

Best Regards

 

David

NISW

0 Kudos
Message 2 of 5
(2,605 Views)

Well, a while loop is correct, but your implementation is not. In that example the subVI will not run until the while loop is finished, which is, errrr... pointless. Also, you have a greedy loop.

 

The question is somewhat misleading because the subVI is set up to run when opened, and "suspend when called", which doesn't make sense if it's supposed to be a subVI. It's possible the user did this when he couldn't get the code to work.

 

One solution is to turn off the "run when opened" and "suspend when called" from the subVI and simply call the subVI, passing values from control on the top VI. 

 

This does beg the question: are you trying to create a popup?

Message 3 of 5
(2,581 Views)

You are completely right smercurio, a greddy loop is a definite no no, I stand corrected. Shouldn't have been in such a hurry Smiley Happy

 

As to the pointlessness, I agree. But then again I myself write completely pointless VIs to test parts of algorithms. In this case the question posted was "Why do I have to press the run button after I the boolean button to make my subVI appear?" The answer to that isn't "Why do you want to subVI to appear?", it's "because your code reads the boolean button only ones at the start before you have time to press it and then the VI is finishes". I imagine the why will come in a later post Smiley Happy

 

Best Regards

 

David

Message 4 of 5
(2,562 Views)
wow, that one goes to the typo hall of fame Smiley Very Happy
0 Kudos
Message 5 of 5
(2,539 Views)