SlideShare a Scribd company logo
2
Most read
9
Most read
10
Most read
8051 ADDRESSING MODES
Prepared by
Vima Mali
8051 Registers
D7 D6 D5 D4 D3 D2 D1 D0
DPTR
PC PC (Program counter)
DPH DPL
8 bit Registers of the 8051
8051 16 bit Registers
8 bit Registers
R6
R5
R4
R3
R2
R1
R0
B
A
R7
ADDRESSING MODES OF 8051
1. Immediate addressing
2. Register addressing
3. Direct addressing
4. Register indirect addressing
5. Indexed addressing
6. Relative addressing
7. Absolute addressing
8. Long addressing
9. Inherent addressing
10.Bit Inherent addressing
11. Bit Direct addressing
12. Stack addressing mode
Immediate Addressing Mode
MOV A, #25H ;load 25H into A
MOV R4, #62 ;load the decimal value 62 into R4
MOV B, #40H ;load 40H into B
MOV DPTR, #4521H ;DPTR=4521H
MOV DPTR, #2550H ;is the same as:
MOV DPL, #50H
MOV DPH, #25H
Register Addressing Mode
MOV A,R0 ;copy the contents of R0 into A
MOV R2,A ;copy the contents of A into R2
ADD A,R5 ;add the contents of R5 to contents of A
ADD A,R7 ;add the contents of R7 to contents of A
MOV R6,A ;save accumulator in R6
MOV DPTR,#25F5H
MOV R7,DPL
MOV R6,DPH
Direct Addressing Mode
MOV R0,40H ;save content of RAM location 40H in R0
MOV R4,7FH ;move contents of RAM location 7FH to R4
MOV A,4
MOV A,7
ADD A, 50
MOV A,2 ;is the same as
MOV A,R2 ;which means copy R2 into A
MOV A,0 ;is the same as
MOV A,R0 ;which means copy R0 into A
MOV R2,#5 ;R2=05
Register Indirect Addressing Mode
• Only R0, R1 &DPTR are the only registers that can be used
for pointers in register indirect addressing mode.
MOV A,@R0 ;move contents of RAM location whose
address is held by R0 into A
MOV @R1,B ;move contents of B into RAM location
whose address is held by R1
MOVX A,@DPTR ; copy the contents of external data memory
pointed by DPTR into the accumulator.
Indexed Addressing Mode
• It uses DPTR as a reference.
• 16 bits
MOVC A, @A+DPTR
MOVC A, @A+PC ; “C” means program
(code) space ROM
Relative addressing
 It is used for short JMP(Jump) and short
Call(8-bit) instructions in 8051 use the relative
addressing.
In relative addressing, a new program address
is not directed specified.
It is specified as PC+offset gives the new
program address.
For Ex: 2000: JMP 20
Absolute Addressing
• The addressing mode is similar to that of relative
addressing expect the offset length.
• Here, the offset is 11-bit instead of 8-bit in case of
relative addressing.
• The 11-bit offset gives an address range of from
0000H to 07FFH.
For example: AJMP NEXT
ACALL SUB1
Long addressing
 In long addressing mode (LJMP or LCALL) is
specified as entire new 16-bit address.
Since address is 16-bit, a jump or a call can be
made to a location within a 64-kbytes(0000-
FFFFH) code memory space.
For Example: LJMP 2000H
LCALL 3000H
Inherent addressing
 Inherent addressing refers to a specific register
such a accumulator or DPTR.
For ex: SWAP A
Bit Inherent Addressing
• Bit inherent addressing works on any single
bit.
For example: 1.CLR C
2.CPL C
Bit Direct addressing
• The RAM address space from 20H to 2FH and
some Special Function Registers(SFRs) are bit
addressable.
For Ex: SETB 06H
CLR P1.2
Stack Addressing Mode
• It is subtype of direct addressing mode in which
stack instructions(PUSH and POP) are used.
• Instruction such as “PUSH A” is invalid. Here,
we have to specify the address of register A.
For example:
1. PUSH 04 ; Push R4 onto stack
2. PUSH 06 ; Push R6 onto stack
3. POP 02 ; Pop top of stack into R2
4. POP 0F0H ; Pop top of stack into register B

More Related Content

What's hot (20)

PPTX
integrator and differentiator op-amp
danish iqbal
 
PPT
Addressing mode and instruction set using 8051
logesh waran
 
PPTX
Interrupts in 8051
Sudhanshu Janwadkar
 
PPT
UNIT III PROGRAMMABLE PERIPHERAL INTERFACE
ravis205084
 
PPTX
PIC-18 Microcontroller
ASHISH RANJAN
 
PPT
Addressing modes
karthiga selvaraju
 
PPTX
Addressing modes of 8086
Dr. AISHWARYA N
 
