2-95

2 Instructions
CP1E CPU Unit Instructions Reference Manual(W483)

Comparison Instructions

2

CMP/CMPL

CMP/CMPL
Applicable Program Areas
Operands
Operand Specifications
Flags

Instruction Mnemonic Variations Function

code Function

COMPARE CMP !CMP 020

Compares two unsigned binary values (constants

and/or the contents of specified words) and out-

puts the result to the Arithmetic Flags in the Auxil-

iary Area.

DOUBLE COMPARE CMPL --- 060

Compares two double unsigned binary values

(constants and/or the contents of specified words)

and outputs the result to the Arithmetic Flags in

the Auxiliary Area.

Symbol
CMP CMPL
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
CMP CMPL CMP CMPL
S1 CMP: Comparison data 1
CMPL: Comparison data 1, rightmost word address UINT UDINT 1 2
S2 CMP: Comparison data 2
CMPL: Comparison data 2, rightmost word address UINT UDINT 1 2
Area Word addresses Indirect DM addresses Constants CF Pulse bits TR bits
CIO WR HR AR T C DM @DM *DM
S1, S2 OK OK OK OK OK OK OK OK OK OK --- --- ---
Name CX-Programmer
label
Operation
CMP CMPL
Error Flag P_ER Unchanged Unchanged
Greater Than Flag P_GT ON if S1 > S2.
OFF in all other cases.
ON if S1 +1, S1 > S2+1, S2.
OFF in all other cases.
Greater Than or Equal Flag P_GE ON if S1 S2.
OFF in all other cases.
ON if S1 +1, S1 S2+1, S2.
OFF in all other cases.
Equal Flag P_EQ ON if S1 = S2.
OFF in all other cases.
ON if S1 +1, S1 = S2+1, S2.
OFF in all other cases.
Not Equal Flag P_NE ON if S1 S2.
OFF in all other cases.
ON if S1 +1, S1 S2+1, S2.
OFF in all other cases.
Less Than Flag P_LT ON if S1 < S2.
OFF in all other cases.
ON if S1 +1, S1 < S2+1, S2.
OFF in all other cases.
Less Than or Equal Flag P_LE ON if S1 S2.
OFF in all other cases.
ON if S1 +1, S1 S2+1, S2.
OFF in all other cases.
Negative Flag P_N Unchanged Unchanged
CMP(020)
S1
S2
S1: Comparison data 1
S2: Comparison data 2
CMPL(060)
S1
S2
S1: Comparison data 1
S2: Comparison data 2