The 8051 Microcontroller and Embedded

(lily) #1
Department of Computer Scien

ce and Information Engineering

National Cheng Kung University, TAIWAN
HANEL

LOGIC AND COMPARE INSTRUCTIONSCompare Instruction(cont’)


‰Notice in the


CJNE


instruction that any


Rn register can be compared with an immediate value¾There is no need for register A to be involved


CJNE R5,#80,NOT_EQUAL ;check R5 for 80...


;R5 = 80

NOT_EQUAL:

JNC NEXT ;jump if R5 > 80...

;R5 < 80

NEXT: ...

Compare

Carry Flag

destination

≥source

CY = 0

destination < source

CY = 1

CY flag is always checked for cases of greater or less than, but only after it is determined that they are not equal
Free download pdf