There are six types of addressing modes of 8051:
- Immediate Addressing Mode
- Register Addressing Mode
- Direct Addressing Mode
- Register Indirect Addressing Mode
- Indexed Addressing Mode
- Implied Addressing Mode
1. Immediate Addressing Mode:
The addressing mode in which the data operand is a part of the instruction itself is known as immediate addressing mode.
MOVR3, #45H;
The # symbol is used for immediate data.
2. Register Addressing Mode:
Here, the register is the source of the operand for an instruction i.e. In the register addressing mode the source or destination data should be present in a register (R0 to R7).
MOVR2, #45H;
3. Direct Addressing Mode:
The addressing mode in which the effective address of the memory location is written directly in the instruction is called as direct addressing mode.
MOV80H, R6;
This instruction will send the content of register R6 to port P0 (Address of Port 0 is 80H).
4. Register Indirect Addressing Mode:
In this mode, the source or destination address is given in the register. By using register indirect addressing mode, the internal or external addresses can be accessed. The R0 and R1 are used for 8-bit addresses, and DPTR is used for 16-bit addresses, no other registers can be used for addressing purposes.
MOV0E5H, @R0;
In this instruction, the @ symbol is used for register indirect addressing.
5. Indexed Addressing Mode:
In the indexed addressing mode, the source memory can only be accessed from program memory only. The destination operand is always the register A.
MOVCA, @A+PC;
The C in MOVC instruction refers to code byte. For this instruction, let us consider A holds 30H. And the PC value is1125H. The contents of program memory location 1155H (30H + 1125H) are moved to register A.
6. Implied Addressing Mode:
In the implied addressing mode, there will be a single operand. These types of instruction can work on specific registers only. These types of instructions are also known as register specific instruction.
RLA;
This is a 1-byte instruction. This instruction rotates the A register content to the left.