PPTX
8051 Assembly Language Programming
Ravikumar Tiwari
 
PPTX
Instruction set of 8086
9840596838
 
PPTX
23. serial and parallel data communication
sandip das
 
PPTX
Branch instructions in 8051 micrcocontroller
UshaRani289
 
PPTX
Serial Communication in 8051
Sudhanshu Janwadkar
 
PPTX
Magic tee
saniya shaikh
 
PPT
Programming 8051 Timers
ViVek Patel
 
PPT
8255 presentaion.ppt
kamlesh deshmukh
 
PDF
8085 microprocessor ramesh gaonkar
SAQUIB AHMAD
 
PPT
8085-microprocessor
ATTO RATHORE
 
PPTX
SHLD and LHLD instruction
Romilkumar Siddhapura
 
PPTX
Addressing modes 8085
ShivamSood22
 
integrator and differentiator op-amp
danish iqbal
 
Addressing mode and instruction set using 8051
logesh waran
 
Interrupts in 8051
Sudhanshu Janwadkar
 
UNIT III PROGRAMMABLE PERIPHERAL INTERFACE
ravis205084
 
PIC-18 Microcontroller
ASHISH RANJAN
 
Addressing modes
karthiga selvaraju
 
Addressing modes of 8086
Dr. AISHWARYA N
 
8051 Assembly Language Programming
Ravikumar Tiwari
 
Instruction set of 8086
9840596838
 
23. serial and parallel data communication
sandip das
 
Branch instructions in 8051 micrcocontroller
UshaRani289
 
Serial Communication in 8051
Sudhanshu Janwadkar
 
Magic tee
saniya shaikh
 
Programming 8051 Timers
ViVek Patel
 
8255 presentaion.ppt
kamlesh deshmukh
 
8085 microprocessor ramesh gaonkar
SAQUIB AHMAD
 
8085-microprocessor
ATTO RATHORE
 
SHLD and LHLD instruction
Romilkumar Siddhapura
 
Addressing modes 8085
ShivamSood22
 

Similar to 8051 addressing modes (20)

PPTX
addressing modes of microcontrooller 8051
divyagupta418625
 
PPT
addressingmodes8051.ppt
DhilibanSwaminathan
 
PPTX
8051 addressing modes & instruction set
Manoj Babar
 
PDF
A Comprehensive Guide to 8051 Microcontroller Addressing Modes and Instructions
pujithakommula9
 
PDF
8051 instruction set
Stefan Oprea
 
PPTX
Addressing Modes of 8051.pptx
TumkurInfomedia
 
PPTX
Microcontroller .pptx
KIRUTHIKA
 
PPTX
Addressing Modes
Mayank Garg
 
PPTX
2. Instruction Set.pptx huishiuhfuidhiuhdfuhdu
mohitcool2k5
 
PPTX
Addressing modes of 8051
Bharath Reddy
 
PDF
unit5_8051_microcontroller presentation.pdf
tchandoo1
 
PPTX
MICROCONTROLLERS-module2 (7).pptx
AmoghR3
 
PPT
8051 addressing modes
ghoshshweta
 
PPT
8051 Addressing Modes
Senthil Kumar
 
PDF
VTU 4th Semester ECE dept Microcontroller lecture slides module 2
venu242050
 
PDF
addressing-mode-of-8051.pdf
DhilibanSwaminathan
 
PPTX
Addressing modes
RAMESHBABUA3
 
PPT
microprocessor and microcontroller notes ppt
mananjain543
 
PDF
Lecture 4 (8051 instruction set) rv01
cairo university
 
PPT
Lecture_4__8051_Instruction_Set__Rv01.ppt
EngrShehzadHaneef1
 
addressing modes of microcontrooller 8051
divyagupta418625
 
addressingmodes8051.ppt
DhilibanSwaminathan
 
8051 addressing modes & instruction set
Manoj Babar
 
A Comprehensive Guide to 8051 Microcontroller Addressing Modes and Instructions
pujithakommula9
 
8051 instruction set
Stefan Oprea
 
Addressing Modes of 8051.pptx
TumkurInfomedia
 
Microcontroller .pptx
KIRUTHIKA
 
Addressing Modes
Mayank Garg
 
2. Instruction Set.pptx huishiuhfuidhiuhdfuhdu
mohitcool2k5
 
Addressing modes of 8051
Bharath Reddy
 
unit5_8051_microcontroller presentation.pdf
tchandoo1
 
MICROCONTROLLERS-module2 (7).pptx
AmoghR3
 
8051 addressing modes
ghoshshweta
 
8051 Addressing Modes
Senthil Kumar
 
VTU 4th Semester ECE dept Microcontroller lecture slides module 2
venu242050
 
addressing-mode-of-8051.pdf
DhilibanSwaminathan
 
Addressing modes
RAMESHBABUA3
 
microprocessor and microcontroller notes ppt
mananjain543
 
Lecture 4 (8051 instruction set) rv01
cairo university
 
Lecture_4__8051_Instruction_Set__Rv01.ppt
EngrShehzadHaneef1
 
Ad

More from Vima Mali (11)

PPT
Active and reactive power and its equations
Vima Mali
 
PPTX
KVL_Lecture _ Elements of Electrical Engineering
Vima Mali
 
PPTX
DC circuits_ nortons theorem_problems_meaning
Vima Mali
 
PPTX
Timers
Vima Mali
 
PPT
Illumination
Vima Mali
 
PPT
Grounding
Vima Mali
 
PPTX
Energy
Vima Mali
 
PPT
Electrical safety
Vima Mali
 
PPTX
Efficient lighting
Vima Mali
 
PPTX
Domestic wiring
Vima Mali
 
PPTX
7 quality control tools
Vima Mali
 
Active and reactive power and its equations
Vima Mali
 
KVL_Lecture _ Elements of Electrical Engineering
Vima Mali
 
DC circuits_ nortons theorem_problems_meaning
Vima Mali
 
Timers
Vima Mali
 
Illumination
Vima Mali
 
Grounding
Vima Mali
 
Energy
Vima Mali
 
Electrical safety
Vima Mali
 
Efficient lighting
Vima Mali
 
Domestic wiring
Vima Mali
 
7 quality control tools
Vima Mali
 
Ad

Recently uploaded (20)

PDF
NOISE CONTROL ppt - SHRESTH SUDHIR KOKNE
SHRESTHKOKNE
 
PDF
SMART HOME AUTOMATION PPT BY - SHRESTH SUDHIR KOKNE
SHRESTHKOKNE
 
PPTX
Fluid statistics and Numerical on pascal law
Ravindra Kolhe
 
PDF
SG1-ALM-MS-EL-30-0008 (00) MS - Isolators and disconnecting switches.pdf
djiceramil
 
PPTX
NEBOSH HSE Process Safety Management Element 1 v1.pptx
MohamedAli92947
 
PPTX
Precedence and Associativity in C prog. language
Mahendra Dheer
 
PPTX
Introduction to Fluid and Thermal Engineering
Avesahemad Husainy
 
PDF
Web Technologies - Chapter 3 of Front end path.pdf
reemaaliasker
 
PPTX
Ground improvement techniques-DEWATERING
DivakarSai4
 
PDF
MRI Tool Kit E2I0500BC Plus Presentation
Ing. Ph. J. Daum GmbH & Co. KG
 
PPTX
cybersecurityandthe importance of the that
JayachanduHNJc
 
PDF
Geothermal Heat Pump ppt-SHRESTH S KOKNE
SHRESTHKOKNE
 
PPT
IISM Presentation.ppt Construction safety
lovingrkn
 
PDF
Non Text Magic Studio Magic Design for Presentations L&P.pdf
rajpal7872
 
