SlideShare a Scribd company logo
ADDRESSING MODES &
INSTRUCTIONS SET OF
8051 MICRO CONTROLLER
Addressing modes
 Definition:-
The different ways in which a
source operand in an instruction are known
as the addressing modes.
The 8051 provides a total of 5
distinct addressing modes.
Types of Addressing modes
Addressing modes
Immediate
Addressing mode
Register
Addressing mode
Direct
Addressing mode
Register indirect
Addressing mode
Indexed
Addressing mode
Immediate addressing mode
In this addressing mode the source
operand is constant. In immediate
addressing mode, when the instruction is
assembled, the operand comes
immediately after the op-code.
 The immediate data must be
preceded by ‘#’ sign.
 This addressing mode can be used to
load information into any of the
register, including the DPTR.
Continue…
Continue…
 Ex :-
MOV A,#25H // load 25H in to A
MOV R4,#62 // load the decimal
value 62 into R4.
MOV DPTR,#4532H // DPTR=4532H.
addressingmodes8051.ppt
Register addressing mode
Register addressing mode
involves the use of registers to hold
the data to be manipulated.
Continue…
 Ex :-
MOV A,R0 // copy the contents of R0 in to
A.
MOV R2,A // copy the contents of A in to
R2.
ADD A,R5 // add the content of R5 to
content of A.
addressingmodes8051.ppt
Direct addressing mode
In direct addressing mode, the
data is in a RAM memory location whose
address is known, and this address is given
as a part of the instruction. Contrast this
with the immediate addressing mode in
which the operand itself is provided with the
instruction.
Direct addressing mode
 In this mode the operand is specified by
an 8-bit address field In the instruction.
 One can access all the 128 bytes of
internal RAM locations and each SFR.
 If the MSB bit = 0 then the location is
within on chip internal RAM. If MSB bit = 1
then the location is SFR.
12
Direct addressing mode
 The location 00h to 7Fh to address the
internal RAM .
 SFR addresses from 80h to FF h
 e.g. MOV A,40h
MOV R0,14h
13
Continue…
 Ex:-
MOV R0,40H // save content of RAM
location 40h into R0.
MOV 56H,A // save content of A in
RAM location 56H.
addressingmodes8051.ppt
addressingmodes8051.ppt
Register indirect addressing mode
 In the register indirect addressing mode,
a register is used as a pointer to the data.
 If the data is inside the CPU, only register
R0 and R1 are used for this purpose.
 In other words,R2-R7 cannot be used to
hold the address of an operand located in
RAM when using this addressing mode.
Continue…
 When R0 and R1 are used as pointers ,
that is, when they hold the address of
RAM locations , they must be preceded by
the “@” sign.
Note : only register R0 and R1 can be used
for indirect addressing mode .
MOV A,@R2 invalid instruction.
Continue…
Ex :-
MOV A,@R0 // move contents of RAM
location whose address
is held by R0 into A.
MOV @R1,B // move contents of B to
RAM location whose
address is held by R1
addressingmodes8051.ppt
External addressing mode
or Indexed addressing mode
(a) Code access (ROM access)
 Using these instructions only program
memory can be accessed.
 This addressing mode is preferred for
reading look up tables in the program
memory.
 Either DPTR or PC can be used as pointer.
21
addressingmodes8051.ppt
External addressing mode
or Indexed addressing mode
 E.g.
MOVC A,@A+DPTR
MOVC A,@A+PC
23
External addressing mode
or Indexed addressing mode
(b) Data access (RAM access)
 Using this addressing mode the programmer
can access the external Data memory
 E.g. MOVX A,@DPTR
MOVX @R0,A
Prof. Nitin Ahire 24
Continue…
 In this instruction the content of A are
added to the 16-bit register DPTR to form
the 16-bit address of the needed data.
Instruction set of 8051
8051 has simple instruction set in
different groups. There are:
 Arithmetic instructions
 Logical instructions
 Data transfer instructions
 Branching and looping instructions
 Bit control instructions
Arithmetic instructions
These instructions are used to
perform various mathematical operations
like addition, subtraction, multiplication, and
division etc.
Continue…
 ADD A, R1 // Add the content of register1
to Accumulator
 ADDC A,#2 // Add 2 to accumulator with
carry
 SUBB A,R2 // Subtract content of register2
