SlideShare a Scribd company logo
1 of 29
ADDRESSING MODES &
  INSTRUCTIONS SET OF
8051 MICRO CONTROLLER

                     Dr. C. Saritha
           Lecturer in Electronics
        SSBN Degree & PG College
                     ANANTAPUR
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          Register           Direct        Register indirect       Indexed
Addressing mode   Addressing mode   Addressing mode    Addressing mode     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.
Continue…

   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…
   Ex :-

    MOV A,#25H      // load 25H in to A
    MOV R4,#62     // load the decimal
                      value 62 into R4.
    MOV DPTR,#4532H // DPTR=4532H.
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.
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.
Continue…
   Ex:-
    MOV R0,40H // save content of RAM
                  location 40h into R0.
    MOV 56H,A // save content of A in
                    RAM location 56H.
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.
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
              RAM location whose
              address is held by R1
Indexed addressing mode
   Indexed addressing mode is widely used in
    accessing data elements of look-up table
    entries located in the program ROM space
    of the 8051.

   The instruction used for this purpose is
    “MOV A, @A+DPTR”.
Continue…
   The 16-bit register DPTR and register “A”
    are used to form the data element stored in
    on-chip ROM.

   Because the data elements are stored in
    the program space ROM of the 8051,it uses
    the instruction MOVC instead of MOV.
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
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
Addressing modes of 8051

More Related Content

What's hot (20)

Microcontroller-8051.ppt
Microcontroller-8051.pptMicrocontroller-8051.ppt
Microcontroller-8051.ppt
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction set
 
8051 Addressing Modes
8051 Addressing Modes8051 Addressing Modes
8051 Addressing Modes
 
Interrupts in 8051
Interrupts in 8051Interrupts in 8051
Interrupts in 8051
 
MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration
 
8086 micro processor
8086 micro processor8086 micro processor
8086 micro processor
 
Interrupts of microprocessor 8085
Interrupts of microprocessor  8085Interrupts of microprocessor  8085
Interrupts of microprocessor 8085
 
8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controller8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controller
 
8085 Architecture & Memory Interfacing1
8085 Architecture & Memory Interfacing18085 Architecture & Memory Interfacing1
8085 Architecture & Memory Interfacing1
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architecture
 
ARM Processors
ARM ProcessorsARM Processors
ARM Processors
 
8085 addressing modes
8085 addressing modes8085 addressing modes
8085 addressing modes
 
8085 microprocessor ramesh gaonkar
8085 microprocessor   ramesh gaonkar8085 microprocessor   ramesh gaonkar
8085 microprocessor ramesh gaonkar
 
Timing diagram 8085 microprocessor
Timing diagram 8085 microprocessorTiming diagram 8085 microprocessor
Timing diagram 8085 microprocessor
 
Pin diagram 8085
Pin diagram 8085 Pin diagram 8085
Pin diagram 8085
 
Interrupts of 8086
Interrupts of 8086Interrupts of 8086
Interrupts of 8086
 
8051 memory
8051 memory8051 memory
8051 memory
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
 
8051 timer counter
8051 timer counter8051 timer counter
8051 timer counter
 
8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware
 

Similar to Addressing modes of 8051

microprocessor and microcontroller notes ppt
microprocessor and microcontroller notes pptmicroprocessor and microcontroller notes ppt
microprocessor and microcontroller notes pptmananjain543
 
Microcontroller 8051 addressing modes
Microcontroller 8051 addressing modes Microcontroller 8051 addressing modes
Microcontroller 8051 addressing modes UshaRani289
 
Microcontroller instruction set
Microcontroller instruction setMicrocontroller instruction set
Microcontroller instruction setShail Modi
 
Unit ii microcontrollers final
Unit ii microcontrollers finalUnit ii microcontrollers final
Unit ii microcontrollers finalSARITHA REDDY
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051Dr. AISHWARYA N
 
The 8051 microcontroller
The 8051 microcontrollerThe 8051 microcontroller
The 8051 microcontrollerPallaviHailkar
 
Addressing Modes
Addressing ModesAddressing Modes
Addressing ModesMayank Garg
 
microcontroller_instruction_set for ENGINEERING STUDENTS
microcontroller_instruction_set for  ENGINEERING STUDENTSmicrocontroller_instruction_set for  ENGINEERING STUDENTS
microcontroller_instruction_set for ENGINEERING STUDENTSssuser2b759d
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller nitugatkal
 
432_17EC563_8051-microcontroller-moving-data_notes.pdf
432_17EC563_8051-microcontroller-moving-data_notes.pdf432_17EC563_8051-microcontroller-moving-data_notes.pdf
432_17EC563_8051-microcontroller-moving-data_notes.pdfShreeKrishnaTarai
 
8051 addressing modes
8051 addressing modes8051 addressing modes
8051 addressing modessb108ec
 
MICROCONTROLLERS-module2 (7).pptx
MICROCONTROLLERS-module2 (7).pptxMICROCONTROLLERS-module2 (7).pptx
MICROCONTROLLERS-module2 (7).pptxAmoghR3
 
8051 addressing modes
8051 addressing modes8051 addressing modes
8051 addressing modesVima Mali
 

Similar to Addressing modes of 8051 (20)

microprocessor and microcontroller notes ppt
microprocessor and microcontroller notes pptmicroprocessor and microcontroller notes ppt
microprocessor and microcontroller notes ppt
 
addressingmodes8051.ppt
addressingmodes8051.pptaddressingmodes8051.ppt
addressingmodes8051.ppt
 
Microcontroller 8051 addressing modes
Microcontroller 8051 addressing modes Microcontroller 8051 addressing modes
Microcontroller 8051 addressing modes
 
Microcontroller .pptx
Microcontroller .pptxMicrocontroller .pptx
Microcontroller .pptx
 
Microcontroller instruction set
Microcontroller instruction setMicrocontroller instruction set
Microcontroller instruction set
 
Unit ii microcontrollers final
Unit ii microcontrollers finalUnit ii microcontrollers final
Unit ii microcontrollers final
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
The 8051 microcontroller
The 8051 microcontrollerThe 8051 microcontroller
The 8051 microcontroller
 
addressing-mode-of-8051.pdf
addressing-mode-of-8051.pdfaddressing-mode-of-8051.pdf
addressing-mode-of-8051.pdf
 
Addressing Modes
Addressing ModesAddressing Modes
Addressing Modes
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
microcontroller_instruction_set for ENGINEERING STUDENTS
microcontroller_instruction_set for  ENGINEERING STUDENTSmicrocontroller_instruction_set for  ENGINEERING STUDENTS
microcontroller_instruction_set for ENGINEERING STUDENTS
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller
 
432_17EC563_8051-microcontroller-moving-data_notes.pdf
432_17EC563_8051-microcontroller-moving-data_notes.pdf432_17EC563_8051-microcontroller-moving-data_notes.pdf
432_17EC563_8051-microcontroller-moving-data_notes.pdf
 
8051 addressing modes
8051 addressing modes8051 addressing modes
8051 addressing modes
 
8051 instruction_set.ppt
8051 instruction_set.ppt8051 instruction_set.ppt
8051 instruction_set.ppt
 
MICROCONTROLLERS-module2 (7).pptx
MICROCONTROLLERS-module2 (7).pptxMICROCONTROLLERS-module2 (7).pptx
MICROCONTROLLERS-module2 (7).pptx
 
8051 addressing modes
8051 addressing modes8051 addressing modes
8051 addressing modes
 
5 addressing modes
5 addressing modes5 addressing modes
5 addressing modes
 

More from SARITHA REDDY

Unit iv microcontrollers final
Unit iv microcontrollers finalUnit iv microcontrollers final
Unit iv microcontrollers finalSARITHA REDDY
 
Introduction to microprocessors notes
Introduction to microprocessors notesIntroduction to microprocessors notes
Introduction to microprocessors notesSARITHA REDDY
 
8051 data types and directives
8051 data types and directives8051 data types and directives
8051 data types and directivesSARITHA REDDY
 
Introduction to microprocessor notes
Introduction to microprocessor notesIntroduction to microprocessor notes
Introduction to microprocessor notesSARITHA REDDY
 
8051 data type and directives
8051 data type and directives8051 data type and directives
8051 data type and directivesSARITHA REDDY
 
Decimation in time and frequency
Decimation in time and frequencyDecimation in time and frequency
Decimation in time and frequencySARITHA REDDY
 
I o ports and timers of 8051
I o ports and timers of 8051I o ports and timers of 8051
I o ports and timers of 8051SARITHA REDDY
 
Mos and cmos technology
Mos and cmos technologyMos and cmos technology
Mos and cmos technologySARITHA REDDY
 
Clampers and clippers
Clampers and clippersClampers and clippers
Clampers and clippersSARITHA REDDY
 
Electro Magnetic Wave Propagation
Electro Magnetic Wave PropagationElectro Magnetic Wave Propagation
Electro Magnetic Wave PropagationSARITHA REDDY
 
Satellite communications
Satellite communicationsSatellite communications
Satellite communicationsSARITHA REDDY
 
Electronics in daily life
Electronics in daily lifeElectronics in daily life
Electronics in daily lifeSARITHA REDDY
 
