219
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
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
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.