8051 Addressing Modes:
The 8051 Addressing Modes architecture supports several distinct physical address spaces.
On – chip program memory
On – chip data memory
External program memory
External data memory
On-chip special function registers
The most of the instructions can operate with variables from these physical address spaces.. Now we will see how to access variables from different physical and logical address spaces with the help of different Addressing modes.
Register Addressing :
The 8051 can access eight “working registers” (R0—R7). Three bit code within the instruction selects one of the eight registers from the selected register The programmer can select a register bank by modifying bits 4 and 3 in the PSW.
Direct Byte Addressing :
Direct addressing can access any on chip variable or hardware register. i.e. on chip RAM and special function register. The most significant bit of the address decides whether it is a location within on chip RAM (MSB = 0) or in special function register (MSB = 1).
Register Indirect Addressing :
In this addressing mode R0 and R1 of each register bank can be used as an index or pointer register. R0 and R1 point to the contents in the.
Immediate Addressing :
In this addressing mode source operand is a constant rather than a variable. So the constant can be incorporated in the instruction. Sign “#” indicates it is a immediate addressing mode.
Register Specific :
Inherent in the instruction, these refer to a specific register such as accumulator or DPTR.
Only program memory can be accessed in the index addressing. Either the DPTR or PC can be used as an index register.