Attention

IronPLC supports IEC 61131-3 Structured Text excluding I/O mapping.

Functions

IEC 61131-3 defines a set of standard functions available in all programming languages. Functions are stateless — they produce the same output for the same inputs every time.

Numeric Functions

Function

Description

ABS

Absolute value

SQRT

Square root

LN

Natural logarithm

LOG

Base-10 logarithm

EXP

Natural exponential

EXPT

Exponentiation

TRUNC

Truncate real to integer

Trigonometric Functions

Function

Description

SIN

Sine

COS

Cosine

TAN

Tangent

ASIN

Arc sine

ACOS

Arc cosine

ATAN

Arc tangent

Arithmetic Functions

Function

Description

ADD

Addition

SUB

Subtraction

MUL

Multiplication

DIV

Division

MOD

Modulo

Comparison Functions

Function

Description

GT

Greater than

GE

Greater than or equal

EQ

Equal

LE

Less than or equal

LT

Less than

NE

Not equal

Assignment Functions

Function

Description

MOVE

Assignment (copy value)

Selection Functions

Function

Description

SEL

Binary selection

MAX

Maximum

MIN

Minimum

LIMIT

Clamp to range

MUX

Multiplexer

Bit String Functions

Function

Description

SHL

Shift left

SHR

Shift right

ROL

Rotate left

ROR

Rotate right

String Functions

Function

Description

LEN

String length

LEFT

Left substring

RIGHT

Right substring

MID

Middle substring

CONCAT

String concatenation

INSERT

String insertion

DELETE

String deletion

REPLACE

String replacement

FIND

String search

Time and Date Functions

Function

Description

ADD_TIME

Add two durations

SUB_TIME

Subtract durations

MUL_TIME

Scale duration by number

DIV_TIME

Divide duration by number

ADD_DT_TIME

Add duration to date-and-time

ADD_TOD_TIME

Add duration to time-of-day

SUB_DT_TIME

Subtract duration from date-and-time

SUB_TOD_TIME

Subtract duration from time-of-day

SUB_DT_DT

Difference between two datetimes

SUB_DATE_DATE

Difference between two dates

SUB_TOD_TOD

Difference between two times-of-day

CONCAT_DATE_TOD

Combine date and time-of-day

DT_TO_DATE

Extract date from datetime

DT_TO_TOD

Extract time-of-day from datetime

Type Conversion Functions

Function

Description

Type conversions

Type conversion functions (*_TO_*)

BCD_TO_INT / INT_TO_BCD

BCD conversion functions