8051 Addition of 16-bit Numbers

 

Addition of two 16-bit Numbers in 8051

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

Comments

Popular posts from this blog

Alternating Current

SOLAR TRANSFORMERS