Example Code

Ensure Only One Switch of Array Control is On at a Time

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

Use an event structure to control that only one element of boolean is on at any given time.

 

Description

The attached code uses an event structure to monitor an array of boolean switches for value changes. Whenever a value change is detected, the event structure executes a case to reset the switch that was previously "on" to "off", so only one switch will be "on" at any point in time.

Note that this does not take an initial "all off" state into consideration.

 

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code
1. Run the VI.
2. Switch the boolean controls, and notice that only one is On.
3. Stop the VI.

 

Additional Information or References

Capture.PNG

Will
CLA, CLED, CTD, CPI
LabVIEW Champion
Choose Movement Consulting
choose-mc.com

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