LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Call By Reference Node doesn't behave as I'm led to believe...

I'd be very grateful to anyone who could help with my problem...

I've got an application going that uses a fair few VI's, and recently discovered the great technique of
dynamically loading a SubVI. When using the Run VI/Open FP properties everything works fine, except
you can't feed through data as was possible when a subVI is statically dropped.
I then came across the Call By Reference node, which when used with a VI Refnum allows you to feed through data via the connector pane of the subVI. However, although the VI loads fine and data is passed through, when returning to the calling VI it has stopped running, and doesn't carry on running until the 'dynamically loaded' subVI is stopped.
Therefo
re I must be either missing something (most likely!) or Call By Reference does not work as I thought.

I have tried different execution settings, i.e. messing around with different priorities & threads, but this makes no difference.

The only alternative I can think of is to use global variables that the caller writes to, and the subVI reads from.
However this is not my preferred method, and i imagine that this is not the best way to do things as I would need many variables in the global as I have a lot of SubVI's.

Thanks in advance for anyone who may be able to help.
0 Kudos
Message 1 of 3
(2,652 Views)
Call by Reference Node executes just like a statically called VI. If you are trying to start a VI and have it run while the main VI continues to run, use the Open VI Reference and the Run VI property as you mentioned. To pass values to the VI, use the Set Control Value property. You specify the name of the control and pass the value through a Flatten to String Function.
0 Kudos
Message 2 of 3
(2,652 Views)
A SubVI called by reference acts like a linked call: the caller VI waits for the end of execution of the called VIs to receive its outputs and continue the processing of the dataflow. It does not "stop" since it is still running a subVI and any parallel code on the diagram.

To pass data to a VI and let it run independantly, you use the Run VI method. Instead of using globals to set values, you can use "Set Control Value" to set the FP controls of the VI before invoking the Run VI method.


LabVIEW, C'est LabVIEW

Message 3 of 3
(2,652 Views)