from Accumulator
Continue…
 INC A // Increment accumulator
 DEC A // Decrement accumulator
 MUL AB // Multiply A and B
 DIV AB // Divide A by B
Logical instructions
 The logical instructions are the instructions
which are used for performing some
operations like AND, OR, NOT, X-OR and
etc., on the operands.
Continue…
 ANL A, Rn // AND register to accumulator
 ORL A, Rn // OR register to accumulator
 XRL A, Rn // Exclusive OR Reg to Acc
 CLR A // Clear Accumulator
 CPL A // Complement Accumulator
Data Transfer Instructions
 These instruction are used to transfer the
data from source operand to destination
operand. All the store, move, load,
exchange input and output instructions
belong to this to this group.
Continue…
 MOV A, Rn // Move Reg to Acc
 MOVX A,@DPTR // Move external RAM
to Accumulator
 PUSH direct // PUSH direct byte on
to stack
 POP direct // POP direct byte from
stack
Branch and Looping Instructions
 These instructions are used for both
branching as well as looping.
 These instructions include conditional &
unconditional jump or loop instructions.
Conditional Jump Instructions
 JC // Jump if carry equal to one
 JNC // Jump if carry equal to zero
 JB // Jump if bit equal to one
 JNB // Jump if bit equal to zero
 JBC // Jump if bit equal to one and clear
bit
Continue…
 JZ // Jump if A=Zero
 JNZ // Jump if A not equal to zero
 DJNZ // Decrement and Jump if not
equal to zero.
Unconditional Jump Instructions
 In 8051 there two unconditional jumps.
They are:
 SJMP // Short jump
 LJMP // Long jump

More Related Content

What's hot (20)

PPT
Logical instruction of 8085
Nemish Bhojani
 
PPTX
4.programmable dma controller 8257
MdFazleRabbi18
 
PPTX
Rs flipflop or SR flipFlop
Easy n Inspire L
 
PPT
8051 instruction set
Andri Prastiyo
 
PPTX
Instruction set of 8086
aviban
 
PPS
Timing and-control-unit
Anuj Modi
 
PPTX
8051 Microcontroller PPT's By Er. Swapnil Kaware
Prof. Swapnil V. Kaware
 
PDF
8253ppt
Bharani Samrat
 
PPTX
Encoder
Mahmudul Hasan
 
PPTX
Branching instructions in 8086 microprocessor
Rabin BK
 
PPT
pin-diagram-details-of-8086-microprocessor
barsharoy19
 
PPTX
Latches and flip flop
Shuaib Hotak
 
PPTX
Keyboard Interfacing .pptx
livaunnoor
 
PPTX
Architecture of 8085 microprocessor
AMAN SRIVASTAVA
 
PPT
Addressing modes of 8051
SARITHA REDDY
 
DOCX
8085 interfacing with memory chips
Srikrishna Thota
 
PPT
Architecture of 8086 Microprocessor
Mustapha Fatty
 
PDF
8051 Microcontroller I/O ports
anishgoel
 
PDF
PAI Unit 2 Protection in 80386 segmentation
KanchanPatil34
 
PDF
8086 modes
PDFSHARE
 
Logical instruction of 8085
Nemish Bhojani
 
4.programmable dma controller 8257
MdFazleRabbi18
 
Rs flipflop or SR flipFlop
Easy n Inspire L
 
8051 instruction set
Andri Prastiyo
 
Instruction set of 8086
aviban
 
Timing and-control-unit
Anuj Modi
 
8051 Microcontroller PPT's By Er. Swapnil Kaware
Prof. Swapnil V. Kaware
 
Branching instructions in 8086 microprocessor
Rabin BK
 
pin-diagram-details-of-8086-microprocessor
barsharoy19
 
Latches and flip flop
Shuaib Hotak
 
Keyboard Interfacing .pptx
livaunnoor
 
Architecture of 8085 microprocessor
AMAN SRIVASTAVA
 
Addressing modes of 8051
SARITHA REDDY
 
8085 interfacing with memory chips
Srikrishna Thota
 
Architecture of 8086 Microprocessor
Mustapha Fatty
 
8051 Microcontroller I/O ports
anishgoel
 
PAI Unit 2 Protection in 80386 segmentation
KanchanPatil34
 
8086 modes
PDFSHARE
 

Similar to addressingmodes8051.ppt (20)

