cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Is there a way to pass an indicator to a Sub-VI by reference (a la c,c++)?

Highlighted

Is there a way to pass an indicator to a Sub-VI by reference (a la c,c++)?

Hey, I have multiple sets of controls that go to a common Sub-VI which sends the data to the various instruments, and which also returns status data which is then fed into indicators. One such indicator, through a certain sequence of commands, can lag behind one cycle (which lasts 1.5 seconds) and for that time the data is misreported.

What I need to correct this problem is a way to make the Sub-VI change the value of the indicator on the Main-Vi's front panel before the Sub-VI finishes executing. I think Local Variables might work, but the problem is the Sub-VI needs to change different indicators depending on when it's called. So, what I am wondering is if there is a way to pa
ss by reference or use a pointer of some sort so that the sub-VI can change whatever value it is told to.

(Thanks all for the help with the other couple of questions. The fairly complex application which I've been developing despite no labview skills before two weeks ago has certainly improved in its quality and efficiency as a result.)
0 Kudos
Message 1 of 6
(1,723 Views)

Re: Is there a way to pass an indicator to a Sub-VI by reference (a la c,c++)?

By right-clicking on a control/indicator you can create a reference to that object. This reference can then be passed into a subVI, and changes can be made to the original object via property nodes.

I have attached a simple example demonstrating how to do this. Hope this helps!
Message 2 of 6
(1,723 Views)

Re: Is there a way to pass an indicator to a Sub-VI by reference (a la c,c++)?

Hi,

LabVIEW 6 has this ability and here is a typical example.

http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&B36BB3461DFDB44C86256931005D3210&cat=2E4161187E3DEB30862568660020BCC8


Ray
Regards
Ray Farmer
0 Kudos
Message 3 of 6
(1,723 Views)

Re: Is there a way to pass an indicator to a Sub-VI by reference (a la c,c++)?

Hmm, sorry I forgot to mention I'm using Labview 5.0.1. Can this be done using this older version?

-Dobbs
0 Kudos
Message 4 of 6
(1,723 Views)

Re: Is there a way to pass an indicator to a Sub-VI by reference (a la c,c++)?

Hi,

No. You will probably have to result to writing to a Global Variable(s) and having a seperate loop within the main VI to read the globals an update any control etc.



Ray.
Regards
Ray Farmer
0 Kudos
Message 5 of 6
(1,723 Views)

Re: Is there a way to pass an indicator to a Sub-VI by reference (a la c,c++)?

You can open a VI reference to the caller and use methods "Set Control
Value" and "Get Control Value".

Jean-Pierre Drolet


LabVIEW, C'est LabVIEW

0 Kudos
Message 6 of 6
(1,723 Views)