LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass control references through subvi's

I am trying to build an application that utilizes a few different levels of subvis. So for example the hierarchy simplified would be Top-level->subvi2->subvi1.

In subvi2 I have control references that update the front panel of subvi2 to display the indicators of subvi1. That all works fine.

My Top level Vi is a state machine that will call subvi2, which in turn calls subvi1. I would somehow like to pass the indicators of subvi2 to the Top-level to be displayed. What is the best way to do this?

Thanks for your help,

-Steve

0 Kudos
Message 1 of 7
(3,842 Views)

The best way is to wire the indicators of subVI2 to the indicator terminals in its parent, your Top Level VI.  The second best way would be to pass a control reference to subVI2 where you would place a property node on the block diagram and select the "Value (variant)" property.  Wire whatever you want to appear on the corresponding indicator to that Value input on the property node.

You can create the control reference by right-clicking on the indicator of your top level VI and selecting the Create >> Reference option.  You will also need to place a control reference control on subVI2 and assign it to the connector pane.

Dan Press

PrimeTest Automation

0 Kudos
Message 2 of 7
(3,825 Views)
Thanks for your help Dan.  One thing I neglected to say is that the I want the indicators of my Top-level front panel to update while the subvi is executing.  So if I wire indicators of subvi2 (the indicators that I am intreseted in are actualy control reference from subvi1)  the wouldn't update while the subvi was running.
 
As for the control references this is where I am having some problems.  I can use control references to have the indicators on subvi1 update the indicators on subvi2 while they are running.  My question is how can I get the indicators on  subvi2 (which are control refences to subvi1)  to display and update on the Top level when I call subvi2?
 
Thanks again,
 
-Steve 
0 Kudos
Message 3 of 7
(3,814 Views)
Steve,

I think this cheesy example (7.0) should show you what to do.  You can pass that control reference as deep into the heirarchy as needed.

Dan Press
PrimeTest Automation
0 Kudos
Message 4 of 7
(3,797 Views)

Dan,

I see what you mean, thanks. In my program I have "subvi2" running stand alone so that I can debug it. As a result I have a reference indicator on the front panel of subvi 2 going to subvi1, so that I can see the slide when I just run subvi2 and not top level. How can I do that in your example? How can I see the slide move up when I just run subvi2, and then later be able to run top level and see the slide move as well?

Thanks so much for your help!

-Steve

 
 
 
0 Kudos
Message 5 of 7
(3,790 Views)
Good point.  It is often helpful to be able to run a subVI and see such behavior without rewuiring the Top Level VI to run.  I modified SubVI2 to choose an internal control reference if it is running as "top level" or "standalone".  The same thing can be done to SubVI1.

Dan Press
PrimeTest Automation
0 Kudos
Message 6 of 7
(3,781 Views)

That works great,  just what I wanted to do.

Thanks so much.

-Steve

0 Kudos
Message 7 of 7
(3,770 Views)