Addressing mode

9,195 views

Published on

Published in: Education
  • Be the first to comment

Addressing mode

  1. 1. ADDRESSING MODE<br />8051<br /> WWW.USTUDY.IN<br />
  2. 2. Out line<br />Introduction<br />Immediate addressing mode<br />Direct addressing mode<br />Register addressing mode<br />Indirect addressing mode<br /> WWW.USTUDY.IN<br />
  3. 3. Introduction<br />Addressing modes are an aspect of the instruction set architecture in most central processing unit (CPU) designs. The various addressing modes that are defined in a given instruction set architecture define how machine language instructions in that architecture identify the operand (or operands) of each instruction. An addressing mode specifies how to calculate the effective memory address of an operand by using information held in registers and/or constants contained within a machine instruction or elsewhere.<br /> WWW.USTUDY.IN<br />
  4. 4. The most common addressing modes are:<br />Immediate addressing mode<br />Direct addressing mode<br />Indirect addressing mode<br />Register addressing mode<br />Register indirect addressing mode<br />Displacement addressing mode<br />Stack addressing mode<br /> WWW.USTUDY.IN<br />
  5. 5. Immediate Addressing Modes<br />The simplest way to get data to a destination is to make the source of the data part of the opcode. The data source is then immediately available as part of the instruction itself.<br />When the 8051 executes an immediate data move, the program counter is automatically incremented to point to the bytes following the opcode byte in the program memory. Whatever data is found there is copied to the destination address.<br /> WWW.USTUDY.IN<br />
  6. 6. Immediate Mode – specify data by its value<br />mov a, #0 ;put 0 in the accumulator<br />a = 00000000<br />mov a, #0x11 ; put 11hex in the accumulator<br />a = 00010001<br />mova, #77h ; put 77 hex in accumulator<br />a = 01110111<br />Immediate Addressing Modes<br /> WWW.USTUDY.IN<br />
  7. 7. Direct addressing mode<br />Direct addressing is so-named because the value to be stored in memory is obtained by directly retrieving it from another memory location. <br />Example:<br />MOV R0, 40H<br />MOV 56H,A<br />MOV A, 4 ; ≡ MOV A, R4<br />MOV 6, 2 ; copy R2 to R6<br /> ; MOV R6,R2 is invalid !<br /> WWW.USTUDY.IN<br />
  8. 8. Register Addressing Mode<br />Certain register names may be used as part of the opcode mnemonic as sources or destinations of data. Registers A, DPTR, and R0 to R7 may be named as part of the opcode mnemonic. <br />Other registers in the 8051 may be addressed using the direct addressing mode.<br />Example: ADD A,R7<br />The opcode is 00101111. 00101 indicates the instruction and the three lower bits, 111, specify the register Some instructions are specific to a certain register, such as the accumulator, data pointer etc.<br /> WWW.USTUDY.IN<br />
  9. 9. Indirect addressing mode<br />Indirect addressing is a very powerful addressing mode which in many cases provides an exceptional level of flexibility. Indirect addressing is also the only way to access the extra 128 bytes of Internal RAM found on an 8052. <br />Example<br /> MOV A,@R0<br /> WWW.USTUDY.IN<br />
  10. 10. The End<br />… Thank u….<br /> WWW.USTUDY.IN<br />

×