Tuesday, March 22, 2016

8051 Addition of 16-bit Numbers

The instruction ADDC (add with carry) is used for 16-bit addition. When adding two 16-bit data operands, we need to be concerned with the propagation of a carry from the lower byte to the higher byte.

Program to add 2 16-bit numbers 3CE7H and 3B8DH.
ORG 0H
MAIN :
CLR A; clear accumulator
CLR C; clear carry flag
MOV A, #0E7H
ADD A, #8DH
MOV R6, A ; save the low byte of sum
MOV A, #3CH
ADDC A, #3BH
MOV R7, A ; save the high byte of sum
END; end of asm source file



Related topics:
8051 Addition   |   8051 Addition with Carry   |   8051 Addition of Unsigned Numbers   |   8051 Binary Coded Decimal   |   8051 ADDC Instruction   |   8051 ADD Instruction

List of topics: 8051

No comments:

Post a Comment