Basic instructions
8.5 Math functions
S7-1200 Programmable controller
262 System Manual, V4.2, 09/2016, A5E02486680-AK
Table 8- 62 LIMIT (set limit value) instruction
IN:=_variant_in_,
MX:=_variant_in_,
OUT:=_variant_out_);
The Limit instruction tests if the value of parameter IN is inside the
value range specified by parameters MIN and MAX and if not,
clamps the value at MIN or MAX.
1
For LAD and FBD: Click the "???" and select a data type from the drop-down menu.
Table 8- 63 Data types for the parameters
MN, IN, and MX SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal, Time, Date,
Math operation inputs
OUT SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal, Time, Date,
Math operation output
1
The MN, IN, MX, and OUT parameters must be the same data type.
If the value of parameter IN is within the specified range, then the value of IN is stored in
parameter OUT. If the value of parameter IN is outside of the specified range, then the OUT
value is the value of parameter MIN (if the IN value is less than the MIN value) or the value
of parameter MAX (if the IN value is greater than the MAX value).
Table 8- 64 ENO status
Real: If one or more of the values for MIN, IN and MAX is NaN (Not a Number), then NaN is returned.
If MIN is greater than MAX, the value IN is assigned to OUT.
SCL examples:
● MyVal := LIMIT(MN:=10,IN:=53, MX:=40); //Result: MyVal = 40
● MyVal := LIMIT(MN:=10,IN:=37, MX:=40); //Result: MyVal = 37
● MyVal := LIMIT(MN:=10,IN:=8, MX:=40); //Result: MyVal = 10