REPEAT statement

This section is about REPEAT statement syntax and examples.
IMPORTANT: Input variables are not refreshed during REPEAT iterations. The state change of an input variable cannot be used to describe the ending condition of a REPEAT statement. Using an input variable in this manner might cause unexpected controller behavior.
Properties of REPEAT statement
Item
Description
Name
REPEAT ... UNTIL ... END_REPEAT
Meaning
Iteration structure for a group of ST statements.
The "continue" condition is evaluated after any iteration.
Syntax
REPEAT <statement> ; <statement> ; ... UNTIL <Boolean_condition> END_REPEAT ;

Example

(* ST program using REPEAT statement *) (* this program uses specific "C" functions to read characters *) (* on a serial port *) str := ''; (* empty string *) nbchar := 0; IF ComIsReady ( ) THEN REPEAT str := str + ComGetChar ( ); nbchar := nbchar + 1; UNTIL ( (nbchar >= 16) OR NOT (ComIsReady ( )) ) END_REPEAT; END_IF;
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal