Mitsubishi Electronics Mitsubishi Digital Electronics Video Gaming Accessories FX3G ユーザーズマニュアル

ページ / 936
239
FX
3G
/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
trodu
ct
ion
2
O
ver
vi
ew
3
In
st
ru
ct
ion 
Li
st
4
D
evices 
in D
etail
5
Specifi
ed t
he
D
evice &
 
C
onst
ant
6
Bef
ore 
Pr
ogr
am
m
ing
7
B
asic 
In
st
ru
ct
ion
8
FNC0
0-F
NC0
9
Pr
ogr
am
 Flow
9
FN
C
10-FN
C
19
Mo
ve
 &
 Co
mp
are
10
FNC2
0-F
NC2
9
Ar
ith.
 &
 Logic 
O
per
ati
on
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 details on changing the watchdog timer time, refer to Subsection 37.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.
Program example
1. Program with three FOR-NEXT loops
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
The loop [3] is repeated 4 times.
When the data value (current value) of D0Z
(D4 when Z is "4") is "6", the loop [2] is
repeated 6 times.
 When X010 is OFF
When K1X000 is "7", the loop [1] is repeated
7 times.
 When X010 is ON
The program execution jumps to the pointer P22,
and the loop [1] is skipped.
Number of times of repeating the loops [1],
[2] and [3]
X010 = ON
X010 = OFF
× 6 × 4 =168 times
× 4 = 24 times
4 times
[1]
[2]
[3]
0 time
24 times
4 times
X010
P 22
[1]
[2]
[3]
FNC 09
NEXT
FNC 08
FOR
K  4
FNC 08
FOR
D 0Z
FNC 00
CJ
P 22
FNC 08
FOR
K1X000
FNC 09
NEXT
FNC 09
NEXT
7
times
6
times
4
times