From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Denver - ALARM

Showing results for 
Search instead for 
Did you mean: 

LabVIEW 2009 Shared Variable Examples

This document contains a number of examples highlighting the use of the shared variable in LabVIEW 2009, focusing on more advanced uses of the feature. More examples will be added over time.

Dynamic Creation and Deployment of Shared Variables

SV Dynamic

There are a couple of methods to dynamically create and deploy shared variables in LabVIEW code. This example shows how to use VI server methods and the DSC process/variable API for this purpose.

VI Server Methods

This solution can be used in VIs running in the Windows development environment to create new variables as it uses the project object in VI server. This methods does not work in a compiled executable (i.e. is not supported in the LV run-time engine) and alos does not work in a VI deployed to an RT target.

The Application Library.Deploy Library method, which is used to deploy a shared variable library and its contents to a Windows or RT target, can be used in a compiled Windows executable. This method is not supported in a LV RT VI.

DSC Process/Variable API

This API and example requires the LabVIEW DSC module. If you want to use this methodology to create variables in a compiled executable you must select the Enable Enhanced DSC Run-Time support option in the Application Builder build specification.


Information from the LabVIEW Manual:

Enable Enhanced DSC Run-Time support—This option only appears if you have the LabVIEW Datalogging and Supervisory Control (DSC) Module installed. Builds the application with the enhanced DSC Module Run-Time Engine. The DSC Module Run-Time Engine adds additional support for programmatic project library and shared variable management in applications that you build with the DSC Module. You must place a checkmark in this checkbox in the following situations:

  • The application you want to build uses VI Server references to modify a library file programmatically.
  • The application you want to build uses the Save to Library VI.

If you do not enable the enhanced DSC Module Run-Time Engine in these two situations, LabVIEW returns error code 1055 when you run the built application, shared library, or .NET interop assembly.

Note:  Enabling this option increases the file size and reduces the start-up performance of the built application, shared library, or .NET interop assembly.

Browsing of Shared Variables on the Network

SV PSP  - requires AMC reference library

This example shows how to use LabVIEW VI server methods to browse and retrieve a list of shared variables and other tags available through PSP on the local network. PSP (Publish and Subscribe Protocol) is used to remotely access shared variables as well as tags in an I/O server as well as network-shared I/O variables in the Scan Engine.

Through a reference to the local PSP/Shared Variable Engine the VI Server methods provide access to a list of PSP engines forund on the local subnet and for each of these a list of all the variables published through PSP. The example uses the Asynchronous Message Communication (AMC) library available on Developer Zone.

The PSP Browser subVI (SV Select Network Shared can be used to interactively select a list of PSP tags from the local subnet for use in a VI or application.

A simple reader (SV Read Network is included that can read and chart a list of numeric tags/variables.


authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX

Download All
0 Kudos
Message 1 of 1