For, Next; Index - Siemens SIMATIC S7-200 System Manual

Hide thumbs Also See for SIMATIC S7-200:
Table of Contents

Advertisement

SIMATIC Instructions

For, Next

L
A
D
EN
INDX
INIT
FINAL
F
B
D
EN
INDX
INIT
FINAL
S
FOR
T
L
NEXT
221
222 224
Inputs/Outputs
INDX
VW, IW, QW, MW, SW, SMW, LW, T, C, AC, *VD, *AC, *LD
INIT
VW, IW, QW, MW, SW, SMW, T, C, AC, LW, AIW, Constant, *VD,
*AC, *LD
FINAL
VW, IW, QW, MW, SW, SMW, LW, T, C, AC, AIW, Constant, *VD,
*AC, *LD
9-154
The FOR instruction executes the instructions between
the FOR and the NEXT. You must specify the index value
FOR
or current loop count (INDX), the starting value (INIT),
ENO
and the ending value (FINAL).
The NEXT instruction marks the end of the FOR loop,
and sets the top of the stack to 1.
For example, given an INIT value of 1 and a FINAL value
of 10, the instructions between the FOR and the NEXT
NEXT
are executed 10 times with the INDX value being
incremented: 1, 2, 3, ...10.
If the starting value is greater than the final value, the
FOR
loop is not executed. After each execution of the
ENO
instructions between the FOR and the NEXT instruction,
the INDX value is incremented and the result is
compared to the final value. If the INDX is greater than
the final value, the loop is terminated.
For: Error conditions that set ENO = 0: SM4.3
(run-time), 0006 (indirect address)
NEXT
INDX,
INIT
FINAL
226
Operands
S7-200 Programmable Controller System Manual
Data Types
INT
INT
INT
A5E00066097-02

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents