LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with References & Sub vi's

Hello,

 

Can anyone explain me the correct use of references and control refnum?

 

See attached screenshot of my sub vi.

I want to use these indicators from my sub vi in my main vi.

The indicators in my main vi should be updated instantly, not only once when my sub vi has finished.

 

Some help?

 

Thank you in advance.

0 Kudos
Message 1 of 3
(2,250 Views)

Sure, 

 

VI server referances are pretty useful to remove clutter from your user interfave VI and offload functionality to sub.vis  Lets start with a basic example that does not use referances (seen here) that I built yesterday for a forum example.Pseudo bar.png

Suppose we want to declutter the FP of this vi so that it only shows the array and stop buttons.  I just need to create sub.vi

sub_vi.png

And somehow pass a value to the control refnums so sub.vi knows what to act on

There are a few way to do this:

Pseudo bar by val.png

Is very straight forward and uses the connector pane of sub.vi However, the silly snippet tool changed the viserver referances and the code looks like this

untitled.PNG

ARGH!

 

Another way to call the vi is by vi server referances like this

untitled.PNG

 

Ive attached all thre vis below for you to examine in detail

 


"Should be" isn't "Is" -Jay
Download All
0 Kudos
Message 2 of 3
(2,236 Views)

But my sub vi has only outputs, no inputs.

 

One of the outputs is a counter. The counter is displayed on an indicator in my sub vi.

 

Now, I want to be able to see every count step on an indicator in my main vi.

 

Right now, it runs the sub vi, finishes the sub vi and displays the last value of that counter.

----------------------------------------------------------------------------------------------------------------------------------

This is my understanding of references and control refnums at this moment.

On the sub vi you create a control refnum.

On the block diagram you link this control to a property node and put a value in it.

On your main vi, you create a reference, for example, to an indicator and link this as an input to your sub vi.

 

I'm not sure if its correct. So I want an output of the sub vi and I should link it as an input to a control refnum?

And in this current scenario the value of the counter in my sub vi is not update on the fly in my main vi.

 

I'd really appreciate some additional help.

 

Thank you in advance.

0 Kudos
Message 3 of 3
(2,227 Views)