Reading and Writing Shared Variables with Shared Variable Nodes
- Updated2026-01-28
- 6 minute(s) read
(Real-Time, Windows) A Shared Variable node is a block diagram object that points to a corresponding shared variable. Use the Shared Variable node to read and write the value of a shared variable.
- If your application accesses a large number of shared variables, access the shared variables programmatically to create a cleaner, more scalable block diagram.
- (Real-Time, Windows) Opening a VI containing a Shared Variable node in a project that does not contain the corresponding 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 occurs only when you open the VI in a project. If you open the VI in the main application instance, LabVIEW does not notify you about missing shared variables.
Adding Shared Variable Nodes to the Block Diagram
You can add Shared Variable nodes to the block diagram in the following ways:
- Drag a shared variable from the Project Explorer window onto the block diagram of a VI in the same project.
- Add a Shared Variable node to the block diagram from the
Shared Variable
palette. You then must complete the following steps to point the Shared Variable node to a corresponding shared variable in the
Project Explorer
window.
- Double-click the Shared Variable node to display the Browse for Variable dialog box.
- Navigate to a shared variable in the Project/Network Tree list.
- Click the OK button.
- (Real-Time, FPGA, and DSC Modules) Right-click a control, indicator, or constant and select Change to Shared Variable Node from the shortcut menu. You also can select from the shortcut menu when you right-click an output terminal.
Specifying Whether a Shared Variable Node Reads or Writes Data
Complete the following steps to specify whether a Shared Variable node reads or writes data to the corresponding shared variable in the Project Explorer window.
- Right-click the Shared Variable node.
- Choose between the following options in the shortcut menu:
- Select to read data from the shared variable with the Shared Variable node.
When you select this option, an output appears on the right side of the Shared
Variable, as shown in the following figure.

- Select to write data to the shared variable with the Shared Variable node.
When you select this option, an input appears on the left side of the Shared Variable
node, as shown in the following figure.
Note If you write less than 8 kilobytes of data to a shared variable, LabVIEW can take up to 10 milliseconds to send that data over the network. To eliminate this delay, use the Flush Shared Variable Data VI to send the shared variable data immediately.
- Select to read data from the shared variable with the Shared Variable node.
When you select this option, an output appears on the right side of the Shared
Variable, as shown in the following figure.
Determining Whether a Shared Variable Value Has Been Updated Since the Last Read
Complete the following steps to use the timestamp indicator of a Shared Variable node to determine whether the shared variable value has been updated since the last read.
- LabVIEW configures network-published shared variables for timestamping by default. To record a timestamp value for a single-process shared variable, you first must place a checkmark in the Enable Timestamping checkbox on the Variable page of the Shared Variable Properties dialog box.
- LabVIEW disables timestamps by default on I/O variable nodes because timestamps require additional memory and CPU overhead that can affect the determinism of an application. Enable timestamps for I/O variable nodes only if you plan to use the timestamps.
- Right-click a Shared Variable node and select from the shortcut menu. A timestamp output appears
on the right side of the Shared Variable node, represented by the red hourglass shown in
the following figure.

- Right-click the timestamp output and select from the shortcut menu to create a front-panel indicator that displays the timestamp data.
Determining Whether a Shared Variable Node Timed Out
Complete the following steps to specify a timeout period for the Shared Variable node and determine whether the Shared Variable node timed out.
- Right-click the Shared Variable node on the block diagram and select from the shortcut menu
- Specify a timeout in milliseconds with the ms timeout control,
represented by the blue clock on the left side of the following figure. Use the
timed out? indicator, represented by the red clock on the right
side of the following figure, to determine whether the Shared Variable node read new data
in the specified time period or timed out.

Specifying Whether Shared Variable Nodes Break When You Move Them to Different Targets
(Real-Time, Windows) 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 VI breaks because the node attempts to connect to the shared variable on the target on which you created the shared variable. Use absolute Shared Variable nodes when you do not expect to move VIs and variables to other targets.
A target-relative Shared Variable node always connects to the shared variable on the target that runs the VI that containing 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 because target-relative Shared Variable nodes can connect to shared variables on the local host only. Use target-relative Shared Variable nodes when you are accessing shared variables on the local host and 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 from the shortcut menu. Target-relative Shared Variable nodes appear with a.\ 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 from the shortcut menu. The following image shows an absolute Shared Variable node.