Example Code

Multi-Functional Global Variable 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

 Overview

This example demonstrates how to create multiple Functional Global Variables and use them in an application.

 

Description

The functional global variable is a very useful tool when trying to make data globally available among multiple VIs, but can be taken further to not only store one data type, but multiple data types. Not only this, but it can also be used to perform software controlled timing within a VI. The attached Multi-FuncGlobal.vi performs all of these tasks, using the basic layout for a functional global variable, only with more cases, and more shift registers.   Additionally, to avoid over-crowding the connector pane, the Multi-Functional Global Variable uses a cluster containing an enum and a variant as its input. This way, only one connector pin is used for all inputs when setting a value, be it number or string.

 

Requirements

LabVIEW Base Development System 2012 or compatible

 

Steps to Implement or Execute Code
1- Open and Run Multi Functional Global Variable 2012 NIVerified.vi
2- Use the Operation control to select the desired action (Set String, Set Numeric, Reset Time)
3- Test the stored values by changing the Operation control to (Get String, Get Numeric, Get Elapsed Time)

 

Additional Information or References

Multi Functional Global Variable 2012 NIVerified VI Block Diagram5403.PNG

Multi-FuncGlobal VI Block Diagram

5403 - 2.PNG

 

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

Chris_G
Sr Test Engineer
Medtronic, Inc.

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

Comments
Pie56694
Active Participant
Active Participant
on

This concept in general is called the multi-functional VI, and is implemented in the LabVIEW Intermediate I course project.  The outputs of the multi-functional VI can also be variants, allowing the VI to accept and return any data type.  It's up to the caller to flatten the return to the correct representation.