Example Code

Multiple Data Type Queue using 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

Overview
This example shows how to send different data types using a single queue by using a variant data type.

 
Description
This application allows the user to send multiple different data types using a single queue. It works through converting the data to a variant data type in the producer loop and combining this with an enum to specify the data type being stored in the queue. In the consumer loop the enum specifies the case in the case structure where a Variant to Data function is used to convert the data back to its relevant data type. The following screenshot is the front panel of this application showing that you can enqueue a number, string or boolean into the queue.


Requirements

  • LabVIEW Base Development System 2012 (or compatible)


Steps to Implement or Execute Code

  1. Unzip the attached folder “Multiple Data Type Queue 2012 NIVerified.zip”
  2. Open the VI "Multiple Data Type Queue 2012 NIVerified.vi"
  3. Run the VI

 

Additional Information or References
VI Block Diagram

 block.png

 

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


Larry Colvin
Associate Principal Engineer
Dyson Technology Ltd.

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