LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Obtein a value inside a range (Coerced) ?

Solved!
Go to solution

hello to everyone.

 

First of all thanks a lot for reading this post and helping me:

 

What I would like to do is the next.

 

I have a control and an upper limit and a lower limit.

 

If the control is between upper and lower limit, out has to be the same value than control.

 

If the control is higher than upper limit, then the out has to be the upper limit.

If the control is less than lower limit, then the out has to be the lower limit.

 

Is there any vi which do that?

 

I am trying to use "in range and coerce VI" but it does not wark how I want.

 

because for example is I put:

-upper limit = 512

-Lower limit = 36

-Control=300

 

Then the output is 36....

 

Any help??

 

thanks a lot

0 Kudos
Message 1 of 9
(4,129 Views)

-removed-- failed in my reading abilities


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 2 of 9
(4,120 Views)

What?

0 Kudos
Message 3 of 9
(4,113 Views)

it works for me ... don't know what you are doing wrong

range-coerce-snippet.png


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 4 of 9
(4,110 Views)

as a suggestion for next time .. it helps very much if you post your code that troubles you, either as snippet or as vi


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 5 of 9
(4,105 Views)

Hello,

 

The VI you mentioned works fine for me. Try tempering with its settings (right click).

If it doesn't work just implement the logic using embedded case structures.

 

Regards,

Adam

0 Kudos
Message 6 of 9
(4,102 Views)

It should work fine for you!

Please specify the Version of LabVIEW you are using and also share the code which you are using.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 7 of 9
(4,072 Views)
Solution
Accepted by topic author A.Salcedo

@A.Salcedo wrote:

If the control is higher than upper limit, then the out has to be the upper limit.

If the control is less than lower limit, then the out has to be the lower limit.

 

because for example is I put:

-upper limit = 512

-Lower limit = 36

-Control=300

 

Then the output is 36....

 


In this case, you're seeing an output of 36?  If so, you've wired things up wrong and you should post what you've done so we can help.  If you're saying you WANT the output of 36, that doesn't match what you said above.  You likely have the upper and lower limits wired in backwards and that's causing the issue you're running into.

 

Additionally, you can right-click the control to find its properties.  In the properties, you can set high and low limits and have the control coerce into that range so that the user will see the value being coerced.  That way, if they type in 600 and the program uses 512 as the answer, they can SEE this taking place rather than have it happen on the block diagram where they're clueless to the change.

0 Kudos
Message 8 of 9
(4,068 Views)

Thanks a lot to everyone for the information.

 

I have just solved with control properties.

 

 

0 Kudos
Message 9 of 9
(4,025 Views)