170
Example The following example shows the comparisons made and the results provided
for MCMP(19). Here, the comparison is made during each cycle when 00000 is
ON.
IR 100 0100 DM 0200 0100 DM 030000 0
IR 101 0200 DM 0201 0200 DM 030001 0
IR 102 0210 DM 0202 0210 DM 030002 0
IR 103 ABCD DM 0203 0400 DM 030003 1
IR 104 ABCD DM 0204 0500 DM 030004 1
IR 105 ABCD DM 0205 0600 DM 030005 1
IR 106 ABCD DM 0206 0210 DM 030006 1
IR 107 0800 DM 0207 0800 DM 030007 0
IR 108 0900 DM 0208 0900 DM 030008 0
IR 109 1000 DM 0209 1000 DM 030009 0
IR 110 ABCD DM 0210 0210 DM 030010 1
IR 111 ABCD DM 0211 1200 DM 030011 1
IR 112 ABCD DM 0212 1300 DM 030012 1
IR 113 1400 DM 0213 1400 DM 030013 0
IR 114 0210 DM 0214 0210 DM 030014 0
IR 115 1212 DM 0215 1600 DM 030015 1
MCMP(19)
100
DM 0200
DM 0300
00000
TB1: IR 100 TB2: DM 0200 R: DM 0300
Address Instruction Operands
00000 LD 00000
00001 MCMP(19)
100
DM 0200
DM 0300
5-17-2 COMPARE – CMP(20)
Cp1: First compare word
IR, SR, AR, DM, HR, TC, LR, #
Cp2: Second compare word
IR, SR, AR, DM, HR, TC, LR, #
Ladder Symbols Operand Data Areas
CMP(20)
Cp1
Cp2
Limitations When comparing a value to the PV of a timer or counter, the value must be in
BCD.
Description When the execution condition is OFF, CMP(20) is not executed. When the exe-
cution condition is ON, CMP(20) compares Cp1 and Cp2 and outputs the result
to the GR, EQ, and LE flags in the SR area.
Precautions Placing other instructions between CMP(20) and the operation which accesses
the EQ, LE, and GR flags may change the status of these flags. Be sure to ac-
cess them before the desired status is changed.
CMP(20) cannot be used to compare signed binary data. Use CPS(––) instead.
Refer to
5-17-8 SIGNED BINARY COMPARE – CPS(––)
for details.
Data Comparison Section 5-17