Description
You can use the "Value outside range" instruction to query whether of the value at input VAL is outside a specific value range.
You specify the limits of the value range with the MIN and MAX inputs. The "Value outside range" instruction compares the value at input VAL with the values of the inputs MIN and MAX and sends the result to the box output. If the value at input VAL satisfies the comparison MIN > VAL or VAL >MAX, the box output has the signal state "1". The box output has the signal state "1" if a specified operand of data type REAL has an invalid value.
The box output returns the signal state "0", if the value at input VAL does not satisfy the MIN > VAL or VAL > MAX condition.
The comparison function can only execute if the values to be compared are of the same data type.
Parameters
The following table shows the parameters of the "Value outside range" instruction:
|
Parameters |
Declaration |
Data type |
Memory area |
Description |
|---|---|---|---|---|
|
MIN |
Input |
Integers, floating-point numbers |
I, Q, M, D, L or constant |
Low limit of the value range |
|
VAL |
Input |
Integers, floating-point numbers |
I, Q, M, D, L or constant |
Comparison value |
|
MAX |
Input |
Integers, floating-point numbers |
I, Q, M, D, L or constant |
High limit of the value range |
|
Box output |
Output |
BOOL |
I, Q, M, D, L |
Result of the comparison |
You can select the data type of the instruction from the "???" drop-down list of the instruction box.
For additional information on valid data types, refer to "See also".
Example
The following example shows how the instruction works:
Output "TagOut" is set when the following conditions are fulfilled:
-
The operands "TagIn_1" and "TagIn_2" have signal state "1".
-
The operand "TagIn_3" has the signal state "1".
-
The value of the operand "Tag_Value" is outside the value range that is specified by the values of the operands "Tag_Min" and "Tag_Max" (MIN > VAL or VAL > MAX).