5 Applied Instructions and Basic Usage
DVP-20PM Application Manual
5-23
API
Applicable model
20PM
10
D
CMP
P
Comparing values
Bit device Word device
X Y M S K H KnX KnY KnM KnS T C D V Z
S
1
* *
* * * * * * * * *
S
2
* *
* * * * * * * * *
D
* * *
Note: The instruction supports V devices and Z devices. (If the 16-bit
instruction is used, Z devices can not be used. If the 32-bit
instruction is used, V devices can not be used.)
Please refer to specifications for more information about device
ranges.
16-bit instruction (7 steps)
CMP
Continuity
instruction
CMPP
Pulse
instruction
32-bit instruction (9 steps)
DCMP
Continuity
instruction
DCMPP
Pulse
instruction
Flag: None
Explanation
The instruction is used to compare the value in S
1
with that in S
2
. The
comparison result is stored in D.
S
1
: Comparison value 1; S
2
: Comparison value 2; D: Comparison result
The operand D occupies three consecutive devices.
Example
When X10 i
s ON, the instruction CMP is executed, and Y0, Y1, or Y2 is ON.
When X10 is OFF, the execution of the instruction CMP stops, and the states
of Y0, Y1, and Y2 remain unchanged.
If the operand D is Y0, Y0, Y1, and Y2 will be occupied automatically.
If users want to get the result that K10≧ the value in D10, they have to connect
Y0 and Y1 in series. If users want to get the result that K10≦ the value in D10,
they have to connect Y1 and Y2 in series. If users want to get the result that
K10≠the value in D10, they have to connect Y0, Y1, and Y2 in series.
X10
CMP
K10
D10
Y0
Y0
Y1
Y2
If K10>the value in D10, Y0 will be ON.
If K10=the value in D10, Y1 will be ON.
If K10<the value in D10, Y2 will be ON.