Mitsubishi Electronics FX3G User Manual
246
FX
3S
/FX
3G
/FX
3GC
/FX
3U
/FX
3UC
Series
Programming Manual - Basic & Applied Instruction Edition
9 Move and Compare – FNC 10 to FNC 19
9.1 FNC 10 – CMP / Compare
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
,
+1 or
+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
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.