7-106
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. (Error code: 4200)
• A NEXT instruction is executed prior to the execution of a FOR instruction.
(Error code: 4201)
• A STOP instruction has been inserted within the FOR to NEXT loop.
(Error code: 4200)
• The 17th FOR instruction is executed when FOR instructions have been nested.
(Error code: 4202)
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] [List Mode]
Step
Instruction
Device