LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to click a button that is within another vi

Solved!
Go to solution

Hi All

 

I am stuck with a problem

 

I have two vi's. A MainVI and a SubVI. The SubVi is located within the MainVI. The Sub VI is like a continuous loop and can be stopped only by pressing a STOP button on the SUBVI front panel.

 

I need to control this STOP button from the front panel of the MainVI. But the problem is that, until the SubVI  executes completely, no changes made on the MainVi will be read.

 

 

The following methods have failed

Tried to pull the STOP button from the SubVI as a terminal.

Using global variables.

 

 

Is there anything like reference variables that can achieve this task.

 

Any help will be much appreciated.

Spoiler
 
0 Kudos
Message 1 of 4
(3,969 Views)
Solution
Accepted by topic author Mr_Miagi

In the main VI create a reference to the control (right click create ref).

 

Wire that ref into the sub-VI.

 

Inside teh sub-VI use a property node >>> Value to read the state of the stop button in the main.

 

Please note that you must READ the property node to get an updated value.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 4
(3,963 Views)

I guess you do not have the control of the Main VI until the sub vi is done since the sub vi is running continously. You have 2 options

 

1. Create a seperate loop in the main vi where you are not calling the sub vi then make the sub vi property to floating so that you can access the main vi also. Keep the control in the seperate loop and pass the reference to the sub vi using a global variable or just pass the wire. So use the value property node inside the sub vi to read the value of the control in the main vi.

 

2. Create a sub panel in the main vi and call the sub vi into the main vi so you will have access to both the main vi and the sub vi at the same time.

 

good luck

-----

The best solution is the one you find it by yourself
Message 3 of 4
(3,944 Views)

agree'd with ben...

Download All
Message 4 of 4
(3,931 Views)