LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

control VI from another VI

Solved!
Go to solution
I have a small problem about controlling the VI from another VI. I attached the sample of the VIs that work similar to my application.
From the attached VIs, TryOut2.vi is used to stop the counting of TryOut1.vi. The stop button of TryOuy1.vi only read the logical value from TryOut2.vi only when it start, but when the Stop button from TryOut2.vi is pressed , the TryOut1.vi won't stop. How can the TRyOut1.vi can be controlled by TryOut2.vi

Thanks

Download All
0 Kudos
Message 1 of 5
(2,852 Views)

Your stop button in tryOut2.vi is read only once at the beginning. To read it in every iteration of the while loop, it must be placed inside the while loop.

Use execution highliting (the light bulb icon), to watch how the program executes.

 

Felix

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

I also tried by moving the stop button of TryOut2.vi to inside its the while loop, but result is still the same. The TryOut1.vi is still read only the value only when it start.  Is there any setting that I have to set ?

Thanks.

0 Kudos
Message 3 of 5
(2,827 Views)

You have to rewrite the VI. You need to understand basic dataflow. When you have a subVI, you pass execution to it and nothing is passed again until the subVI finishes and returns to the main. Since you don't have any way to pass a stop condition to the subVI, you are stuck. You could simply make the front panel of the subVI visible and use it's top button. You could also create a reference to the main's stop button and pass that to the subVI. You would then use the reference in the subVI to control it's stopping. You could also use a global variable. Set it in the top level and read it in the subVI.

 

There are shipping examples and numerous posts related to this subject as it a subject that many beginning programmers have a problem understanding.

 

Your main has a big prblem as well with the stop button outside the loop. You can't do anything with it there either.
0 Kudos
Message 4 of 5
(2,819 Views)
Solution
Accepted by topic author skytalker
Thank you, i have figured it out.

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