8051 Program to add two 16 bit Numbers (AT89C51) Microcontroller

8051 Program to add two 16 bit Numbers
Below Code is Complied and Verified in Keil uVision 3.
The .asm file is given below after the code. For clarifications and suggestion comment in the comment section



;   8051 ASSEMBLY CODE -- CODESEXPLORER BLOG
; ALP TO ADD TWO 16 BIT NUMBER
; BELOW CODE ADDS AB20H + 65DE = 110FE WITH CARRY FLAG SET 

ORG 0000H
CLR C     ;MAKE CY=0
MOV A,#020H  ;LOWER BYTE OF OPERAND 1 IN A
ADD A,#0DEH  ;ADD LOWER BYTE OF OPERAND 2 WITH A
MOV R1,A  ;STORES LSB OF RESULT IN R1
MOV A,#65H  ;HIGHER BYTE OF OPERAND 2 IN A
ADDC A,#0ABH ; ADD WITH HIGHER BYTE OF OPERAND 1
MOV R0,A  ;STORES MSB OF RESULT IN R0
END





Please Click on link below to Download Assembly Source Code

addition of two 16 bit numbers  ASM File

1 comment:

Powered by Blogger.