0% found this document useful (0 votes)
33 views

8051 Addressing Mode

Uploaded by

gravitonite
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

8051 Addressing Mode

Uploaded by

gravitonite
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

MICROCONTROLLER 8051

Addressing modes of 8051


The way in which data is specified in an instruction is called addressing mode. The data fetched
for execution depends on the addressing mode.

Immediate addressing
In this addressing mode, the data to be manipulated is given in the instruction itself. The data is
preceded by the # symbol.
e.g. ADD A, #80H
This instruction adds the data 80H to the contents of the accumulator and the result is stored in
the accumulator itself. This addressing mode is used when the data for the arithmetic and logical
operation is needed only once and is a constant.

Register direct addressing


In this addressing mode, the register that contains the data to be manipulated is specified in the
instruction.
e.g. ADD A, R0
This instruction adds the contents stored in the register R0 to the accumulator contents and
stores the results in the accumulator. The registers A, DPTR and R0-R7 are used in register direct
addressing. This addressing mode used temporary registers, which hold the data for the
operation.

Memory direct addressing


The memory address that contains the data to be operated on is specified in the instruction.
e.g. ADD A, 74H
This instruction adds the data in the accumulator to that stored in the memory address 74H. All
internal RAM addresses, including that of the special function registers, can be used in memory
direct addressing instructions. This addressing mode is used when the data stored in memory is
to be used in arithmetic and logical instructions. The data in the memory, which is used in
memory direct addressing, can be changed at any point in the program.

Memory indirect addressing


The register that contains the memory address of the data is specified in the instruction. The
register specified is preceded by the @ symbol in the assembly language format.
e.g. ADD A, @R0

Dr. Mithun Kr. Bhowal.


Dept. of Computer Science. Bangabasi Morning College.
MICROCONTROLLER 8051

The value stored in the register R0 is now the address of the memory location of the data to be
fetched. From this memory location, the data is fetched and the instruction is executed. The DPTR
is used to access the data in the external memory with 16 bit addresses. The indirect addressing
mode is very useful for accessing data that are stored in consecutive memory locations and
accessed serially in the program.

Indexed addressing
In this type of addressing, the instruction consists of two parts- a base address and in offset. This
type of addressing is useful in relative memory accessing and relative jumping. The base address
is stored in the DPTR or any other register. The offset value is stored in the accumulator.
e.g. MOVC A, @A+DPTR
This instruction adds the contents of the accumulator to the contents of the data pointer and the
results forms the actual address from where data is to be fetched. This data is moved to the
accumulator.

Dr. Mithun Kr. Bhowal.


Dept. of Computer Science. Bangabasi Morning College.

You might also like