Example Code

Disable Device If Signal Not In Valid Range 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 VI shows how to disable the control signal to a device if a measurement from the device falls outside of a user-specified range.


Description
This VI takes a device control signal (a boolean) and a numeric value. The VI compares the numeric value against a user-defined range. If the value falls within the range, the VI outputs the current value of the device control signal. If the value falls outside of the range, the VI outputs a false value for the device control signal. By default, the lower limit of the threshold is included in the range, while the upper limit is excluded. 
Requirements

  • LabVIEW 2012 (or compatible)
  • Some device to be controlled (no specific hardware required)


Steps to Implement or Execute Code

  1. Set the upper and lower limits of the threshold for the numeric signal to be compared to.
  2. Set the upper and lower limits of the threshold for the numeric signal to be compared to.
  3. Click Run

Additional Information or References

NOTE: If the user wants the comparison happen continuously, the user should place this code within a loop.
VI Block Diagram

 5-315.png

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

 

 

Ryan K.
Product Manager, ATCA and BEEcube
National Instruments

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