Description
You can use the "Set limit value" instruction to limit the value at input IN to the values at the inputs MN and MX. If the value at the IN input meets the condition MN <= IN <= MX, it is copied to the OUT output. If the condition is not fulfilled and the input value IN is below the low limit MN, output OUT is set to the value of the input MN. If the high limit MX is exceeded, output OUT is set to the value of the input MX.
If the value at the MN input is greater than at the MX input, the result is the value specified at the IN parameter and the enable output ENO is "0".
The enable output ENO has the signal state "0" if one of the following conditions applies:
-
Enable input EN has the signal state "0".
-
The specified tags are not of the same data type.
-
An operand has an invalid value.
-
The value at the MN input is greater than the value at the MX input.
Parameters
The following table shows the parameters of the "Set limit value" instruction:
|
Parameters |
Declaration |
Data type |
Memory area |
Description |
||
|---|---|---|---|---|---|---|
|
S7-1200 |
S7-1500 |
S7-1200 |
S7-1500 |
|||
|
EN |
Input |
BOOL |
BOOL |
I, Q, M, D, L or constant |
I, Q, M, D, L, T, C or constant |
Enable input |
|
ENO |
Output |
BOOL |
BOOL |
I, Q, M, D, L |
I, Q, M, D, L |
Enable output |
|
MN |
Input |
Integers, floating-point numbers, TIME, TOD, DATE, DTL, DT |
Integers, floating-point numbers, TIME, LTIME, TOD, LTOD, DATE, LDT, DTL, DT |
I, Q, M, D, L, P or constant |
I, Q, M, D, L, P or constant |
Low limit |
|
IN |
Input |
Integers, floating-point numbers, TIME, TOD, DATE, DTL, DT |
Integers, floating-point numbers, TIME, LTIME, TOD, LTOD, DATE, LDT, DTL, DT |
I, Q, M, D, L, P or constant |
I, Q, M, D, L, P or constant |
Input value |
|
MX |
Input |
Integers, floating-point numbers, TIME, TOD, DATE, DTL, DT |
Integers, floating-point numbers, TIME, LTIME, TOD, LTOD, DATE, LDT, DTL, DT |
I, Q, M, D, L, P or constant |
I, Q, M, D, L, P or constant |
High limit |
|
OUT |
Output |
Integers, floating-point numbers, TIME, TOD, DATE, DTL, DT |
Integers, floating-point numbers, TIME, LTIME, TOD, LTOD, DATE, LDT, DTL, DT |
I, Q, M, D, L, P |
I, Q, M, D, L, P |
Result |
|
The data types TOD, LTOD, DATE, and LDT can only be used if the IEC test is not enabled. |
||||||
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:
The following table shows how the instruction works using concrete operand values:
|
Parameters |
Operand |
Value |
|---|---|---|
|
MN |
Tag_MN |
12000 |
|
IN |
Tag_Value |
8000 |
|
MX |
Tag_MX |
16000 |
|
OUT |
Tag_Result |
12000 |
If the operands "TagIn_1" and "TagIn_2" have signal state "1", the instruction is executed. The value of operand "Tag_Value" is compared with the values of operands "Tag_MN" and "Tag_MX". Since the value of the operand "Tag_Value" is less than the low limit, the value of the operand "Tag_MN" is copied to the "Tag_Result" output. If the instruction is executed without errors, the "TagOut" output is set.