0% found this document useful (0 votes)
32 views9 pages

Data Mov Inst 8051

This document discusses data movement instructions for the 8051 microcontroller. It describes MOV instructions to transfer data between registers, RAM, and SFRs. It also covers MOVC to move from program memory, MOVX for external memory, PUSH/POP for the stack, XCH to exchange values, and XCHD to exchange nibbles.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views9 pages

Data Mov Inst 8051

This document discusses data movement instructions for the 8051 microcontroller. It describes MOV instructions to transfer data between registers, RAM, and SFRs. It also covers MOVC to move from program memory, MOVX for external memory, PUSH/POP for the stack, XCH to exchange values, and XCHD to exchange nibbles.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Data movement instructions

Of 8051
Memory organization of 8051
Program Memory
7 0
FFFF 7 0
FFFF
60 K
1000
External 64 K • All instructions
OR External
0FFF
• Constant Data
4K 0000 •Look up tables
0000 Internal
•Jump tables
if EA = HI if EA = LO • Using MOVC

Data Memory FFFF


AND
FF SFRs
80 64 K
• Any data
7F RAM External •Using MOV ( internal memory)
00
Internal • Using MOVX ( external memory)
0000
Direct
Direct , Register,
Reg. Indirect
Data Transfer Instructions
• MOV
• 8-bit data transfer for internal RAM and the SFR.

MOV A, Rn MOV Rn, A


MOV A, direct MOV Rn, direct
MOV A, @Ri MOV Rn, #data
MOV A, #data

MOV direct, #data


MOV @Ri, A MOV direct, A
MOV @Ri, direct MOV direct, Rn
MOV @Ri, #data MOV direct, direct
MOV direct, @Ri
Data Transfer Instructions
• MOVC
• Move Code Byte to the accumulator
• Load the accumulator with a byte from program memory.
• Only one way data transfer possible
• Must use indexed addressing
• Only two instructions of 8051 can read from code
memory
▪ MOVC A, @A+DPTR
▪ MOVC A, @A+PC
Data Transfer Instructions
• MOVX
• Data transfer between the accumulator and a byte from external
data memory.
• Only register indirect addressing mode is supported.
• Move data from external data memory to accumulator
• MOVX A, @Ri
• MOVX A, @DPTR
• Move data from accumulator to external data memory
• MOVX @Ri, A
• MOVX @DPTR, A
Data Transfer Instructions
• PUSH / POP
• Push; write a data byte on the stack.
• Pop; read a data byte from the stack.
• The data byte is identified by a direct address from the internal RAM
locations.

• Examples:

• PUSH DPL
• PUSH 56H
• POP 40H
Data Transfer Instructions
• XCH
• Exchange accumulator and a byte variable
• XCH A, Rn
• XCH A, direct
• XCH A, @Ri

• XCHD
• Exchange lower digit of accumulator with the lower digit of the
memory location specified.
• XCHD A, @Ri
• The lower 4-bits of the accumulator are exchanged with the lower 4-
bits of the internal memory location identified indirectly by the index
register.
• The upper 4-bits of each are not modified.
8051 Data Movement - summary
MOV A, # MOV R, #
D D
R
A
@R

MOV D, # MOV @R, #


D D
R A
@R
A
8051 Data Movement - summary
Move From Program Memory
MOVC A, @A+DPTR Acc Rom(A+DPTR)
A, @A+PC Acc Rom(A+PC)

Move between External Data RAM and Others


accumulator PUSH D
MOVX A, @R POP D
A, @DPTR
MOVX @R, A XCH A, R
D
@DPTR, A
@R
SWAP Rn Acc Rn
XCHD A , @R

You might also like