Addressing Modes

Five addressing modes:
1.Immediate Addressing
2.Register
3.Direct
4.Register indirect
5.Indexed

Immediate Addressing

Data is immediately available in the instruction
Ex:   ADD A,#77
        MOV DPTR, #1000H

Bank Addressing or Register Addressing

                This addressing accesses the bytes in the current register bank.
                Data is available in the register specified in the instruction.
                (the reg bank is decided by 2 bits  of PSW.)
                Ex: ADD A,R0

Direct Addressing

                The address of the data is available in the instruction.
                Ex: MOV A,088H

Register Indirect Addressing

The address of data is available in the R0 or R1 registers as specified in the instruction.
Ex: MOV A,@R0

Indexed Addressing

      External data Addressing
                Pointer used for external data addressing can be either R0/R1  or DPTR
                Ex: MOVX  A,@R0
                                MOVX  A,@DPTR
     External code Addressing
  Sometimes we want to store non-volatile data into ROM. Such data may require reading the code memory. This may be done as follows:

              Ex:          MOVC  A,@A+DPTR
 The 16 bit regr DPTR and regr A are used to form the address of the data element stored on ROM chip.
                contents of [A + B] form the 16 bit address needed for memory access.
                The “C ” means code.
                 MOVC   A,@A+PC

No comments:

Post a Comment