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

ページ / 936
241
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
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
9.1
FNC 10 – CMP / Compare
Outline
This instruction compares two values, and outputs the result (smaller, equal or larger) to bit devices (3 points).
→ For the contact comparison instruction, refer to Chapter 28.
→ For floating point comparison, refer to Section 18.1.
1. Instruction format
2. Set data
3. Applicable devices
S1: "D….b" is available only in FX
3U
 and FX
3UC
 PLCs.  However, index modifiers (V and Z) are not available.
S2: This function is supported only in FX
3U
/FX
3UC
 PLCs.
Explanation of function and operation
1. 16-bit operation (CMP and CMPP)
The comparison value 
 and the comparison source 
 are compared with each other.  According to the
result (smaller, equal or larger), either one among 
+1 and 
+2 turns ON.
• The source data 
 
 are handled as binary values.
• Comparison is executed algebraically.  Example: 
−10 < 2
Operand Type
Description
Data Type
Data or device number handled as comparison value
16- or 32-bit binary
Date or device number handled as comparison source
16- or 32-bit binary
Head bit device number to which comparison result is output
Bit
Oper-
and 
Type
Bit Devices
Word Devices
Others
System User
Digit Specification
System User
Special 
Unit
Index
Con-
stant
Real 
Number
Charac-
ter String
Pointer
X Y M T C S D….b KnX KnY KnM KnS T C D R U…\G… V Z Modify K H
E
"…"
P
3
3
3
3
3 3 3 3
S2
3 3
3
3 3
3
3
3
3
3 3 3 3
S2
3 3
3
3 3
3 3
3
S1
3
DCMP
DCMPP
Mnemonic
Operation Condition
P
FNC 10
CMP
D
16-bit Instruction
 7 steps
CMP
CMPP
Mnemonic
Operation Condition
Continuous
Operation
Pulse (Single)
Operation
32-bit Instruction
 13 steps
Continuous
Operation
Pulse (Single)
Operation
  
S
1
  
S
2
  D
  
S
1
  
S
2
  D
  
S
1
  
S
2
   
D
   
D
   
D
  
S
1
  
S
2
FNC 10
CMP
S
1
 ‚
Even if the command input turns OFF and CMP instruction is not executed,            ,           +1 and           +2 latch
the status just before the command input turns OFF from ON.
Command
input
48
49
50
51
Latched
Latched
+1
+2
Latched
Command
input
S
2
 ‚
D ‚
D ‚
S
1
 ‚
S
2
 ‚
D ‚
D ‚
D ‚
+1
D ‚
+2
D ‚
D ‚
D ‚
D ‚
<
S
1
 ‚
S
2
 ‚ ] ".
Turns ON in the case of
" [
=
S
1
 ‚
S
2
 ‚ ] ".
Turns ON in the case of
" [
>
S
1
 ‚
S
2
 ‚ ] ".
Turns ON in the case of
" [