6 BASIC INSTRUCTIONS
6.1 Comparison Operation Instructions
151
6
Comparison output 32-bit binary data
DCMP(P)(_U)
These instructions perform a comparison operation between the 32-bit binary data in the devices specified by (s1) and (s2).
■Descriptions, ranges, and data types
■Applicable devices
*1 T, ST, C cannot be used.
• These instructions perform a comparison operation between the 32-bit binary data in the device specified by (s1) and the
32-bit binary data in the device specified by (s2) and according to the result (small, equal, large), (d), (d) + 1, or (d) + 2 is
turned ON.
• (s1) and (s2) are handled as binary values within the range of above data setting.
• Large and small comparison is executed algebraically.
Ladder diagram Structured text
ENO:=DCMP(EN,s1,s2,d);
ENO:=DCMPP(EN,s1,s2,d);
ENO:=DCMP_U(EN,s1,s2,d);
ENO:=DCMPP_U(EN,s1,s2,d);
Operand Description Range Data type Data type (label)
(s1) DCMP(P) Comparison value data or the head device
where the comparison value data is stored
-2147483647 to +2147483647 32-bit signed binary ANY32
DCMP(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(s2) DCMP(P) Comparison source data or the head device
where the comparison source data is stored
-2147483647 to +2147483647 32-bit signed binary ANY32
DCMP(P)_U 0 to 4294967295 32-bit unsigned binary ANY32_U
(d) The starting bit device to which the comparison
result is output
Bit ANY_BOOL
Operand Bit Word Double word Indirect
specification
Constant Others
X, Y, M, L,
SM, F, B, SB
U\G T, ST,
C, LC
T, ST, C, D,
W, SD, SW, R
U\G Z LC LZ K, H E $
(s1)
(s2)
(d)
*1
• With sign… -125400 (FFFE1628H) < 224566 (00036D36H)
• Without sign… 16776690 (00FFFDF2H) < 4294967176 (FFFFFF88H)
(d)
DCMP
(d)+1
(d)+2
48
49
50
51
(d)+1
(d)+2
(s1) (s2)
(d)
(s2)
(d)
(s1)
Command input
Command input
Latched
Latched
Latched
Turns ON in the case of (s1)>(s2).
Turns ON in the case of (s1)=(s2).
Turns ON in the case of (s1)<(s2).
Even if the command input turns OFF and the DCMP instruction is not executed, (d) to (d)+2 latches the status
just before the command input turns from ON to OFF.