Statement Types - GE PACSystems RX7i Cpu Programmer's Reference Manual

Hide thumbs Also See for PACSystems RX7i:
Table of Contents

Advertisement

Chapter 8. Structured Text (ST) Programming

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.
Statement Type
Description
Assignment
Sets an object to a specified value.
CASE
Provides for the conditional execution of a set of
statements.
COMMENT
Places a text explanation in the program. Ignored by
the ST compiler.
Function call
Calls a function for execution.
RETURN
Causes the program to return from a subroutine.
The return statement provides an early exit from a
block.
EXIT
Terminates iterations before the terminal condition
becomes TRUE (1).
IF
Specifies that one or more statements be executed
conditionally.
Executes a statement sequence repeatedly based
FOR ... DO
on the value of a control symbol.
WHILE
Indicates that a statement sequence be executed
repeatedly until a Boolean expression evaluates to
FALSE (0).
REPEAT
Indicates that a statement sequence be executed
repeatedly until a Boolean expression evaluates to
TRUE (1).
ARG_PRESENT
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).
Empty Statement
368
PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual
Example
A := 1; B := A; C := A + B;
CASE A OF
1,2 : C := 3;
3: C := 4;
4..5: C := 5;
ELSE
C := 0;
END_CASE;
(* This is a block comment *)
' This is a line comment
// This is a line comment //
FbInst(IN1 := 1, OUT1 => A);
RETURN;
EXIT;
IF (A < B) THEN
C := 4;
ELSIF (A = B) THEN
C:= 5;
ELSE
C := 6
END_IF;
FOR I := 1 TO 100 BY 2 DO
IF (Var1 – I) = 40 THEN
Key := I;
EXIT;
END_IF;
END_FOR;
WHILE J <= 100 DO
J := J + 2;
END_WHILE;
REPEAT
J := J + 2;
UNTIL J >= 100
END_REPEAT;
ARG_PRES (IN :=In1, Q:>Out1,
ENO:>Out2);
;
GFK-2950C

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pacsystems rx3iPacsystems rsti-ep

Table of Contents