Verify a Value Is Within a Given Range in LabVIEW

Updated Aug 21, 2023

Environment

Software

  • LabVIEW

I want to check that a numeric value is within range of two given numbers. Using the Comparison Functions, how should I do this?

The steps listed below detail how to accomplish this using Comparison Functions in LabVIEW:

Note: If you do not want to use the Comparison Functions, try using the Comparison Express VI. It's Compare Condition Parameter allows you to check if a value is within range of a provided minimum and maximum value.​​​​​
 
  1. Place the Less Or Equal? Function and the Greater Or Equal? Function on the Block Diagram
  2. Right-click on the x input terminal of the Less Or Equal? Function and select Create»Control. Then also wire this same numeric into the x input terminal of the Greater Or Equal? Function. This control will be used as the numeric value you are verifying is within the given range.
  3. Right-click on the y input terminal of the Less Or Equal? Function and select Create»Control. This control will be used as the maximum value of the range.
  4. Right-click on the y input terminal of the Greater Or Equal? Function and select Create»Control. This control will be used as the minimum value of the range.
  5. Place the And Function on the Block Diagram. Wire the output terminals of the Less Or Equal? and Greater Or Equal? Functions to the and y input terminals of the And Function.
  6. Then right-click on the output terminal of the And Function and select Create»Indicator. This will place a Boolean LED on the Front Panel that with indicate if the numeric value is within the given maximum and minimum of the range. If the LED turns on, the value is within range. If the LED turns off, the value is not within range.
  7. An example of the end result using these steps is shown below: