Moving Data
External Data Moves
For the 8051 microcontroller, the MOVX (Move
External) instruction is specifically designed for
accessing external data memory. In the case of MOVX,
only indirect addressing is allowed, and you need to use
the DPTR (Data Pointer) register to specify the address
in the external memory.
Simulator Program Execution
Simulation Program MOVEX
Use Accumulator for external data
move, Use of other registers is not
valid
Simulation Program MOVX
Here you should not except to change the content of Port
P0 latch (Address 80H).
MOVX always considers external memory.
Try the program first with MOVX @R0,A and Then with
MOV @R0,A
Simulation Program MOVX
Use of direct address in MOVX is not permitted
Instead use DPTR
Simulation Program MOVX
Use of direct address in MOVX is not permitted
Instead use DPTR
External Data Moves
Code Memory Read Only Data Moves
Code Memory Read-Only Data Moves
The MOVC instruction is designed specifically for
accessing code memory and copying the data to
the accumulator, making it useful for cases where
you need to read data from code memory during
program execution.
Code Memory Read-Only Data Moves
MOVC command always uses indirect addressing
and that too only with either (1) DPTR in conjunction
with the accumulator or (2) PC in conjunction with the
accumulator as a data pointer.
Code memory ROM Data Move
Here instead of MOVC A,@DPTR
There should be MOVC A,@A+DPTR
Code memory ROM data Moves
Code memory ROM data Moves
Write an assembly language program for the 8051
microcontroller that transfers the data contained in ROM
memory (program memory) locations 01F0H to 01F7H to
registers R0 and R7.
Code memory ROM data Moves
Directly moving data from code memory to any register is not possible.
Therefore, the strategy involves initializing the base pointer in DPTR and
indexing to the accumulator. Subsequently, the program will use the MOVC
instruction (MOVC A,@A+DPTR) to copy data from ROM to the
accumulator. Following this, the data will be transferred from the
accumulator to register R0.
The same procedure will be repeated by updating the memory index in
the accumulator to access the next memory location. This process
continues iteratively, allowing data to be transferred from
consecutive memory locations to the remaining registers R1 through R7.
Data is stored from 01F0
Hence ORG 01F0H
That means organize from
01F0
Data is EA, EB, EC, ED, EF
F0, F1, F2
Hence
DB EAH, EBH, ECH……
Program is to be written
from memory location
0000.
Hence
ORG 000H
initializing base data pointer
to 0100
Hence
MOV DPTR,#0100H
(we will add base with F0 to
F7 to create addresses for
stored data as 01F0 to 01F7)
First we will move data located
at 01F0 to Accumulator using
MOVC A,@A+DPTR and then
from Accumulator to R0
We will repeat this procedure
for all other ROM locations and
move data of these ROM
locations to remaining registers
R1 to R7
Before Program Assembly
After Program Assembly
Before Program Run
After Program Run