Example Code

Event-Driven SubVI Control

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
To allow opening subVI front panel, running it then close and stop it with the same button

Description:
This example code allows you to open a subVI's front panel and run it at the touch of a button and then close and stop the subVI with the same button. It is done using the Producer/Consumer architecture and VI Server. The Producer/Consumer architecture ensures that we capture all of the events happening to the front panel, which the VI Server allows us to programmatically control the subVI.  

Steps to implement or execute code
To implement this example:

  1. Use the SubVI path to specify the location of the subVI.
  2. Click the run arrow
  3. Click the RUN SUBVI button to bring up the front panel of the subVI and run it
  4. Click the RUN SUBVI button again to close the front panel of the subVI and stop running it
  5. Repeat steps 3 and 4 as necessary
  6. Click the STOP button to stop execution

To execute this example:

  1. Install the required software.
  2. Open the VI and refer the Implement Steps


Requirements
Software
LabVIEW 2012 or compatible

Hardware
-

 

bd.PNGfp.PNG

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

National Instruments
Senior Systems Engineer

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