LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to limit input into a particular range?

Hello,
I am trying to input value of voltage using numeric control. I wanted to know a way to limit this input to a range.like i want inputs to be valid only between 1-10 v if user enters 11, it should not work and display an error. do i need to compare the input to a  previously defined string?
 
anyhelp will be great.
thanks a lot.
 
0 Kudos
Message 1 of 3
(11,745 Views)

There are several ways to limit the input.  You can right click the numeric control, click on properties, click on the Data Range tab, and set the min and max values.  If max is set to 10, and the user tries to type in 11, it will convert to 10.

Another way is to check the numeric value using the In Range and Coerce function found in the Comparison palette.  You can wire in a min and max value, and the numeric value.  If the numeric is within range the boolean output will be True.  If not within range, the boolean will be False and the Coerced output will be the min or max value that you specified.

A third way is to create a dialog vi that asks for user input.  In this vi you can check the value that the user types in using the In Range and Coerce function, and if not in range then you can prompt the user to try again.

- tbob

Inventor of the WORM Global
Message 2 of 3
(11,741 Views)

hey bob,

that works!!

Thanks a bunch.

0 Kudos
Message 3 of 3
(11,737 Views)