Showing results for 
Search instead for 
Did you mean: 

Is there an "Out of Range" Function in LabVIEW?



My issue is I have an input value that is compared to an upper and lower limit. If the input is within the range I want the program to do nothing. If the input is below the lower value I need to send a "TRUE" signal to a relay. If the input is above the upper value I need to send a "FALSE" signal to the relay. Does anyone have a clever way of getting this to work?

Attached is a example of what I'm trying to do for your veiwing pleasure.



0 Kudos
Message 1 of 10

Look in the comparison pallete.  There is an out of range function.

Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 10

There is an In Range and Coerce vi that lets you specify upper/lower limits and data and then tells you whether your data is within the limits, and will coerce the data so that it fits within the limits if you need it.


It is on the comparison pallete.

0 Kudos
Message 3 of 10

Hi JoeR_87,

I think this could work for you


0 Kudos
Message 4 of 10

I would just use a couple of Select functions with the results being based on the comparison to the upper limit and lower limit.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 10

Your description is not really complete as you don't really say anything about what should happen if the value gets back into range after being either outside of the range nor if you want to happen to set the relay repeatedly if the value stays outside the range. Usually it is not necessary to keep setting a relay to a specific state once it has been set.


I would probably do something along these lines:



This will set the relay whenever there is an out of range situation AND the last state the relay was set to is different than what it should be now.

Rolf Kalbermatter
My Blog
Message 6 of 10

What do you have in the "TRUE" cases?

0 Kudos
Message 7 of 10

If the question is for me, I attached to you the VI

0 Kudos
Message 8 of 10

This code is to charge/discharge a battery in my system. So when the voltage drops below the lower limit the relay state should become "TRUE" which starts charging the battery. The state of the relay needs to remain "TRUE" until voltage exceeds the upper limit, at which point the relay state becomes "FALSE" which allows me to draw power from my battery again.

0 Kudos
Message 9 of 10

It's a snippet and should be possible to just pull on your desktop and from there onto a LabVIEW diagram.


Inside the true case I simply wire a TRUE constant to the output that defines if the next case structure acuating the relay should execute and the lower limit boolean straight through. It allows to intialize the system on first run, so that the shift register and relay are in a defined state to begin with.

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 10