EasyManua.ls Logo

GE PACSystems RX7i

GE PACSystems RX7i
469 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 8. Structured Text (ST) Programming
380 PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual GFK-2950C
8.2.8 REPEAT Statement
The REPEAT loop repeatedly executes (iterates) a statement list contained within the
REPEAT…END_REPEAT construct until an exit condition is satisfied. It executes the statement list
first, then checks for the exit condition. This looping construct is useful when the statement list
needs to be executed at least once.
Format
REPEAT
StatementList;
UNTIL BooleanExpression END_REPEAT;
Where:
BooleanExpression Any expression that resolves to a Boolean value.
StatementList Any set of Structured Text statements.
Operation
The StatementList is executed. If the BooleanExpression is FALSE (0), then the loop is repeated;
otherwise, if the BooleanExpression is TRUE (1), the loop is exited. The statement list executes at
least once, since the BooleanExpression is evaluated at the end of the loop.
Note: It is possible to create an infinite loop that will cause the watchdog timer to expire. Avoid
infinite loops.
Example
The following code fragment reads values from an array until a value greater than 5 is found (or the
upper bound of the array is reached). Since at least one array value must be read, the REPEAT loop is
used. All variables in this example are of type DINT, UINT, or INT.
Index :=1;
REPEAT
Value:= @Index;
Index:=Index+1;
UNTIL Value > 5 OR Index >= UpperBound END_REPEAT;

Table of Contents

Other manuals for GE PACSystems RX7i

Related product manuals