For; 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

FOR...DO
FOR count:= initial_value TO
final_value BY increment DO
<statement>;
END_FOR;
Use the FOR...DO loop to do something a specific number of times before doing
anything else.
Operands:

Structured Text

Operand
count
initial_ value
final_ value
increment
IMPORTANT
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Type
Format
SINT
Tag
INT
DINT
SINT
Tag
INT
expression
DINT
Immediate
SINT
Tag
INT
expression
DINT
Immediate
SINT
Tag
INT
expression
DINT
Immediate
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, a major fault
occurs.
• Consider using a different construct, such as IF...THEN.
Structured Text Programming
Description
Tag to store count position as the FOR...DO
executes
Must evaluate to a number
Specifies initial value for count
Specifies final value for count, which
determines when to exit the loop
(Optional) amount to increment count each
time through the loop
If you don't specify an increment, the count
increments by 1.
Appendix C
687

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents