556
7 APPLICATION INSTRUCTIONS
7.4 Structure Creation Instructions
• After the FOR to NEXT instruction loop is executed unconditionally (n) times, the step following the NEXT instruction is
executed.
• Specify a value 1 to 32767 for (n). If a value -32768 to 0 is specified, the processing is performed regarding (n) as 1.
• To not to execute the FOR to NEXT instruction loop, use the CJ or SCJ instruction to jump the instruction loop.
• Up to 16 FOR instructions can be nested.
• To terminate the FOR to NEXT instruction loop being executed, use the BREAK instruction.
Page 557 BREAK(P)
• To perform pulse operations of an index-modified program within the FOR to NEXT instruction loop, use the
EGP or EGF instruction. Note, however, that no rising edge or falling edge instruction can be used on the
operation output side.
• The JMP instruction cannot be used to branch into the FOR to NEXT instruction loop from the outside.
• To create an easy-to-understand program, use a pair of instructions, the FOR and NEXT instructions, within
a single program block.
Error code
(SD0)
Description
3340H After execution of the FOR instruction, the END, FEND, or GOEND instruction is executed before the NEXT instruction.
The STOP instruction is provided within the FOR to NEXT instruction loop.
3341H The NEXT instruction is executed before the FOR instruction.
3361H More than 16 FOR instructions are nested. (The 17th instruction is executed.)
K5FOR
K3FOR
K100FOR
NEXT
NEXT
NEXT
X0
X1
X2
NEXT
K10FOR
SM400
Z0RST
SM400
M100Z0
M0Z0 V0Z0
Z0INC