LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to bring a variable of a subvi all the way to the top level vi (GUI)

Solved!
Go to solution

Hello everyone,

 

I currently working on motion control of six axes with labview via RS232 communication. These axes are controlled sequentially so no more than one axis is moving at a certain point in time. To do this i need to poll the status bit of the axis to see if the move is completed or not. Basically a while loop that stops "asking" for the status when the statusbit is "1". This is done by a vi that is nested somewhat deep in the software architecture (lowlevel vi). The behavior of this vi is neccessary because it stalls the execution of the remaing vi's until the movement is completed. therefore i am sure that no commands are sent to move a second axis during the movement of the another axis.

 

What i would like to do is bring the status of the movement all the way to the front panel of the GUI so that the operator can see if the axis is moving or not. But the problem is that the vi that handles these status requests only releases output data when the while loop stops, in this case when the movement is completed. And i would like to know the status on a regular interval, for example every 100ms or so??

 

How can i bring the value of the status bit to the GUI? Do i need to place another vi on the top level that also asks for the status?

 

 

Any help is much appreaciated,

Best regards.

0 Kudos
Message 1 of 5
(2,835 Views)
Solution
Accepted by topic author ynse

You can pass a reference to what ever main VI front panel control/indicator you want to display it on.  Then in your SubVI's loop, use that reference with a Value property node to update the front panel's control/indicator.

Message 2 of 5
(2,834 Views)

there are several ways to do this, global variables will be one but you will have to take care of race conditions. Using a FGV (Functional Global Variable) will reduce the risk of race conditions and it will make the trick.

 

regards

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

Hi Ravens Fan,

 

Thanks for the the advice, i made a simple example and it seems to be working. I'll try it out with the status bit. Smiley Wink

0 Kudos
Message 4 of 5
(2,786 Views)

Hello ethan85,

 

I also thought about globals but i dont realy like them because of the reasons that you mentioned. I never tried FGV before, so I'll give it a try and see what happens. Thanks for the help.

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