PPT
microprocessor and microcontroller notes ppt
mananjain543
 
PPTX
MICROCONTROLLERS-module2 (7).pptx
AmoghR3
 
PPT
MC-MODULE-2.ppt includes addressing modes , instruction set etc...
ssuser15dddf
 
PPTX
addressing modes of microcontrooller 8051
divyagupta418625
 
PPT
Microcontroller instruction set
Shail Modi
 
PPT
Addressing modes
karthiga selvaraju
 
PDF
VTU 4th Semester ECE dept Microcontroller lecture slides module 2
venu242050
 
PDF
8051 instruction set
Stefan Oprea
 
PPTX
2. Instruction Set.pptx huishiuhfuidhiuhdfuhdu
mohitcool2k5
 
PPTX
module-3.pptx
Ambika Naik
 
PDF
addressing-mode-of-8051.pdf
DhilibanSwaminathan
 
PPT
8051d
Senthil Kumar
 
PDF
A Comprehensive Guide to 8051 Microcontroller Addressing Modes and Instructions
pujithakommula9
 
PDF
Lecture 4 (8051 instruction set) rv01
cairo university
 
PPTX
Addressing modes
rajukarki1599
 
PPT
Lecture_4__8051_Instruction_Set__Rv01.ppt
EngrShehzadHaneef1
 
PPTX
Mastering Assembly Language: Programming with 8086
sravanithonta79
 
PPTX
Microcontroller 8051 addressing modes
UshaRani289
 
PPT
8051d.ppt microcontroller instruction set summary
anushkayadav3011
 
PPTX
Addressing Modes
Mayank Garg
 
microprocessor and microcontroller notes ppt
mananjain543
 
MICROCONTROLLERS-module2 (7).pptx
AmoghR3
 
MC-MODULE-2.ppt includes addressing modes , instruction set etc...
ssuser15dddf
 
addressing modes of microcontrooller 8051
divyagupta418625
 
Microcontroller instruction set
Shail Modi
 
Addressing modes
karthiga selvaraju
 
VTU 4th Semester ECE dept Microcontroller lecture slides module 2
venu242050
 
8051 instruction set
Stefan Oprea
 
2. Instruction Set.pptx huishiuhfuidhiuhdfuhdu
mohitcool2k5
 
module-3.pptx
Ambika Naik
 
addressing-mode-of-8051.pdf
DhilibanSwaminathan
 
A Comprehensive Guide to 8051 Microcontroller Addressing Modes and Instructions
pujithakommula9
 
Lecture 4 (8051 instruction set) rv01
cairo university
 
Addressing modes
rajukarki1599
 
Lecture_4__8051_Instruction_Set__Rv01.ppt
EngrShehzadHaneef1
 
Mastering Assembly Language: Programming with 8086
sravanithonta79
 
Microcontroller 8051 addressing modes
UshaRani289
 
8051d.ppt microcontroller instruction set summary
anushkayadav3011
 
Addressing Modes
Mayank Garg
 
Ad

More from DhilibanSwaminathan (6)

PDF
Principles of managemen theory lecturert.pdf
DhilibanSwaminathan
 
PPTX
S1P1_Yachen_Wan ghdnsbekeksjsbsnsng.pptx
DhilibanSwaminathan
 
PPT
Embedded system and real time operating system
DhilibanSwaminathan
 
PDF
instructions set of 8051.pdf
DhilibanSwaminathan
 
PDF
pch9_03.pdf
DhilibanSwaminathan
 
PPT
12906245.ppt
DhilibanSwaminathan
 
Principles of managemen theory lecturert.pdf
DhilibanSwaminathan
 
S1P1_Yachen_Wan ghdnsbekeksjsbsnsng.pptx
DhilibanSwaminathan
 
Embedded system and real time operating system
DhilibanSwaminathan
 
instructions set of 8051.pdf
DhilibanSwaminathan
 
pch9_03.pdf
DhilibanSwaminathan
 
12906245.ppt
DhilibanSwaminathan
 
Ad

Recently uploaded (20)

PDF
Zero carbon Building Design Guidelines V4
BassemOsman1
 
PDF
AI-Driven IoT-Enabled UAV Inspection Framework for Predictive Maintenance and...
ijcncjournal019
 
PDF
All chapters of Strength of materials.ppt
girmabiniyam1234
 
PDF
SG1-ALM-MS-EL-30-0008 (00) MS - Isolators and disconnecting switches.pdf
djiceramil
 
PDF
STUDY OF NOVEL CHANNEL MATERIALS USING III-V COMPOUNDS WITH VARIOUS GATE DIEL...
ijoejnl
 
PDF
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
PDF
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
PPTX
Online Cab Booking and Management System.pptx
diptipaneri80
 
PPTX
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
PPTX
Introduction to Fluid and Thermal Engineering
Avesahemad Husainy
 
PDF
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
PPTX
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
PPTX
FUNDAMENTALS OF ELECTRIC VEHICLES UNIT-1
MikkiliSuresh
 
PDF
2025 Laurence Sigler - Advancing Decision Support. Content Management Ecommer...
Francisco Javier Mora Serrano
 
PDF
Machine Learning All topics Covers In This Single Slides
AmritTiwari19
 
PPTX
filteration _ pre.pptx 11111110001.pptx
awasthivaibhav825
 
PPTX
Basics of Auto Computer Aided Drafting .pptx
Krunal Thanki
 
PPTX
ETP Presentation(1000m3 Small ETP For Power Plant and industry
MD Azharul Islam
 
PDF
勉強会資料_An Image is Worth More Than 16x16 Patches
NABLAS株式会社
 
PDF
Packaging Tips for Stainless Steel Tubes and Pipes
heavymetalsandtubes
 
Zero carbon Building Design Guidelines V4
BassemOsman1
 
AI-Driven IoT-Enabled UAV Inspection Framework for Predictive Maintenance and...
ijcncjournal019
 
All chapters of Strength of materials.ppt
girmabiniyam1234
 
SG1-ALM-MS-EL-30-0008 (00) MS - Isolators and disconnecting switches.pdf
djiceramil
 
STUDY OF NOVEL CHANNEL MATERIALS USING III-V COMPOUNDS WITH VARIOUS GATE DIEL...
ijoejnl
 
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
Online Cab Booking and Management System.pptx
diptipaneri80
 
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
Introduction to Fluid and Thermal Engineering
Avesahemad Husainy
 
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
FUNDAMENTALS OF ELECTRIC VEHICLES UNIT-1
MikkiliSuresh
 
2025 Laurence Sigler - Advancing Decision Support. Content Management Ecommer...
Francisco Javier Mora Serrano
 
Machine Learning All topics Covers In This Single Slides
AmritTiwari19
 
filteration _ pre.pptx 11111110001.pptx
awasthivaibhav825
 
Basics of Auto Computer Aided Drafting .pptx
Krunal Thanki
 
ETP Presentation(1000m3 Small ETP For Power Plant and industry
MD Azharul Islam
 
勉強会資料_An Image is Worth More Than 16x16 Patches
NABLAS株式会社
 
Packaging Tips for Stainless Steel Tubes and Pipes
heavymetalsandtubes
 

addressingmodes8051.ppt

  • 1. ADDRESSING MODES & INSTRUCTIONS SET OF 8051 MICRO CONTROLLER
  • 2. Addressing modes  Definition:- The different ways in which a source operand in an instruction are known as the addressing modes. The 8051 provides a total of 5 distinct addressing modes.
  • 3. Types of Addressing modes Addressing modes Immediate Addressing mode Register Addressing mode Direct Addressing mode Register indirect Addressing mode Indexed Addressing mode
  • 4. Immediate addressing mode In this addressing mode the source operand is constant. In immediate addressing mode, when the instruction is assembled, the operand comes immediately after the op-code.
  • 5.  The immediate data must be preceded by ‘#’ sign.  This addressing mode can be used to load information into any of the register, including the DPTR. Continue…
  • 6. Continue…  Ex :- MOV A,#25H // load 25H in to A MOV R4,#62 // load the decimal value 62 into R4. MOV DPTR,#4532H // DPTR=4532H.
  • 8. Register addressing mode Register addressing mode involves the use of registers to hold the data to be manipulated.
  • 9. Continue…  Ex :- MOV A,R0 // copy the contents of R0 in to A. MOV R2,A // copy the contents of A in to R2. ADD A,R5 // add the content of R5 to content of A.
  • 11. Direct addressing mode In direct addressing mode, the data is in a RAM memory location whose address is known, and this address is given as a part of the instruction. Contrast this with the immediate addressing mode in which the operand itself is provided with the instruction.
  • 12. Direct addressing mode  In this mode the operand is specified by an 8-bit address field In the instruction.  One can access all the 128 bytes of internal RAM locations and each SFR.  If the MSB bit = 0 then the location is within on chip internal RAM. If MSB bit = 1 then the location is SFR. 12
  • 13. Direct addressing mode  The location 00h to 7Fh to address the internal RAM .  SFR addresses from 80h to FF h  e.g. MOV A,40h MOV R0,14h 13
  • 14. Continue…  Ex:- MOV R0,40H // save content of RAM location 40h into R0. MOV 56H,A // save content of A in RAM location 56H.
  • 17. Register indirect addressing mode  In the register indirect addressing mode, a register is used as a pointer to the data.  If the data is inside the CPU, only register R0 and R1 are used for this purpose.  In other words,R2-R7 cannot be used to hold the address of an operand located in RAM when using this addressing mode.
  • 18. Continue…  When R0 and R1 are used as pointers , that is, when they hold the address of RAM locations , they must be preceded by the “@” sign. Note : only register R0 and R1 can be used for indirect addressing mode . MOV A,@R2 invalid instruction.
  • 19. Continue… Ex :- MOV A,@R0 // move contents of RAM location whose address is held by R0 into A. MOV @R1,B // move contents of B to RAM location whose address is held by R1
  • 21. External addressing mode or Indexed addressing mode (a) Code access (ROM access)  Using these instructions only program memory can be accessed.  This addressing mode is preferred for reading look up tables in the program memory.  Either DPTR or PC can be used as pointer. 21
  • 23. External addressing mode or Indexed addressing mode  E.g. MOVC A,@A+DPTR MOVC A,@A+PC 23
  • 24. External addressing mode or Indexed addressing mode (b) Data access (RAM access)  Using this addressing mode the programmer can access the external Data memory  E.g. MOVX A,@DPTR MOVX @R0,A Prof. Nitin Ahire 24
  • 25. Continue…  In this instruction the content of A are added to the 16-bit register DPTR to form the 16-bit address of the needed data.
  • 26. Instruction set of 8051 8051 has simple instruction set in different groups. There are:  Arithmetic instructions  Logical instructions  Data transfer instructions  Branching and looping instructions  Bit control instructions
  • 27. Arithmetic instructions These instructions are used to perform various mathematical operations like addition, subtraction, multiplication, and division etc.
  • 28. Continue…  ADD A, R1 // Add the content of register1 to Accumulator  ADDC A,#2 // Add 2 to accumulator with carry  SUBB A,R2 // Subtract content of register2 from Accumulator
  • 29. Continue…  INC A // Increment accumulator  DEC A // Decrement accumulator  MUL AB // Multiply A and B  DIV AB // Divide A by B
  • 30. Logical instructions  The logical instructions are the instructions which are used for performing some operations like AND, OR, NOT, X-OR and etc., on the operands.
  • 31. Continue…  ANL A, Rn // AND register to accumulator  ORL A, Rn // OR register to accumulator  XRL A, Rn // Exclusive OR Reg to Acc  CLR A // Clear Accumulator  CPL A // Complement Accumulator
  • 32. Data Transfer Instructions  These instruction are used to transfer the data from source operand to destination operand. All the store, move, load, exchange input and output instructions belong to this to this group.
  • 33. Continue…  MOV A, Rn // Move Reg to Acc  MOVX A,@DPTR // Move external RAM to Accumulator  PUSH direct // PUSH direct byte on to stack  POP direct // POP direct byte from stack
  • 34. Branch and Looping Instructions  These instructions are used for both branching as well as looping.  These instructions include conditional & unconditional jump or loop instructions.
  • 35. Conditional Jump Instructions  JC // Jump if carry equal to one  JNC // Jump if carry equal to zero  JB // Jump if bit equal to one  JNB // Jump if bit equal to zero  JBC // Jump if bit equal to one and clear bit
  • 36. Continue…  JZ // Jump if A=Zero  JNZ // Jump if A not equal to zero  DJNZ // Decrement and Jump if not equal to zero.
  • 37. Unconditional Jump Instructions  In 8051 there two unconditional jumps. They are:  SJMP // Short jump  LJMP // Long jump