You are on page 1of 1

Microprocessors and Microcontrollers

Name:- Kannan D
Register no. :- 22BEC1284
Slot:- E2+TE2

Question:-
The memory location 3FH has 55H and the external RAM location FF00H has
AAH. Write an 8051 ALP to exchange the content of Internal RAM location
and External RAM location.

Code:-
ORG 0000H
MOV DPTR, 3FH ; Load address of internal RAM location into DPTR
MOV A, @DPTR ; Load content of internal RAM location into accumulator
MOV R0, A ; Move content of internal RAM location to register R0
MOV DPTR, FF00H ; Load address of external RAM location into DPTR
MOV A, @DPTR ; Load content of external RAM location into accumulator
MOV @R0, A ; Move content of external RAM location to internal RAM location

MOV A, R0 ; Move content of internal RAM location to accumulator


MOV @DPTR, A ; Move content of accumulator to external RAM location
END

Sample Input and Output:-


The value in 3FH memory location and that in FF00H are exchanged.
3FH = 55H; FF00H = AAH
3FH = AAH; FF00H = 55H

You might also like