![Mitsubishi Electric MELSEC FX3G Programming Manual Download Page 257](http://html.mh-extra.com/html/mitsubishi-electric/melsec-fx3g/melsec-fx3g_programming-manual_239083257.webp)
255
FX
3G
/FX
3U
/FX
3UC
Series Programmable Controllers
Programming Manual - Basic & Applied Instruction Edition
9 Move and Compare – FNC 10 to FNC 19
9.1 FNC 10 – CMP / Compare
1
Int
roduct
ion
2
O
ver
view
3
In
str
uc
tion
Li
st
4
D
evices
in D
etail
5
Spec
ified t
he
D
evice &
C
onst
ant
6
Bef
ore
Pr
ogr
am
m
ing
7
B
asic
In
st
ru
ct
io
n
8
FN
C
00-FN
C
09
P
rogr
am
F
low
9
FN
C
10
-FN
C
19
Mo
ve
&
Co
mp
are
10
FNC2
0-F
NC2
9
Ar
ith.
&
Logic
O
per
ation
2. 32-bit operation (DCMP and DCMPP)
The comparison value [
+1,
] and the comparison source [
+1,
] are compared with each
other. According to the result (smaller, equal or larger), either one among
,
+1 and
+2 turns ON.
• The source data [
+1,
] [
+1,
] are handled as binary values.
• Comparison is executed algebraically. Example:
−
125400
<
22466
Caution
1. Number of occupied devices
From the device specified as
, three devices are occupied. Make sure not to use those devices in another control.
Program examples
1. When comparing the current value of a counter
If it is necessary to clear the comparison result when the instruction is not executed, add the following
contents under the above program.
1) RST instruction
2) ZRST instruction
S
1
S
1
S
2
S
2
D
D
D
S
1
S
1
S
2
S
2
FNC 10
DCMP
Even if the command input turns OFF and DCMP instruction is not executed, , +1 and +2 latch
the status just before the command input turns OFF from ON.
48
49
50
51
Command
input
Command
input
S
1
+1
+2
S
2
D
D
D
D
+1,
S
2
S
2
D
+1,
D
+2,
D
+1,
S
1
S
1
Latched
Latched
Latched
D
D
D
<
Turns ON in the case of
+1,
]
S
1
S
1
+1,
[ S
2
S
2
" [
] ".
=
+1,
]
S
1
S
1
Turns ON in the case of
+1,
[ S
2
S
2
" [
] ".
>
] ".
Turns ON in the case of
+1,
" [
]
S
1
S
1
+1,
[ S
2
S
2
D
X000
FNC 10
CMP
K100
C 20
M 0
M 0
M 1
M 2
Turns ON in the case of
"K100
>
C20 (Current value)" .
X000
C20
M0
M1
M2
99
100
101
Latched
in the
ON
status.
Latched
in the
ON
status.
Latched
in the
ON
status.
S
1
S
2
D
Turns ON in the case of
"K100 = C20 (Current value)" .
Turns ON in the case of
"K100
<
C20 (Current value)" .
X000
RST
M0
RST
M1
RST
M2
X000
FNC 40
ZRST
M0
M2
M0 to M2 are reset.