PPTX
ETP Presentation(1000m3 Small ETP For Power Plant and industry
MD Azharul Islam
 
PPTX
Unit 2 Theodolite and Tachometric surveying p.pptx
satheeshkumarcivil
 
PPTX
Water resources Engineering GIS KRT.pptx
Krunal Thanki
 
PDF
勉強会資料_An Image is Worth More Than 16x16 Patches
NABLAS株式会社
 
PDF
The Complete Guide to the Role of the Fourth Engineer On Ships
Mahmoud Moghtaderi
 
PDF
Natural Language processing and web deigning notes
AnithaSakthivel3
 
NOISE CONTROL ppt - SHRESTH SUDHIR KOKNE
SHRESTHKOKNE
 
SMART HOME AUTOMATION PPT BY - SHRESTH SUDHIR KOKNE
SHRESTHKOKNE
 
Fluid statistics and Numerical on pascal law
Ravindra Kolhe
 
SG1-ALM-MS-EL-30-0008 (00) MS - Isolators and disconnecting switches.pdf
djiceramil
 
NEBOSH HSE Process Safety Management Element 1 v1.pptx
MohamedAli92947
 
Precedence and Associativity in C prog. language
Mahendra Dheer
 
Introduction to Fluid and Thermal Engineering
Avesahemad Husainy
 
Web Technologies - Chapter 3 of Front end path.pdf
reemaaliasker
 
Ground improvement techniques-DEWATERING
DivakarSai4
 
MRI Tool Kit E2I0500BC Plus Presentation
Ing. Ph. J. Daum GmbH & Co. KG
 
cybersecurityandthe importance of the that
JayachanduHNJc
 
Geothermal Heat Pump ppt-SHRESTH S KOKNE
SHRESTHKOKNE
 
IISM Presentation.ppt Construction safety
lovingrkn
 
Non Text Magic Studio Magic Design for Presentations L&P.pdf
rajpal7872
 
ETP Presentation(1000m3 Small ETP For Power Plant and industry
MD Azharul Islam
 
Unit 2 Theodolite and Tachometric surveying p.pptx
satheeshkumarcivil
 
Water resources Engineering GIS KRT.pptx
Krunal Thanki
 
勉強会資料_An Image is Worth More Than 16x16 Patches
NABLAS株式会社
 
The Complete Guide to the Role of the Fourth Engineer On Ships
Mahmoud Moghtaderi
 
Natural Language processing and web deigning notes
AnithaSakthivel3
 

8051 addressing modes

  • 2. 8051 Registers D7 D6 D5 D4 D3 D2 D1 D0 DPTR PC PC (Program counter) DPH DPL 8 bit Registers of the 8051 8051 16 bit Registers 8 bit Registers R6 R5 R4 R3 R2 R1 R0 B A R7
  • 3. ADDRESSING MODES OF 8051 1. Immediate addressing 2. Register addressing 3. Direct addressing 4. Register indirect addressing 5. Indexed addressing 6. Relative addressing 7. Absolute addressing 8. Long addressing 9. Inherent addressing 10.Bit Inherent addressing 11. Bit Direct addressing 12. Stack addressing mode
  • 4. Immediate Addressing Mode MOV A, #25H ;load 25H into A MOV R4, #62 ;load the decimal value 62 into R4 MOV B, #40H ;load 40H into B MOV DPTR, #4521H ;DPTR=4521H MOV DPTR, #2550H ;is the same as: MOV DPL, #50H MOV DPH, #25H
  • 5. Register Addressing Mode MOV A,R0 ;copy the contents of R0 into A MOV R2,A ;copy the contents of A into R2 ADD A,R5 ;add the contents of R5 to contents of A ADD A,R7 ;add the contents of R7 to contents of A MOV R6,A ;save accumulator in R6 MOV DPTR,#25F5H MOV R7,DPL MOV R6,DPH
  • 6. Direct Addressing Mode MOV R0,40H ;save content of RAM location 40H in R0 MOV R4,7FH ;move contents of RAM location 7FH to R4 MOV A,4 MOV A,7 ADD A, 50
  • 7. MOV A,2 ;is the same as MOV A,R2 ;which means copy R2 into A MOV A,0 ;is the same as MOV A,R0 ;which means copy R0 into A MOV R2,#5 ;R2=05
  • 8. Register Indirect Addressing Mode • Only R0, R1 &DPTR are the only registers that can be used for pointers in register indirect addressing mode. MOV A,@R0 ;move contents of RAM location whose address is held by R0 into A MOV @R1,B ;move contents of B into RAM location whose address is held by R1 MOVX A,@DPTR ; copy the contents of external data memory pointed by DPTR into the accumulator.
  • 9. Indexed Addressing Mode • It uses DPTR as a reference. • 16 bits MOVC A, @A+DPTR MOVC A, @A+PC ; “C” means program (code) space ROM
  • 10. Relative addressing  It is used for short JMP(Jump) and short Call(8-bit) instructions in 8051 use the relative addressing. In relative addressing, a new program address is not directed specified. It is specified as PC+offset gives the new program address. For Ex: 2000: JMP 20
  • 11. Absolute Addressing • The addressing mode is similar to that of relative addressing expect the offset length. • Here, the offset is 11-bit instead of 8-bit in case of relative addressing. • The 11-bit offset gives an address range of from 0000H to 07FFH. For example: AJMP NEXT ACALL SUB1
  • 12. Long addressing  In long addressing mode (LJMP or LCALL) is specified as entire new 16-bit address. Since address is 16-bit, a jump or a call can be made to a location within a 64-kbytes(0000- FFFFH) code memory space. For Example: LJMP 2000H LCALL 3000H
  • 13. Inherent addressing  Inherent addressing refers to a specific register such a accumulator or DPTR. For ex: SWAP A
  • 14. Bit Inherent Addressing • Bit inherent addressing works on any single bit. For example: 1.CLR C 2.CPL C
  • 15. Bit Direct addressing • The RAM address space from 20H to 2FH and some Special Function Registers(SFRs) are bit addressable. For Ex: SETB 06H CLR P1.2
  • 16. Stack Addressing Mode • It is subtype of direct addressing mode in which stack instructions(PUSH and POP) are used. • Instruction such as “PUSH A” is invalid. Here, we have to specify the address of register A. For example: 1. PUSH 04 ; Push R4 onto stack 2. PUSH 06 ; Push R6 onto stack 3. POP 02 ; Pop top of stack into R2 4. POP 0F0H ; Pop top of stack into register B