Example Code

Start VIs from Main Application Using Producer/Consumer Event Template in LabVIEW

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 VI uses the Event based Producer Consumer architecture to open and run two VIs by reference. Using this structure you can create a flexible framework that can be used to call other VI's.

 

Description

The producer consumer design pattern uses queues to communicate data between loops, offering the advantage of data buffering between producer and consumer loops. 

 

The two VIs are called by their path using an invoke node with the 'Run VI' method. The VI called will run once only unless it is in a loop. Additionally it uses the current values of all front panel controls for execution rather than using data passed in through parameters. 

 

Choosing 'False' for 'Wait until Done' means that the user can launch the other VI without having to wait for the first VI to finish running.

 

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Save VI to your computer and open it.
  2. Enter in a path for the VI's you want to run.
  3. Run the main VI.
  4. Click 'VI A' and 'VI B' buttons to launch the Front Panel of the respective VIs and run them once.

  

Additional Information or References

 

Block Diagram of the VI

Run VI Producer Consumer 2012 NIVerified Block Diagram.png

 

Front Panel of the VI

front panel.PNG

 

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

LabVIEW Help: Run VI Method

Application Design Patterns: Producer/Consumer

 

**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
ctailor
Member
Member
on

Could you please post labview 8.5Version?