From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
You can pass access to front panel object values, properties, and methods to subVIs by using explicitly linked control references. Explicitly linked control references consist of a general property or invoke node with an explicit control reference wire to its input.
In this example program's main VI, there is a Control Reference constant for the Waveform Chart Indicator and the Boolean Stop Control. The explicit references to these front panel objects are wired to the subVI input terminals.
The subVI has two Control Refnum controls, one corresponding to the Waveform Chart and one to the Stop boolean control. Looking at the subVI block diagram, we can see what is being done with the control and indicator from the main VI. The Waveform Chart Refnum is fed to a Property Node that turns on autoscaling for the chart. This refnum is then passed inside the while loop where it is used to write a value to the chart in the front panel of the main VI. Meanwhile, the Boolean refnum is being used to read the current value of the Boolean control in the main VI's front panel to determine when the user selected the stop button.
This example illustrates how to read and write values from a subVI to controls and indicators in a main VI. A similar example that would be useful involves doing data acquistion in a subVI, displaying the data in the main VI, and terminating the data acquisition being done in the subVI from the main VI.
More more information on creating Control References, see the Concept Document on NI Developer Zone titiled "Control References: Overview".
How to Create This Setup from Scratch
Modifications to the SubVI:
Modifications to the Main Program:
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.