Example Code

Open Multiple Instances of a Reentrant VI to Run Independently

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

Overview

This example illustrates how to open and run multiple instances of a reentrant VI and have the VIs run independently.

 

Description

With Open VI Reference Function and Invoke Node, this example illustrates how to open and run multiple instances of a reentrant VI and have the VIs run independently.

 

Requirements 

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

In order for this example to function correctly, the target VI needs to be reentrant. This can be done by performing the following steps:

1.) Go to File»VI Properties.

2.) Select the Execution category.

3.) Check the "Reentrant execution" check box.

 

Then open and run the "Open Multiple VI Instances" VI

  1. Specify the path to the target VI that you want to reference(Use test.vi as default).
  2. Run the "Open Multiple VI Instances" VI

 

Additional Information or References

This example will not close the target VIs after completion. Also, sometimes the target VI will not run unless a sufficient Wait is placed in the For Loop (that is the reason for the 1000ms Wait).

 

VI Snippet

1.png

 

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

 

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

Comments
Member
Member
on

Simple test launch that I know works. A simple program that checks its characteristics, name and the like, then closes, after a time out. As near as I can make it, the program does not start, the default values in the variables are sort of hilter skilter, and the state query says it is running, but it lies.

Don't see any programmatic way to be sure the launch worked before closing the ref. Any clue what LV is doing when it drops the ball?