BSc I year practicals
BSc I year practicalsBSc I year practicals
BSc I year practicalsSARITHA REDDY
 
Combinational circuits
Combinational circuitsCombinational circuits
Combinational circuitsSARITHA REDDY
 
Applications of op amps
Applications of op ampsApplications of op amps
Applications of op ampsSARITHA REDDY
 
Digital logic gates and Boolean algebra
Digital logic gates and Boolean algebraDigital logic gates and Boolean algebra
Digital logic gates and Boolean algebraSARITHA REDDY
 

More from SARITHA REDDY (20)

Unit iv microcontrollers final
Unit iv microcontrollers finalUnit iv microcontrollers final
Unit iv microcontrollers final
 
Introduction to microprocessors notes
Introduction to microprocessors notesIntroduction to microprocessors notes
Introduction to microprocessors notes
 
8051 data types and directives
8051 data types and directives8051 data types and directives
8051 data types and directives
 
Introduction to microprocessor notes
Introduction to microprocessor notesIntroduction to microprocessor notes
Introduction to microprocessor notes
 
8051 data type and directives
8051 data type and directives8051 data type and directives
8051 data type and directives
 
Decimation in time and frequency
Decimation in time and frequencyDecimation in time and frequency
Decimation in time and frequency
 
RT linux
RT linuxRT linux
RT linux
 
I o ports and timers of 8051
I o ports and timers of 8051I o ports and timers of 8051
I o ports and timers of 8051
 
Mos and cmos technology
Mos and cmos technologyMos and cmos technology
Mos and cmos technology
 
Logic families
Logic familiesLogic families
Logic families
 
Clampers and clippers
Clampers and clippersClampers and clippers
Clampers and clippers
 
Linked lists
Linked listsLinked lists
Linked lists
 
Arrays
ArraysArrays
Arrays
 
Electro Magnetic Wave Propagation
Electro Magnetic Wave PropagationElectro Magnetic Wave Propagation
Electro Magnetic Wave Propagation
 
Satellite communications
Satellite communicationsSatellite communications
Satellite communications
 
Electronics in daily life
Electronics in daily lifeElectronics in daily life
Electronics in daily life
 
BSc I year practicals
BSc I year practicalsBSc I year practicals
BSc I year practicals
 
Combinational circuits
Combinational circuitsCombinational circuits
Combinational circuits
 
Applications of op amps
Applications of op ampsApplications of op amps
Applications of op amps
 
Digital logic gates and Boolean algebra
Digital logic gates and Boolean algebraDigital logic gates and Boolean algebra
Digital logic gates and Boolean algebra
 

Addressing modes of 8051

  • 1. ADDRESSING MODES & INSTRUCTIONS SET OF 8051 MICRO CONTROLLER Dr. C. Saritha Lecturer in Electronics SSBN Degree & PG College ANANTAPUR
  • 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 Register Direct Register indirect Indexed Addressing mode Addressing mode Addressing mode Addressing mode 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. Continue…  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.
  • 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.
  • 7. Register addressing mode Register addressing mode involves the use of registers to hold the data to be manipulated.
  • 8. 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.
  • 9. 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.
  • 10. Continue…  Ex:- MOV R0,40H // save content of RAM location 40h into R0. MOV 56H,A // save content of A in RAM location 56H.
  • 11. 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.
  • 12. 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.
  • 13. 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 RAM location whose address is held by R1
  • 14. Indexed addressing mode  Indexed addressing mode is widely used in accessing data elements of look-up table entries located in the program ROM space of the 8051.  The instruction used for this purpose is “MOV A, @A+DPTR”.
  • 15. Continue…  The 16-bit register DPTR and register “A” are used to form the data element stored in on-chip ROM.  Because the data elements are stored in the program space ROM of the 8051,it uses the instruction MOVC instead of MOV.
  • 16. 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.
  • 17. 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
  • 18. Arithmetic instructions These instructions are used to perform various mathematical operations like addition, subtraction, multiplication, and division etc.
  • 19. 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
  • 20. Continue…  INC A // Increment accumulator  DEC A // Decrement accumulator
  • 21. 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.
  • 22. 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
  • 23. 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.
  • 24. 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
  • 25. Branch and Looping Instructions  These instructions are used for both branching as well as looping.  These instructions include conditional & unconditional jump or loop instructions.
  • 26. 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
  • 27. Continue…  JZ // Jump if A=Zero  JNZ // Jump if A not equal to zero  DJNZ // Decrement and Jump if not equal to zero.
  • 28. Unconditional Jump Instructions  In 8051 there two unconditional jumps. They are:  SJMP // Short jump  LJMP // Long jump