Chapter 8. Structured Text (ST) Programming
368 PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual GFK-2950C
8.2 Statement Types
The Structured Text statements, which specify the actual program execution, consist of the following
types, which are described in more detail on the following pages.
Sets an object to a specified value.
A := 1; B := A; C := A + B;
Provides for the conditional execution of a set of
statements.
CASE A OF
1,2 : C := 3;
3: C := 4;
4..5: C := 5;
ELSE
C := 0;
END_CASE;
Places a text explanation in the program. Ignored by
the ST compiler.
(* This is a block comment *)
‘ This is a line comment
// This is a line comment //
Calls a function for execution.
FbInst(IN1 := 1, OUT1 => A);
Causes the program to return from a subroutine.
The return statement provides an early exit from a
block.
Terminates iterations before the terminal condition
becomes TRUE (1).
Specifies that one or more statements be executed
conditionally.
IF (A < B) THEN
C := 4;
ELSIF (A = B) THEN
C:= 5;
ELSE
C := 6
END_IF;
Executes a statement sequence repeatedly based
on the value of a control symbol.
FOR I := 1 TO 100 BY 2 DO
IF (Var1 – I) = 40 THEN
Key := I;
EXIT;
END_IF;
END_FOR;
Indicates that a statement sequence be executed
repeatedly until a Boolean expression evaluates to
FALSE (0).
WHILE J <= 100 DO
J := J + 2;
END_WHILE;
Indicates that a statement sequence be executed
repeatedly until a Boolean expression evaluates to
TRUE (1).
REPEAT
J := J + 2;
UNTIL J >= 100
END_REPEAT;
Determines whether a parameter value was
present when the function block instance of the
parameter was invoked. For example, a parameter
can be optional (pass by value).
ARG_PRES (IN :=In1, Q:>Out1,
ENO:>Out2);