Javatpoint Logo
Javatpoint Logo

Addressing Modes of 8085 Microcontroller

Addressing Modes are an instruction set used for communicating with the central processing unit (CPU) for performing any specific task.

Generally the following addressing modes are used for executing the instruction in 8085 microcontroller:-

  • Immediate addressing mode
  • Indexed addressing mode
  • Direct addressing mode
  • Register direct addressing mode
  • Register indirect addressing mode

The detailed explanations of each addressing mode are given below:


Immediate Addressing Mode

Let's start with an example.

In simple, we can write,

It is known as immediate because 8-bit data is send immediately to the accumulator (destination operand).

Consider the following illustration describes the above set of instructions and their execution. The opcode 74H is saved at 0202 address. The data 4AH is saved at 0203 address inside a program memory. After reading an opcode 74H, the data at the next memory address is copied to accumulator A (E0H is the address of accumulator). Since an instruction is of 2-bytes and it is executed in single cycle, the program counter will increment by 2 and will point to 0204 address of the program memory.

ES Addressing Models1

Indexed Addressing Mode

Let us consider two examples for understanding the concept of indexed addressing mode. Take a look at the below instructions:

Here PC is the program counter and DPTR is the data pointer (both are 16-bit registers). Consider the first example.

In this the source operand is @A+DPTR. It has a source data from that place. Here the contents of DPTR are added with the current content of the accumulator. This addition provides a new address that is the address of the source data. The data pointed by this address is further transferred to the accumulator.

ES Addressing Models2

Consider the opcode is 93H. The DPTR having the value of 01FE, here 01 is located in DPH side (higher 8 bits) and FE is located in DPL side (lower 8 bits). Consider Accumulator has the value 02H. After that a 16-bit addition is done and 01FE H+02H result in 0200 H. Data present at the location 0200H will become transferred to the accumulator. The previous value of the accumulator (02H) will be replaced by the new data from 0200H. The new data inside the accumulator is highlighted in the illustration.


Direct Addressing Mode

Direct addressing mode is used for addressing an operand. Here, an address of the data (source data) is present as an operand. Let's consider an example.

The register bank#0 (7th register) has the address 07H. When the MOV instruction is executed, the data stored in register 07H is moved inside an accumulator. As the register 07H holding the data 1FH, therefore 1FH is moved to the accumulator.

Note - we are not using '#' in direct addressing mode, as that used in immediate mode because If we had used '#', the data value 07H is transferred to the accumulator instead of 1FH.

Now, consider the following illustration. It shows how the instruction is executed:-

ES Addressing Models3

As shown in an above illustration, it is a 2-byte instruction which requires 1 cycle to complete.

The program counter will be incremented by 2 and will point to 0204 memory location. The opcode for an instruction MOV A, address of operation is E5H. Whenever the instruction at 0202 is run (E5H), the accumulator will become active and ready to receive data. Then the PC jumps to the next address at 0203 and look up the address of the location 04H where the source data (i.e. transferred to accumulator) is located. At 04H, the controller finds the data 1FH and transfers this to the accumulator and hence the execution of instruction is completed.


Register Direct Addressing Mode:

Inside a register direct addressing mode, we use the register name directly (as source operand).

Let us consider an example.

At a time, the registers are able to take values from R0 to R7. There are 32 such registers are present in microcontroller. In order to use these 32 registers with just 8 variables for addressing the registers, register banks are used.

At one time, a single register bank is to be selected. Selection of a register bank is made possible by using a Special Function Register (SFR) it named as Processor Status Word (PSW). PSW is an 8-bit SFR where each bit can be programmed as required. Bits are assigned from PSW.0 to PSW.7.

Now, consider the following illustration. It represents how instruction is executed:-

ES Addressing Models4

Data (2F) movement is shown in bold. 2F is become transferred to the accumulator from data memory location 0CH and it is shown by dotted line. 0CH is an address location of Register 4 of register bank #1. The instruction shown above is of 1 byte and it requires 1 cycle for complete execution. It means that we can save memory by using direct addressing mode.


Register Indirect Addressing Mode

In register indirect addressing mode, the address of data is stored inside the register as an operand.

Here the value present inside R0 is to be considered as an address, it is used for holding the data to be transferred inside an accumulator. Example: If register R0 has the value 20H, and data 2FH is stored at the address location of 20H, then the value of 2FH will become transferred to the accumulator after executing the above instruction.

Now, consider the following illustration. It shows how the instruction is executed:-

ES Addressing Models5

Consider the opcode for MOV A, @R0 is E6H. Program control moves to address location 20H where it locates the data 2FH and then transfer 2FH inside an accumulator. It is a 1-byte instruction and the program counter (PC) is increments by 1 and moves to 0203 location of the program memory.

Note : Only the registers R0 and R1 are allowed to be used as a register indirect addressing instruction. Therefore, the programmer can develop an instruction either using @R0 or @R1. All other register banks are not allowed.






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA