7 Applied Instructions (Program Flow)
7.10 NEXT / End a FOR/NEXT Loop
130
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
Cautions
FOR-NEXT loop can be nested up to 5 levels.
Error
1) When FOR-NEXT loop is repeated many times, the operation cycle (D8010) is too long, and a watchdog
timer error may occur. In such a case, change the watchdog timer time or reset the watchdog timer.
→ For details on changing and resetting the watchdog timer, refer to Section 7.8.
2) The following programs are regarded as errors.
FOR
EN
n
ENO
NEXT
EN ENO
FOR
EN
n
ENO
FOR
EN
n
ENO
NEXT
EN ENO
NEXT
EN ENO
FOR
EN
n
ENO
NEXT
EN ENO
FOR
EN
n
ENO
FOR
EN
n
ENO
NEXT
EN ENO
NEXT
EN ENO
1st
level
2nd
level
3rd
level
1st
level
1st
level
2nd level
When NEXT instruction does not exist
Not programmed
When NEXT instruction is located before FOR instruction
When number of FOR instructions is not equivalent to the
number of NEXT instructions.
Not programmed
When NEXT instruction exits after FEND instruction.
EN
FOR
EN
n
ENO
NEXT
ENO
FOR
EN
n
ENO
EN
NEXT
ENO
FOR
EN
n
ENO
FOR
EN
n
ENO
EN
NEXT
ENO
EN
NEXT
ENO
FOR
EN
n
ENO
EN
NEXT
ENO
FEND
EN ENO