5 - 156
5 OPERATION CONTROL PROGRAMS
F/FS G
5.17.3 Repeat control with specified count: FOR - NEXT
Format FOR(D) = (S1)TO(S2)STEP(S3) - NEXT Number of basic steps
FOR : 9
NEXT : 8
[Usable data]
Setting
data
Usable Data
Bit device
Word device Constant
Calculation
expression
Bit
conditional
expression
Comparison
conditional
expression
16-bit
integer
type
32-bit
integer
type (L)
64-bit
floating
point
type (F)
Coasting
timer
16-bit
integer
type (K/H)
32-bit
integer type
(K/H, L)
64-bit
floating
point
type (K)
(D) —
— — — — — — —
(S1) —
—
— — —
(S2) —
—
— — —
(S3) — — — — —
— — —
: Usable
[Setting data]
Setting data Description Data type of result
(D)
Device used for loop control counter
—
(S1)
Initial value of loop control counter
(S2)
Final value of loop control counter
(S3)
Incremental value of loop control counter
[Functions]
(1) (S1) is substituted to the device specified with (D) as initial value, and the block
between FOR and NEXT is repeatedly executed.
(2) The incremental value specified with (S3) is added to the device specified with (D)
at every execution of NEXT. If the device value specified with (D) is larger than the
final value specified with (S2), the repeat control of the block between FOR and
NEXT is ended, and the next block of NEXT is executed.
(3) When the incremental value specified with (S3) is negative number, if the device
value specified with (D) is smaller than the final value specified with (S2), the
repeat control of the block between FOR and NEXT is ended.
(4) STEP can be omitted. If STEP is omitted, the repeat control is executed as "STEP
1".