The 8051 Microcontroller and Embedded

(lily) #1
Department of Computer Scien

ce and Information Engineering

National Cheng Kung University, TAIWAN
HANEL

ARITHMETIC INSTRUCTIONSSubtraction of Unsigned Numbers


(cont’)


‰SUBB when CY = 1


¾This instruction is used for multi-byte numbers and will take care of the borrow of the lower operand


CLR CMOV A,#62H ;A=62HSUBB A,#96H ;62H-96H=CCH with CY=1MOV R7,A ;save the resultMOV A,#27H ;A=27HSUBB A,#12H ;27H-12H-1=14HMOV R6,A ;save the result
Solution:We have 2762H - 1296H = 14CCH.

A = 62H – 96H – 0 = CCHCY = 1
A = 27H - 12H - 1 = 14HCY = 0
Free download pdf