For (For); Relay Ladder; Structured Text - Allen-Bradley Logix5000 Reference Manual

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

Advertisement

Chapter 12
For/Break Instructions (FOR, FOR...DO, BRK, EXIT, RET)

For (FOR)

FOR count:= initial_value TO
final_value BY increment DO
<statement>;
END_FOR;
Description:
486
The FOR instruction executes a routine repeatedly.
Operands:

Relay Ladder

Operand
Routine name
Index
Initial value
Terminal value SINT
Step size

Structured Text

Use the FOR...DO construct. See
on structured text constructs.
IMPORTANT
When enabled, the FOR instruction repeatedly executes the Routine until the
Index value exceeds the Terminal value. This instruction does not pass parameters
to the routine.
Each time the FOR instruction executes the routine, it adds the Step size to the
Index.
Be careful not to loop too many times in a single scan. An excessive number of
repetitions can cause the controller's watchdog to timeout, which causes a major
fault.
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Type
Format
ROUTINE
Routine Name Routine to execute
DINT
Tag
SINT
Immediate
INT
Tag
DINT
Immediate
INT
Tag
DINT
SINT
Immediate
INT
Tag
DINT
Structured Text Programming
Do not use a FOR instruction to call (execute) the main routine.
· You can put a FOR instruction in the main routine or
any other routine.
· If you use a FOR instruction to call the main routine
and then put a RET instruction in the main routine, a
major fault occurs (type 4, code 31).
Description
Counts how many times the routine has been
executed
Value at which to start the index
Value at which to stop executing the routine
Amount to add to the index each time the FOR
instruction executes the routine
for information

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents