Example Code

Open Multiple Copies of a SubVI Front Panel and Update Each Individually

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 program allows you to programmatically open multiple copies of a SubVI's front panel and write date to each front panel individually

Description:
This would be useful if you want use a SubVI's front panel to display your test data, and you want the ability to show multiple pieces of the test at once.

 

Function:
The key to being able to do this is using static VI references.  The program was created by first creating our SubVI to be executed, in this case Graph.VI.  I then placed a 'Call By Reference' node, and loaded my Graph.VI as the VI to call in the node.  I then right clicked on the reference input to create a constant strict static VI reference specific to my SubVI.  I was then able to use this strict static reference to build the array of references I was going to use to keep track of the multiple SubVI instances.  With this done, I was then able to cycle through any open references, each iteration of the loop, and update their data.  Note in this case I just write random data to each and also a string, but you could pass any kind of data to these SubVIs.  Once the program has been stopped, it then cycles through and closes out all of the VI references.


Steps to implement or execute code
To implement this example:

  1. Open Main.VI
  2. Use the 'Path to Graph.VI' control to point the control to the path of the included Graph.VI
  3. Run the VI
  4. Click the New Panel? button to open a new instance of the SubVI
  5. Observe that each SubVI is receiving unique data.
  6. When done, click STOP on Main.VI

 

Requirements
Software
LabVIEW 2012 or compatible

Hardware
-

2017-11-01_15-57-26.jpg2017-11-01_15-57-26.jpg2017-11-01_15-57-38.jpg2017-11-01_15-57-38.jpg

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

Paul Davidson
National Instruments
Product Owner - ni.com Chat

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