Saturday, 31 May 2014

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:- 
  1. Build target(F7)
  2. DEBUG(F5)
  3. Then go to memorey window then select 2 memorey location for this program
  4. Then in the window enter like this:
  5. X:0x8100
  6.  then enter FF FF
  7. In the output you will get
  8. 01 FE



No comments:

Post a Comment