8051 MICRO CONTROLLER
Mr. A.Baskar
Mr.A.Baskar
Assistant Professor(Sr.Gr)
Dept. of CSE
Amrita Vishwa Vidyapeetham
8051 INSTRUCTION SET FORMAT
ADDRESSING MODE
Definition
The different ways in which a source operand in an
instruction are known as the addressing modes.
The 8051 provides a total of 5 distinct addressing
modes.
Immediate Addressing
Register Addressing
Direct Addressing
Register – Indirect Addressing
Indexed Addressing
Relative Addressing
Absolute Addressing
Long Addressing
IMMEDIATE ADDRESSING
the operand, which follows the Opcode, is a
constant data of either 8 or 16 bits.
MOV DPTR,#4532H
REGISTER ADDRESSING
Register addressing mode involves the use of
registers to hold the data to be manipulated.
Note:
Not
allowed
Mov R,R
DIRECT ADDRESSING
the address of the data is specified as the
Operand in the instruction. Using Direct
Addressing Mode, we can access any register or
on-chip variable. This includes general purpose
RAM, SFRs, I/O Ports, Control registers.
MOV R0,40H
save content of RAM
location 40h into R0.
MOV 56H,A
save content of A in
RAM location 56H
REGISTER – INDIRECT ADDRESSING
the address of the Operand is specified as the
content of a Register. Only R0 and R1 are
allowed in Indirect Addressing Mode. These
register in the indirect addressing mode are
called as
Pointer registers.
All register banks
are allowed.
MOV A,@R0
MOV @R1,B
INDEXED ADDRESSING
INDEXED ADDRESSING
Indexed addressing mode is widely used in
accessing data elements of look-up table entries
located in the program ROM space of the 8051.
MOV dptr, #4000H
MOV a, #5
MOVC a, @a+ dptr a<-m[4005]
RELATIVE ADDRESSING
This is a special addressing mode used with
certain jump instructions.
ABSOLUTE ADDRESSING
Absolute addressing is only used with the ACALL
and AJMP instructions.
ACALL - subroutine call (2 byte instruction)
AJMP - unconditional jump (2 byte instruction)
These instructions allow you to move to any
instruction within the same 2K of memory.
LONG ADDRESSING
The long addressing mode within the 8051 is
used with the instructions LJMP and LCALL.
The address specifies a full 16 bit destination
address so that a jump or a call can be made to a
location within a 64KByte code memory space
(216 = 64K).
An example instruction is:
LJMP 5000h ; full 16 bit address is specified in
operand