Delta Electronics Extension Digital I/O Module DOP-EXIO14RAE User Manual
Page 95
Appendix D Use of Application Instructions|DOP-EXIO Series
D-14
Revision March, 2008, Doc. Name: 2007PDD23000014
Mnemonic
Operands Function
CMP
D
S
1
S
2
D
Compare
Bit Devices
Word Devices
X Y M S K H
KnX
KnY
KnM KnS
T
C
D
E
F
S
1
S
2
D
y
Note:
1. If
S
1
and S
2
are used in device F, only 16-bit instruction is applicable.
2. Operand D occupies 3 consecutive devices.
16-bit instruction (7 Steps)
CMP
Continuous
execution
32-bit instruction (13 Steps)
DCMP
Continuous
execution
y
Flags: None
Operands:
S
1
: Comparison Value 1
S
2
: Comparison Value 2
D
: Comparison result
Explanations:
1. The contents in S
1
and S
2
are compared and the result will be stored in D.
2. The two comparison values are compared algebraically and the two values are signed binary
values. When b15 = 1 in 16-bit instruction or b31 = 1 in 32-bit instruction, the comparison will
regard the value as negative binary values.
Program Example:
1. Designate device Y0, and operand D automatically occupies Y0, Y1, and Y2.
2. When X10 = On, CMP instruction will be executed and one of Y0, Y1, and Y2 will be On. When
X10 = Off, CMP instruction will not be executed and Y0, Y1, and Y2 remain their status before
X10 = Off.
3. If the user needs to obtain a comparison result with ≥ ≤, and ≠, make a series parallel connection
between Y0 ~ Y2.
X10
Y0
Y1
Y2
CMP
K10
D10
Y0
If K10>D10, Y0 = On
If K10=D10, Y1 = On
If K10 4. To clear the comparison result, use RST or ZRST instruction.