IN a8 instruction in 8085 Microprocessor

Microprocessor8085

In 8085 Instruction set, IN is a mnemonic that stands for INput the Byte from input port’s content to the accumulator. Input port’s 8-bit address is indicated in the instructions as a8. It occupies 2 Bytes in the memory. First Byte specifies the opcode, and the next Byte provides the 8-bit input port address. 

Mnemonics, Operand
Opcode(in HEX)
Bytes
IN Port-address
DB
2


IN F0H is an example instruction of this type. The result of execution of this instruction is shown below with an example.


Before
After
(A)
Any Value
ABH
Input Port F0H
ABH
ABH


IN instruction is the only instruction using which read the input port content to the Accumulator. A possible chip select circuit to connect an input port with an address as F0H is as shown in the following Fig.

Chip select circuit for input port F0H

Here as the port address is F0H so the bits ranging fromA7 to A0 should have the bit pattern

A7 A6 A5 A4 A3 A2 A1 A0 =1 1 1 1  0 0 0 0, with RD* = 0, and IO/M* = 1

All these bits will pass through a NAND Gate to product the output logic 1 as Chip-Select (CS), and so the input port chip gets selected. Thus, the chip responds when the 8085 sends out the address as F0H, IO/M* as 1, and RD* as 0. In other words, we consider that it is having the input port number F0H.

Notice that, it is possible to have an output port with the address F0H, and an input port with the same address F0H. When the 8085 sends out the address as EFH and IO/M* as 1, only one of them is selected based on the RD* and WR* signal status values. Thus, it is possible to have a total of 256 input ports and a total of 256output ports as well.


Address
Hex Codes
Mnemonic
Comment
2000
DB
IN F0H
Content from the port address F0H will be written back on to the Accumulator
2001
F0

F0H as port address


The timing diagram against this instruction IN F0H execution is as follows –

Summary − So this instruction OUT requires 2-Bytes, 3-Machine Cycle (Opcode Fetch, Memory Read, I/ORead) and 10 T-States for execution as shown in the timing diagram.

raja
Published on 28-Dec-2018 14:33:17
Advertisements