LIMIT

The IEC selection operator is used for limitation.

Syntax: OUT := LIMIT(Min, IN, Max)

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

Max is the upper bound, Min is the lower bound for the result. If the value IN exceeds the upper bound Max, LIMIT returns Max. If IN falls below Min, the result is Min.

Permitted data types for IN and OUT: all

Examples:

Result: nVar is 80.

ST:

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

FBD:

LIMIT 1: