Addressing Modes of 8051
The 8051 provides a total of five distinct addressing modes.
ü register indirect
Immediate Addressing Mode
ü The operand comes immediately after the op-code.
ü The immediate data must be preceded by the pound sign, "#".
Register Addressing Mode
Register addressing mode involves the use of registers to hold the data to be manipulated
Direct Addressing Mode
ü It is most often used to access RAM locations 30 - 7FH.
ü This is due to the fact that register bank locations are accessed by the register names of R0 - R7.
ü There is no such name for other RAM locations so must use direct addressing
ü In the direct addressing mode, the data is in a RAM memory location whose address is known, and this address is given as a part of the instruction
Register Indirect Addressing Mode
ü A register is used as a pointer to the data.
ü If the data is inside the CPU, only registers R0 and R 1 are used for this purpose.
ü R2 - R7 cannot be used to hold the address of an operand located in RAM when using indirect addressing mode.
ü When RO and R 1 are used as pointers they must be preceded by the@ sign.
Indexed Addressing Mode
ü Indexed addressing mode is widely used in accessing data elements of look-up table entries located in the program ROM space of the 8051.
ü The instruction used for this purpose is : MOVC A, @ A+DPTR
ü The 16-bit register DPTR and register A are used to form the address of the data element stored in on-chip ROM.
ü Because the data elements are stored in the program (code) space ROM of the 8051, the instruction MOVC is used instead of MOV. The "C" means code.
ü In this instruction the contents of A are added to the 16-bit register DPTR to form the 16- bit address of the needed data.
Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.