Program to add two 8 bit number in 8051 micro controller:-Using external memorey
SOFTWARE PACKAGE:- Keil uVision4
MOV DPTR,#8100H
MOVX A,@DPTR
MOV B,A
INC DPTR
MOVX A,@DPTR
ADD A,B
MOV DPTR,#8201H
MOVX @DPTR,A
MOV A,#00H
ADDC A,#00H
DEC DPL
MOVX @DPTR,A
END
In microcontroller 8051 you can give up to FF.in HEX
If you want for smaller number you can remove DEC DPL& Change memorey location to 8200H
After writing program save..TO View result follow the steps given below
RESULT:-
SOFTWARE PACKAGE:- Keil uVision4
MOV DPTR,#8100H
MOVX A,@DPTR
MOV B,A
INC DPTR
MOVX A,@DPTR
ADD A,B
MOV DPTR,#8201H
MOVX @DPTR,A
MOV A,#00H
ADDC A,#00H
DEC DPL
MOVX @DPTR,A
END
In microcontroller 8051 you can give up to FF.in HEX
If you want for smaller number you can remove DEC DPL& Change memorey location to 8200H
After writing program save..TO View result follow the steps given below
RESULT:-
- Build target(F7)
- DEBUG(F5)
- Then go to memorey window then select 2 memorey location for this program
- Then in the window enter like this:
- X:0x8100
- then enter FF FF
- In the output you will get
- 01 FE