KEYENCE Visual KV Series User Manual
Page 150

2.4 Instruction Details
3-126
2
Chapter 2 Instructions
Tips
Note 1: The FOR-NEXT instruction pair repeats the program for a specified time
period at each scan. It usually is used in steps or subroutines.
Note 2: When a large number of loops or long programs are defined between FOR
and NEXT instructions, the processing time for one scan may become too long,
resulting in "Cycle time error". In such a case, reduce the number of loops or shorten
the ladder program.
•
The FOR-NEXT instruction set can be nested up to 8 levels deep. Nine or more
nested levels will result in a FOR-NEXT error.
•
After repeating FOR-NEXT 3) five times, program execution transfers to the
instructions following the NEXT instruction.
•
FOR-NEXT 2) is repeated twice while FOR-NEXT 3) is executed once.
Thus, FOR-NEXT 2) is executed 10 times.
•
FOR-NEXT 1) is repeated 5 times while FOR-NEXT 2) is executed once.
Thus, FOR-NEXT 1) is executed up to 50 (5 x 2 x 5) times.
Operands
Key operation
NEXT
NEXT
NEXT
FOR
#05
FOR
#02
FOR
#05
1)
2)
3)
FOR / NEXT
FUN
FUN
SET
1
ANL
2
O R
9
ORB
6
Operand
ENT
R-SRCH
ENT
R-SRCH
ENT
R-SRCH
ENT
R-SRCH
Visual KV
KV-300
KV-10/16
KV-24/40/80
#0000 to #65535
DM0000 to DM1984
#00000 to #65535
#00001 to #65535
DM0000 to DM1999 DM0000 to DM9999 DM0000 to DM0999 DM0000 to DM1999
TM02 to TM28
TM00 to TM29
TM00 to TM29
TM00 to TM29
KVNKA Chap 02_4bP.p65
08.3.11, 0:00 PM
126