Addressing of I/O Ports in 8085 Microprocessor


The Central Processing Unit and the main memory are always very accurate and fast as compared with electromechanical input or output devices like printers, etc. Here in this case it is essential for us that the data lines of the computer are not engaged for a long time during communication process with input/output devices. Else the overall speed of the computer system drastically falls below. So the Input Output devices gets connected to a computer through the Input Output ports. Two Instructions are fetched which are called as IN and OUT where there are 256 Input Ports and 256 Output ports. For the communication with a printer, the CPU loads the output port connected to the printer which works at electronic speeds. The printer prints the total information at about 15-20 s.

I/O port chip with a single port is shown below.

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 mnemonic should be followed by an 8-bit port address. Thus we can have 2 8 = 256 input ports and 256 output ports are possible in 8085-based microcomputer. IN and OUT both are 2-Bytes instructions.

Mnemonics, OperandOpcode (in HEX)Bytes
IN Port-addressDB2
OUT Port-AddressD32

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 states as shown below −

Published on 12-Mar-2019 15:55:22