Example Code

Using Notifiers to Pass Data to Spawned VIs

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

Coding that exemplifies how to use notifiers to pass data to SubVIs.

 

Description

This code shows the use of Notifiers to pass data to spawned VIs. This can also be used within the same VI. Since Notifiers tends to loose data, this is best used as a way of passing only the most up-to-date information to the consumers.

 

Requirements

LabVIEW 2012 (or compatible)

 

Implementation

 Producer:

  1. Create a Notifier using the String constant name.
  2. Spawn three consumer VIs that will use the Notifier to receive data.
  3. Write sine wave data to the Notifier using the Send Notification.vi.
  4. Release the Notifier to stop the other VIs and check for errors.

 Consumer:

  1. Obtain the Notifier using the name passed into this VI.
  2. Read the next notification and write it to the chart.
  3. Stop the VI at an error, which should be generated when the producer VI stops.

Additional Information or References

 Producer:

Notifier Producer Screenshot.PNG

 Consumer:

Notifier Consumer.PNG

Jared S.
Applications Engineering
National Instruments

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