IN and OUT instructions in 8085 Microprocessor

Microprocessor8085

In 8085 Instruction set, there are two instructions in 8085 for communication with I/O ports. They are the IN and OUT instructions. The IN or OUT instruction mnemonics should be followed by an 8-bit port address. Thus we can have 28 = 256 input ports and 256 output ports are possible in 8085-based microcomputers. IN and OUT both are 2-Bytes instructions.

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


In case of IN instruction, the current 8-bit content of the PORT# will be made available on to the Accumulator. Let us suppose with the PORT#, 8 DIP switches are connected. And their states are ON-ON-OFF-ON-ON-ON-OFF-ON. So after execution of the instruction IN PORT#, the Accumulator content will be 1101 1101.

In case of OUT instruction, the current 8-bit content of the Accumulator will be copied on to the PORT#. Let us suppose that Accumulator’s initial content is 0101 0101. And with the 8-bit port 8 LEDs are connected. So after execution of the instruction OUT PORT#, LEDs will have the OF-OFF states as shown below – 


raja
Published on 28-Dec-2018 12:58:27
Advertisements