Operator ‘LIMIT’ΒΆ

This IEC selection operator is used for limiting.

OUT := LIMIT(Min, IN, Max)

Means: OUT := MIN (MAX (IN, Min), Max)

Max is the upper limit and Min is the lower limit for the result. If the IN value is above the Max upper limit, then LIMIT yields Max. If the value of IN is below the Min lower limit, then the result is Min.

Permitted data types for IN and OUT: all

Examples

Result in Var1 is 80

ST:

Var1 := LIMIT(30,90,80);