Allen-Bradley Logix5000 Reference Manual page 688

1756 controllogix, 1768 compactlogix, 1769 compactlogix, 1789 softlogix, 1794 flexlogix, powerflex 700s with drivelogix
Hide thumbs Also See for Logix5000:
Table of Contents

Advertisement

Appendix C
Structured Text Programming
Description:
Optional
Optional
Done x Number
Of Times?
No
Statement 1
Statement2
Statement 3
Statement 4
...
The FOR...DO loop executes a specific number of
times.
Arithmetic Status Flags:
Fault Conditions:
If you want this
Clear bits 0...31 in an array of BOOLs:
1. Initialize the subscript tag to 0.
2. Clear array[ subscript ] . For example, when
subscript = 5, clear array[5].
3. Add 1 to subscript.
4. If subscript is ≤ to 31, repeat
Otherwise, stop.
688
The syntax is described in the table.
FOR count := initial_value
TO final_value
{
BY increment
DO
<statement>;
IF bool_expression THEN
EXIT;
END_IF;
END_FOR;
The following diagrams show how a FOR...DO loop executes and how an EXIT
statement leaves the loop early.
Yes
Rest Of The Routine
Not affected
A major fault will occur if
The construct loops too long.
Example 1:
2
and 3.
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
If you don't specify an increment, the loop
increments by 1.
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.
Done x Number
Of Times?
No
Statement 1
Statement 2
Statement 3
Statement 4
...
Exit ?
No
To stop the loop before the countreaches the last value, use
an EXIT statement.
Fault type
6
Enter this structured text
For subscript:=0 to 31 by 1 do
array[subscript] := 0;
End_for;
Yes
Yes
Rest Of The Routine
Fault code
1

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents