Addressing Modes of 8051

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 8

Addressing Modes of 8051

Addressing modes are an aspect of the


instruction set architecture in most central
processing unit designs.

Name: Krishna Nikam


Roll no: 2020624
Subject : Microcontroller and Programming
Addressing Modes of 8051
The CPU can access data in various ways, which are called addressing
modes.
1. Immediate addressing
2. Register addressing
3. Direct addressing
4. Indirect addressing
Immediate Addressing Mode
• The source operand is constant.
• In this type of addressing mode we can load constant information to
any registers, including DPTR register
• The immediate data must be preceded by a pound sign, “#”
Syntax: INSTRUCTION DESTINATION,SOURCE
MOV R1,#25H ; load 25H into R1
MOV A,#25 ; load 25 into A
MOV DPTR,#4521H ; load 4521H into DPTR
Register Addressing Mode
• The source operands are specified by Register names.
• In this type of addressing mode, we can use registers to hold data to
which can be used further
Syntax: INSTRUCTION DESTINATION,SOURCE
MOV R0,A ; load data of A into R0
MOV A,R5 ; load data of R5 into A
MOV R0,R5 ; can’t use it’s illegal
Register Addressing Mode
MOV DPTR,A ; will give an error
MOV DPL,R0 ; load data of R0 into DPL
MOV DPH,R1 ; load data of R1 into DPH

DPTR(16) DPH(8 bit)


DPH(8 bit)
Direct Addressing Mode
• In this type of Addressing mode, data is accessed from memory
address specified as one of the operand
• It is often used to access data of memory locations
Syntax: INSTRUCTION DESTINATION,SOURCE
MOV A,55H ;load data from 55H address to A
MOV 55H,R0 ;load data of R5 to 55H
MOV A,4 ;is same as
MOV A,R4 ; load R4 to A
Indirect Addressing Mode
• In this type of Addressing mode, Address of memory location is
indirectly provided by a register
• “@” sign indicates that the register holds the address of memory lo.
Syntax: INSTRUCTION DESTINATION,SOURCE
MOV A,@R0 ; copy data on address R0 , whose address is address of R0
register
MOV @R1,80H ; copying data at 80H address to Address of R1
THANKS

You might also like