2. Out line Introduction Immediate addressing mode Direct addressing mode Register addressing mode Indirect addressing mode WWW.USTUDY.IN
3. Introduction 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. WWW.USTUDY.IN
4. The most common addressing modes are: Immediate addressing mode Direct addressing mode Indirect addressing mode Register addressing mode Register indirect addressing mode Displacement addressing mode Stack addressing mode WWW.USTUDY.IN
5. Immediate Addressing Modes 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. 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. WWW.USTUDY.IN
6. Immediate Mode – specify data by its value mov a, #0 ;put 0 in the accumulator a = 00000000 mov a, #0x11 ; put 11hex in the accumulator a = 00010001 mova, #77h ; put 77 hex in accumulator a = 01110111 Immediate Addressing Modes WWW.USTUDY.IN
7. Direct addressing mode Direct addressing is so-named because the value to be stored in memory is obtained by directly retrieving it from another memory location. Example: MOV R0, 40H MOV 56H,A MOV A, 4 ; ≡ MOV A, R4 MOV 6, 2 ; copy R2 to R6 ; MOV R6,R2 is invalid ! WWW.USTUDY.IN
8. Register Addressing Mode 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. Other registers in the 8051 may be addressed using the direct addressing mode. Example: ADD A,R7 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. WWW.USTUDY.IN
9. Indirect addressing mode 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. Example MOV A,@R0 WWW.USTUDY.IN