EasyManuals Logo
Home>Allen-Bradley>Controller>Logix5000

Allen-Bradley Logix5000 Reference Manual

Allen-Bradley Logix5000
708 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
Page #691 background imageLoading...
Page #691 background image
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011 691
Structured Text Programming Appendix C
The following diagrams show how a WHILE...DO loop executes and how an
EXIT statement leaves the loop early.
Arithmetic Status Flags: Not affected
Fault Conditions:
Example 1:
While the bool_expression is true, the controller
executes only the statements within the WHILE…DO
loop.
To stop the loop before the conditions are true, use an EXIT
statement.
Statement 1
Statement 2
Statement 3
Statement 4
…
Exit ?
BOOL expression
True
False
Rest Of The Routine
Yes
No
Statement 1
Statement 2
Statement 3
Statement 4
…
BOOL expression
True
False
Rest Of The Routine
A major fault will occur if Fault type Fault code
The construct loops too long 6 1
If you want this Enter this structured text
The WHILE...DO loop evaluates its conditions first. If the conditions
are true, the controller then executes the statements within the loop.
This differs from the REPEAT...UNTIL loop because the
REPEAT...UNTIL loop executes the statements in the construct and
then determines if the conditions are true before executing the
statements again. The statements in a REPEAT...UNTIL loop are
always executed at least once. The statements in a WHILE...DO loop
might never be executed.
pos := 0;
While ((pos <= 100) & structarray[pos].value <> targetvalue)) do
pos := pos + 2;
String_tag.DATA[pos] := SINT_array[pos];
end_while;

Table of Contents

Other manuals for Allen-Bradley Logix5000

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Allen-Bradley Logix5000 and is the answer not in the manual?

Allen-Bradley Logix5000 Specifications

General IconGeneral
BrandAllen-Bradley
ModelLogix5000
CategoryController
LanguageEnglish

Related product manuals