Attention

IronPLC can only run very simple programs. The steps described are accurate but many language features are not yet supported.

LIMIT

Clamps a value to a specified range.

IEC 61131-3

Section 2.5.1.5.5

Support

Supported

Signatures

#

Input (MN)

Input (IN)

Input (MX)

Return Type

Support

1

SINT

SINT

SINT

SINT

Supported

2

INT

INT

INT

INT

Supported

3

DINT

DINT

DINT

DINT

Supported

4

LINT

LINT

LINT

LINT

Supported

5

USINT

USINT

USINT

USINT

Supported

6

UINT

UINT

UINT

UINT

Supported

7

UDINT

UDINT

UDINT

UDINT

Supported

8

ULINT

ULINT

ULINT

ULINT

Supported

9

REAL

REAL

REAL

REAL

Supported

10

LREAL

LREAL

LREAL

LREAL

Supported

Description

LIMIT(MN, IN, MX) clamps IN to the range [MN, MX]. The function returns:

  • MN if IN < MN

  • MX if IN > MX

  • IN otherwise

The behavior is undefined if MN > MX.

Example

See Also

  • MAX — maximum of two values

  • MIN — minimum of two values

  • SEL — binary selection