Loading....
Coupon Accepted Successfully!

 

Addressing Modes

The commonly used addressing modes of 8051 microcontroller are as follows:
  • Immediate Addressing
  • Register Addressing Mode
  • Direct Addressing
  • Indirect Addressing
  • Indexed Addressing
  • Relative Addressing
  • Absolute Addressing
  • Long Addressing

Immediate Addressing

Table: Examples of immediate addressing
 

Instruction
Task
ADD A, # data
Add immediate data to accumulator
SUBB A, # data
Subtract immediate data from accumulator with borrow
MOV Rn, # data
Move immediate data to register Rn
MOV DPTR, #data 16
Load data pointer register with a 16-bit constant

Register Addressing Mode

Examples of register addressing
 
Instruction Task
ADD A, Rn Add the content of register Rn to accumulator.
SUBB A, Rn Subtract the content of register from accumulator with borrow.
MOV Rn, A Move data from accumulator to register Rn.
INC DPTR Increment data pointer register by one.

Direct Addressing

Examples of direct addressing
 
Instruction Task
MOV A, direct Copy the Contents of memory location specified by ‘direct’ into accumulator.
MOV A, SBUF Copy the contents of special function register SBUF into accumulator.

Indirect Addressing

 

Indirect addressing
 

Examples of indirect addressing
 

Instruction Task
ADD A, @R0 Add the contents of the address specified by the R0 register to accumulator
SUBB A, @R1 Subtract the contents of the address specified by the R1 register from accumulator with borrow
MOV @Ri, A Move the content of accumulator to indirect RAM specified by Ri (R0 or R1)
MOV A, @Ri Moves a byte of data from internal RAM at location whose address is in Ri (R0 or R1) to the accumulator
DEC @Ri Decrement indirect RAM specified by Ri (R0 or R1)
 

Indexed Addressing

Examples of indexed addressing
 
Instruction Task
MOVC A,@A+PC Move a byte of data from program memory whose address can be determined by sum of accumulator and program counter, to the accumulator.
MOVC A,@A+DPTR
 
Move a byte of data from program memory whose address can be found by adding the accumulator and the data pointer, to the accumulator.
JMP @A+DPTR Jump indirect relative to the data pointer. The address of a jump instruction is calculated as sum of the accumulator and the data pointer.
 

Relative Addressing

 

Relative addressing

 





Test Your Skills Now!
Take a Quiz now
Reviewer Name