Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Writing Shared Variables with Existing Data Sources

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

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.
  • 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.

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:
    • Select Project Variable to bind the shared variable to an NI-PSP data item in the current project.
    • Select PSP URL to bind the shared variable to an NI-PSP data item on the network.
      Note  If the data item is on a computer that is not on the local subnet, you must select Tools»Shared Variable»Register Computer to register that computer. After you specify the computer name or the IP address of the computer, you can bind shared variables to data sources on that computer.
    • Select I/O Variable to bind the shared variable to a data item on an I/O server, such as an OPC server.
  4. Select the data source to which you want to bind the shared variable using one of the following methods:
    • Click the Browse button to browse for the data source with the Browse for Variable dialog box.
    • Enter the network path of the data source in the Path text box.
  5. Click the OK button.

 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit