Writing Shared Variables with Existing Data Sources

When you bind a shared variable to an existing data source, the shared variable receives the same updates as that data source. Possible data sources for shared variables include DAQ channels; NI Publish-Subscribe Protocol (NI-PSP) data items, such as other shared variables; and data items from I/O servers that are defined in a separate project.

Note��
  • You can bind only network-published shared variables.
  • You can bind shared variables only to data items that are currently deployed.
  • 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.

Bind a shared variable to an existing data source if you need to leverage shared variable features for a data source that does not support those features. For example, assume that you need to set logging and alarming properties for a shared variable on a CompactRIO target. Because real-time targets do not support logging and alarming, you must create a new shared variable on your development computer, bind that shared variable to the shared variable on the CompactRIO target, and configure the shared variable on the development computer for logging and alarming. When the shared variable on the CompactRIO target sends new data to the Shared Variable Engine (SVE), the SVE updates the value of the shared variable on your development computer, and that shared variable performs the logging and alarming tasks.

Note��When you bind a shared variable to an existing data source across a network, LabVIEW does not track configuration changes to the data source. Therefore, in the example above, if you change the name of the variable on the CompactRIO target, you also must update the configuration of the shared variable on your development computer, or that shared variable breaks.

Complete the following steps to bind a shared variable to an existing data source.

  1. Create a shared variable or right-click a shared variable in the Project Explorer window and select Properties from the shortcut menu to display the Shared Variable Properties dialog box.
  2. Place a checkmark in the Enable Aliasing checkbox.
  3. Choose from the following options in the Bind to pull-down menu:
  4. Select the data source to which you want to bind the shared variable using one of the following methods:
  5. Click the OK button.

Data Communication Methods Home