Attention

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

Structured Text

Structured Text (ST) is a high-level textual programming language defined by IEC 61131-3. It resembles Pascal and provides statements for assignment, selection, iteration, and function invocation.

IEC 61131-3

Section 3.3

Statements

Statement

Description

Assignment

Assign a value to a variable

Bit Access

Access a single bit of an integer or bit-string variable

IF

Conditional branching

CASE

Multi-way selection by integer value

FOR

Counted loop

WHILE

Pre-tested loop

REPEAT

Post-tested loop

EXIT

Break from innermost loop

RETURN

Early exit from POU

Operators

Category

Description

Arithmetic Operators

Addition, subtraction, multiplication, division, modulo, power

Comparison Operators

Equality, inequality, less than, greater than

Logical Operators

AND, OR, XOR, NOT

Function Calls

Topic

Description

Function Call

Calling functions and function block instances

Operator Precedence

Operators are listed from highest to lowest precedence.

Rank

Operator

Description

1

( )

Parenthesized expression

2

Function calls

Function and function block invocation

3

-, NOT

Negation, boolean complement

4

**

Exponentiation

5

*, /, MOD

Multiply, divide, modulo

6

+, -

Add, subtract

7

<, >, <=, >=

Comparison

8

=, <>

Equality, inequality

9

AND, &

Boolean AND

10

XOR

Boolean exclusive OR

11

OR

Boolean OR