Example Code

Send Control Values to Dynamically Called VI

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

Overview

This example demonstrates how to set and get values from controls and indicators of a dynamically called VI.

 

Description

LabVIEW can link to subVIs by two different methods:

  • Static
  • Dynamic

Statically linked subVIs are the normal subVIs that are dropped on the block diagram of the main VI. A statically linked subVI is loaded into memory at the same time the main VI is loaded.

With dynamic linking, subVIs are not loaded until specifically instructed by the code of the main VI. This enables the programmer to create applications which can exchange parts of the application during run-time.

This example shows one way to exchange data between the caller and the callee. To do so, the property node Set Control Value and Get Control Value is used.

 

Requirements

 Software

  • LabVIEW Base Development System 2012 (or compatible)
  • If running in a Real-Time context, you will need the LabVIEW Real-Time Module 2012 (or compatible)

 Hardware

  • No hardware is necessary to use this example VI

 

Steps to Implement or Execute Code

  1. Download and open the attached ZIP-file
  2. Open and run the [Main] ...VI

 

Additional Information or References

Transfer Values To And From A Dynamically Called VI - Front Panel.png

 

Transfer Values To And From A Dynamically Called VI - Block Diagram.png

 

Note: This example shows one possible way to transfer data to and from a dynamically called VI.
Depending on your application, there are many other ways to accomplish the same functionality with less effort.
Take a look into this documents:

Differences Between Calling a VI with an Invoke Node and Calling a VI with a Call by Reference Node

Asynchronously Calling a VI without Collecting the Results - LabVIEW Help

 

**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text ‘NIVerified’. Read here for more information about the new Example Guidelines and Community Platform.**

Regards,

Jon S.
National Instruments
LabVIEW NXG Product Owner

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.