Addressing mode of 8051


Published on

Addressing mode of 8051 micro controller

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Addressing mode of 8051

  1. 1. Nitin Ahire XIE,Mahim Prof. Nitin Ahire 1
  2. 2.  The CPU can access data various ways  The data could be in a register, or memory or as an immediate value  The various ways of accessing data are called addressing modes. Prof. Nitin Ahire 2
  3. 3. 1)Direct addressing mode 2)Indirect addressing mode 3)Register addressing 4)Register specific addressing (optional) 5)Immediate addressing 6)External Addressing ( Index ) a) Code access b) Data access Prof. Nitin Ahire 3
  4. 4.  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. Prof. Nitin Ahire 4
  5. 5.  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 Prof. Nitin Ahire 5
  6. 6.  In this addressing mode, the instruction specifics a register which contains address of an operand i.e. the register hold the actual address that will be used in the data move operation.  The R0 and R1 of each bank can be used as an index or pointer to memory location Prof. Nitin Ahire 6
  7. 7.  The sign @ indicates the register acts as a pointer to memory locations  E.g. MOV A,@ R1 Note : only register R0 and R1 can be used for indirect addressing mode . MOV A,@R2 invalid instruction. Prof. Nitin Ahire 7
  8. 8.  Each bank consist of register R0 to R7 can be used as general purpose register for selection of bank register, the user has to modify the two bits of PSW  These register can be used to stored the address or data in the register addressing mode Prof. Nitin Ahire 8
  9. 9.  E.g. MOV R2,A MOV A, R1 MOV A,R7 Note: MOV R2,R7 is an invalid instruction Prof. Nitin Ahire 9
  10. 10.  In this addressing mode the instruction refer to a specific registers such as accumulator or data pointer  Example: DA A SWAP A Prof. Nitin Ahire 10
  11. 11.  This method is the simplest method to get the data.  In this addressing mode the source operand is a constant rather then a variable.  As the data source is a part of instruction  The # sign indicates that the data followed is immediate operand. Prof. Nitin Ahire 11
  12. 12.  E.g. MOV A,#30h MOV P1,#0FF MOV DPTR, #1234h Prof. Nitin Ahire 12
  13. 13. (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. Prof. Nitin Ahire 13
  14. 14.  E.g. MOVC A,@A+DPTR MOVC A,@A+PC Prof. Nitin Ahire 14
  15. 15. (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 15