215
FX
3U
/FX
3UC
Series Programmable Controllers
Programming Manual - Basic & Applied Instruction Edition
8 Program Flow – FNC 00 to FNC 09
8.10 FNC 09 – NEXT / End a FOR/NEXT Loop
1
In
troduct
io
n
2
Ov
e
rv
ie
w
3
In
st
ru
ct
ion
Li
st
4
D
evi
ce
s
in
De
ta
il
5
Speci
fied t
h
e
D
evi
ce &
C
onst
a
nt
6
Bef
o
re
Pr
ogr
a
m
m
ing
7
Bas
ic
In
st
ru
cti
o
n
8
FNC0
0
-FNC0
9
P
ro
g
ra
m F
lo
w
9
FNC1
0
-FNC1
9
M
ov
e
&
C
om
par
e
10
FNC
20-
FNC
2
9
Ar
ith.
&
Logi
c
O
per
at
io
n
Caution
1. Limitation in the number of nesting
FOR-NEXT loop can be nested up to 5 levels.
Errors
1. Watchdog timer error
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 the details of changing the watchdog timer time, refer to Subsection 36.2.2.
→
For resetting the watchdog timer, refer to WDT (FNC 07) instruction.
2. Examples of wrong programs
The following programs are regarded as errors.
FOR
1st
level
FOR
FOR
NEXT
NEXT
NEXT
2nd
level
3rd
level
FOR
1st
level
FOR
FOR
NEXT
NEXT
NEXT
2nd
level
1st
level
When NEXT instruction does not exist
FOR
When NEXT instruction is located before FOR
instruction
FOR
When number of FOR instructions is not
equivalent to the number of NEXT instructions
NEXT
FOR
←
Not programmed
FOR
NEXT
When NEXT instruction is located after FEND or
END instruction
FOR
FEND
END
NEXT
NEXT
NEXT
NEXT
←
Not programmed