After you create a shared variable, you can access the shared variable data in LabVIEW in several ways, regardless of the configuration:
![]() |
Note You can create, configure, and host shared variables only on Windows or RT targets with the LabVIEW Real Time Module. You can use the DataSocket VIs and functions to read or write shared variables from other platforms. If you have a VI with a Shared Variable node that was configured on a Windows system, you also can move that VI to another platform. |
Use front panel data binding to read or write live data in a front panel object.
![]() |
Note You can bind front panel objects only to network-published shared variables. |
Drag a shared variable from the Project Explorer window to the front panel of a VI to create a control bound to the shared variable. You also can use the options on the Data Binding page of the control Properties dialog box to bind the control to a shared variable or to an NI Publish-Subscribe Protocol (NI-PSP) data item on the network.
![]() |
Note If you are using a network-published Shared Variable node that is configured to read data, you must run each Shared Variable node before the node subscribes and starts receiving buffered values. If a buffer for a network-published shared variable overflows, the data is lost, and LabVIEW does not return an error. |
![]() |
Note Opening a VI containing a Shared Variable node in a project where the Shared Variable node cannot find its associated shared variable in the Project Explorer window causes the Shared Variable node to break. Any front panel controls associated with the missing shared variable also break. This behavior is specific to Windows and only occurs when you open the VI in a project. If you open the VI in the main application instance, you do not receive notification of missing shared variables. |
When you enable data binding for a control, changing the value of the control changes the value of the shared variable to which the control is bound.
Front panel data binding is primarily intended for sharing live data. To read data in local files, FTP servers, or Web servers, use the DataSocket Read function, the File I/O VIs and functions, or the Application Control VIs and functions.
You can set the value of a front panel control directly on the front panel and then write the data, or you can build a block diagram, wire the output of a VI or function to an indicator, and write the data from that indicator. Typical scenarios for using front panel data binding with shared variables or NI-PSP data items include the following:
The front panel objects that read data do not have to be the same kind of objects that write the data. However, the front panel objects must be the same data type. If the front panel objects are of the numeric type, the data types must coerce. For example, you can use a digital indicator in your VI to view the data that a thermometer in another VI generates. The thermometer can be a floating-point number, and the digital indicator can be an integer.
You can connect front panel objects using the dstp, opc, ftp, http, and file protocols by selecting DataSocket from the Data Binding Selection drop-down list on the Data Binding page of the control Properties dialog box. However, using front panel data binding to control a front panel control remotely through the Shared Variable Engine provides faster and more reliable data transmission as well as seamless connections to shared variables and NI-PSP data items. Select Shared Variable Engine (NI-PSP) from the Data Binding Selection drop-down list on the Data Binding page of the control Properties dialog box to bind the control through the Shared Variable Engine.
Front panel data binding connections through the Shared Variable Engine use NI-PSP, the protocol that transmits shared variable data. dstp connections pass through the DataSocket Server.
While the VI is running, if the connection to the Shared Variable Engine is successful, a small green indicator appears next to the front panel object on the VI. If the connection is not successful, a small red indicator appears. Before LabVIEW attempts to connect to the server, a small transparent indicator appears. A status message also appears if you move the cursor over the indicator. You can hide this indicator by right-clicking the front panel object and selecting Visible Items»PSP LED from the shortcut menu. You also can use the Data Binding:LED Visible property to hide the indicator programmatically.
If you receive errors when attempting to read or write data from the front panel, investigate the following possible causes:
A Shared Variable node is a block diagram object that points to the corresponding shared variable in the Project Explorer window. Use a Shared Variable node to read and write the value of the shared variable and to read the timestamp for the shared variable data. Drag a shared variable from the Project Explorer window onto the block diagram of a VI in the same project to create a Shared Variable node.
You also can place a Shared Variable node on the block diagram from the Data Communication palette. To bind a Shared Variable node on the block diagram to a shared variable in the active project, double-click the Shared Variable node to display the Select Variable dialog box. You also can right-click the Shared Variable node and select Select Variable from the shortcut menu. Navigate to a shared variable in the Shared Variable list in the Select Variable dialog box and click the OK button.
By default, the Shared Variable node is set to read. To change the Shared Variable node on the block diagram to write, right-click the Shared Variable node and select Change to Write from the shortcut menu. The Shared Variable node in the following figure is set to write.

Use the timestamp indicator to determine if the shared variable value is stale, or if it has been updated since the last read. To record a timestamp value for a single-process shared variable, you must first place a checkmark in the Enable timestamp checkbox on the Variable page of the Shared Variable Properties dialog box. Add a timestamp indicator to a Shared Variable node by right-clicking the Shared Variable node on the block diagram and selecting Show Timestamp from the shortcut menu. If your application requires more than one recent value, configure buffering.
The Shared Variable node uses the configuration you set for the shared variable in the Shared Variable Properties dialog box. When you update the shared variable configuration, LabVIEW updates the Shared Variable node. For example, if you change the Data Type of the shared variable, LabVIEW updates the Shared Variable node to the new data type in the block diagram.
To specify how a Shared Variable node connects to a shared variable, you can set the node to absolute or target-relative.
An absolute Shared Variable node always connects to the shared variable on the target on which you created the shared variable. Shared Variable nodes are absolute by default. If a VI contains an absolute Shared Variable node and you open the VI on a new target, the node attempts to connect to the shared variable on the target on which you created the shared variable. The VI appears with a broken Run button.
A target-relative Shared Variable node always connects to the shared variable on the target on which you run the VI that contains the Shared Variable node. If you move a VI that contains a target-relative Shared Variable node to a new target, you also must move the shared variable to the new target. Use target-relative Shared Variable nodes when you expect to move VIs and variables to other targets.
To change an absolute Shared Variable node to target-relative, right-click the Shared Variable node on the block diagram and select Change to Target Relative from the shortcut menu. Target-relative Shared Variable nodes appear with a double-arrow glyph on the node. The following image shows a target-relative Shared Variable node.

To change a target-relative Shared Variable node to absolute, right-click the Shared Variable node and select Change to Absolute from the shortcut menu. The following image shows an absolute Shared Variable node.

You also can use the DataSocket VI and functions to share shared variable data programmatically using NI-PSP.