Comparison instructions
112
Part II IEC Instructions
WITHIN_LIMITS
Evaluate if a value is within the limits
PLC types see see page 1333
Variable
Data type
Function
MN Minimum limit
IN Value compared to the limits
MX
ANY_SIMPLE
Maximum limit
Output variable
BOOL
TRUE if the input value at IN falls within the lower and upper limits
Description
This instruction evaluates whether the value at the input IN is within the limits set at minimum (MN)
and maximum MX.
Data types
Example
In this example the function has been programmed in ladder diagram (LD) and structured text
(ST).The same POU header is used for all programming languages.
POU header
All input and output variables used for programming this function have been declared in the POU
header.
LD
ST
bResult := WITHIN_LIMITS(MN := iMinValue, IN := iValidateValue, MX :=
iMaxValue);