Appendix C
Structured Text Programming
WHILE...DO
WHILE bool_expression DO
<statement>;
END_WHILE;
Description:
Optional
690
Use the WHILE...DO loop to keep doing something as long as certain
conditions are true.
Operands:
Structured Text
Operand
Bool_
expression
IMPORTANT
The syntax is described in the table.
WHILE bool_expression1 DO
<statement>;
IF bool_expression2 THEN
EXIT;
END_IF;
END_WHILE;
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Type
Format
BOOL
Tag
expression
Make sure that you do not iterate within the loop
too many times in a single scan.
•
The controller does not execute any other statements
in the routine until it completes the loop.
•
If the time that it takes to complete the loop is
greater than the watchdog timer for the task, amajor
fault occurs.
•
Consider using a different construct, such as
IF...THEN.
Enter
BOOL tag or expression that evaluates to a
BOOL value
Statements to execute while bool_expression1
is true
If there are conditions when you want to exit
the loop early, use other statements, such as an
IF...THEN construct, to condition an EXIT
statement.