97
4
4 Instructions 4.3.2 Comparison Output
4.3.2 Comparison Output
Comparison output
CMP Data comparison
ECMP Binary oating point comparison
ZCP Range comparison
EZCP Binary oating-point range comparison
CMP: Data comparison
◆
Overview
When driving conditions are met, the CMP instruction compares the values in S1 and S2 and then sets the
end-address bit element D (D+1 or D+2) to ON based on the comparison result (S1 > S2, S1 = S2, or S1 <
S2).
CMP S1 S2 D
Comparison of
two values
Applicable model:
H3U
S1
Comparative
value 1
Data of comparative value 1, or address of the word
element that stores the data
16-bit instruction
(7 steps)
CMP: Continuous
execution
CMPP: Pulse
execution
32-bit instruction
(13 steps)
DCMP: Continuous
execution
DCMPP: Pulse
execution
S2
Comparative
value 2
Data of comparative value 2, or address of the word
element that stores the data
D
Comparison
result
Head address of three consecutive elements that
store the comparison result (ON or OFF)
◆
Operands
Operand
Bit Element Word Element
System·User System·User Bit Designation Indexed Address Constant
Real
Number
S1 X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
S2 X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
D X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
Note: The elements in gray background are supported.
◆
Function
The values of two operands are compared. The comparison result is output to the designated bit variable.
Operands are processed as signed numbers in algebraic comparison.
D is a bit variable that occupies three consecutive addresses.