FOR,NEXT
Operation Error
(1) In any of the following cases, an operation error occurs, the error flag (SM0) turns ON, and
an error code is stored into SD0.
• An END, FEND or GOEND instruction was executed before the execution of a NEXT
instruction and after the execution of a FOR instruction.
• A NEXT instruction is executed prior to the execution of a FOR instruction.
• A STOP instruction has been inserted within the FOR to NEXT loop.
• The 17th FOR instruction is executed when FOR instructions have been nested.
Program Example
(1) The following program executes the FOR to NEXT loop when X8 is OFF, and does not
execute it when X8 is ON.
[Ladder Mode]
7-106
[List Mode]
Step
Instruction
(Error code: 4200)
(Error code: 4201)
(Error code: 4200)
(Error code: 4202)
Device