05-28-2011 01:09 PM - edited 05-28-2011 01:09 PM
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.
05-28-2011 02:22 PM
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.
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
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:
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
ARGH!
Another way to call the vi is by vi server referances like this
Ive attached all thre vis below for you to examine in detail
05-29-2011 03:37 AM
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.