ST language commands

The ST language commands are ending by a semicolon. The EOL character is treated in the same way as the space character.

CommandDescription Example
:= Assignment.
The value calculated on the right is assigned to the identifier on the left.
A := B; C := SIN(X); My_FB(p1 := 10, p2 := 20);
Assignment.
Value of the variable declared on the left is assigned to the identifier on the right.
FB1(out1 => my_var);
REF= Reference.
Variable on the left is filled with reference to the value on the right.
MyVar := 100; MyRef REF= MyVar; MyRef := 200;
IF Selection command.
If the BOOLean condition is met the associated command is executed.
IF A > 10 THEN
    B := 1;
ELSE
    B := 2;
END_IF;
CASE Selection command.
Execution of a block of commands if the CASE condition is met.
CASE TW OF
    1,5: DISPLAY := OVEN_TEMP;
    2: DISPLAY := MOTOR_SPEED;
    ELSE DISPLAY := STATUS;
END_CASE;
FOR Iterative command.
A loop of block of commands with an initial value, end condition, and increment value.
FOR I := 0 TO 10 BY 2 DO
    J := J + 3;
END_FOR;
WHILE Iterative command.
A loop of block of commands with condition for exiting the loop at the beginning.
WHILE J < 10 DO
    J := J + 2;
END_WHILE;
REPEAT Iterative command.
A loop of block of commands with condition for exiting the loop at the end.
REPEAT
    J := J + 2;
UNTIL J > 10;
EXIT Exiting the loop.
Premature exiting of the command loop.
EXIT;
RETURN Return.
Leaving of the currently executed block.
RETURN;
  • © Energocentrum Plus, s.r.o. 2017 - 2024