Mitsubishi MELSEC-Q/L Programming Manual page 386

Table of Contents

Advertisement

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.
Error
code
After the FOR instruction was executed, the END, FEND, or GOEND
instruction was executed prior to the NEXT instruction.
4200
The STOP instruction is in process between the FOR and the NEXT
instructions.
4201
The NEXT instruction was executed prior to the FOR instruction.
The 17th FOR instruction was executed when the FOR instruction has
4202
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]
Remark
1. To force an end to the repetitious execution of the FOR to NEXT loop during the execution of the loop, insert a BREAK
instruction. See Page 385, Section 7.6.2 for details concerning the use of the BREAK instruction.
2. Use the EGP/EGF instruction to perform the pulse operation of an index-modified program between the FOR and NEXT
instructions. Note, however, that rise and fall instructions are not available on the operation output side. Refer to Page 137,
Section 5.2.5 for details of the EGP/EGF instruction. The program samples are shown below:
3. Branching into a FOR to NEXT loop using a JMP or other branch instruction from the outside of the FOR to NEXT loop
is not possible.
384
Error details
[List Mode]
Step
Q00J/
Q00/
QnH
QnPH QnPRH
Q01
Instruction
Device
QnU
LCPU

Advertisement

Table of Contents
loading

Table of Contents