3 structured text (st), 1 expressions, 2 evaluating expressions – Lenze DDS v2.3 User Manual

Page 42: Expressions, Evaluating expressions, Drive plc developer studio, Programming languages

Advertising
background image

Drive PLC Developer Studio

Programming languages

4-4

l

DDS EN 2.3

4.3

Structured text (ST)

Structured text consists of a series of instructions that can be executed as conditioned in very
high-level languages ( IF..THEN..ELSE)or in loops (WHILE..DO). An instruction is completed with
a semicolon;.

Example:

IF

value < 7 THEN

WHILE

value < 8 DO

value := value + 1;

END

_WHILE;

END

_IF;

4.3.1

Expressions

An expression returns a value on evaluation and consists of operators and operands.

An operand can be

a constant,

a variable,

a function call

or another expression.

4.3.2

Evaluating expressions

Expressions are evaluated by processing operators following certain priorities. Operators with the
highest priority are processed first followed by operators with the second highest priority and so on,
until all operators are processed. Same-priority operators are processed from left to right.

The following table lists ST operators in the order of their priority.

Operation

Symbol

Priority (ranking)

Parentheses

(Expression)

Highest priority

Function call

Function name (parameter list)

Exponentiation

EXPT

Negation

-

Complementation

NOT

Multiplication

*

Division

/

Modulo

MOD

Addition

+

Subtraction

-

Compare

<, >, <=, >=

Equal to

=

Not equal to

<>

Bool AND

AND

Bool XOR

XOR

Bool OR

OR

Lowest priority

Show/Hide Bookmarks

Advertising