252
Comparison Instructions Section 5-18
5-18-4 DOUBLE COMPARE – CMPL(60)
Note CMPL(60) is an expansion instruction for the SRM1. The function code 60 is
the factory setting and can be changed for the SRM1 if desired.
Limitations Cp1 and Cp1+1 must be in the same data area.
Cp2 and Cp2+1 must be in the same data area.
Set the third operand to 000.
Description When the execution condition is OFF, CMPL(60) is not executed. When the
execution condition is ON, CMPL(60) joins the 4-digit hexadecimal content of
Cp1+1 with that of Cp1, and that of Cp2+1 with that of Cp2 to create two 8-
digit hexadecimal numbers, Cp+1,Cp1 and Cp2+1,Cp2. The two 8-digit num-
bers are then compared and the result is output to the GR, EQ, and LE flags
in the SR area.
Precautions Placing other instructions between CMPL(60) and the operation which
accesses the EQ, LE, and GR flags may change the status of these flags. Be
sure to access them before the desired status is changed.
Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
GR: ON if Cp1+1,Cp1 is greater than Cp2+1,Cp2.
EQ: ON if Cp1+1,Cp1 equals Cp2+1,Cp2.
LE: ON if Cp1+1,Cp1 is less than Cp2+1,Cp2.
Example:
Saving CMPL(60) Results
The following example shows how to save the comparison result immediately.
If the content of HR 10, HR 09 is greater than that of 011, 010, then 10000 is
turned ON; if the two contents are equal, 10001 is turned ON; if content of HR
10, HR 09 is less than that of 011, 010, then 10002 is turned ON. In some
applications, only one of the three OUTs would be necessary, making the use
Cp2: First word of second compare word pair
IR, SR, AR, DM, HR, TC, LR
Cp1: First word of first compare word pair
IR, SR, AR, DM, HR, TC, LR
Ladder Symbols Operand Data Areas
CMPL(60)
Cp1
Cp2
––