EEE 410 – Microprocessors I
Spring 04/05 – Lecture Notes # 16
Outline of the Lecture
Input/Output (I/O) and Device Interfacing
In addition to memory, 80x86 microprocessors are able to access I/O ports. Ports are
accessed either to bring data from the port into the CPU (inputting) or to send data from the
CPU to the port (outputting).
Input/Output Instructions in 8086 CPU
The 8086 microprocessor can access information from ports as well as from the memory.
two instructions for this purpose “IN” and “OUT”. These instructions can send
data from the accumulator (AX, AL or AH) to ports or receive data from ports into the
Case 1: 8-bit data ports
In format (1) above,
port# is the address of the port
, and can be from 00 to FFH. This 8-bit
address allows 256 input ports and 256 output ports. No segment register is involved in
computing the address, in contrast to the data accessed from memory.
In format (2) , port# is the address of the port, and can be from 0000 to FFFFH. This 16-bit
address allows 65,536 input ports and 65,536 output ports. No segment register (DS) is
Ex: Write a sequence of instructions that will output FFH to a byte-wide output port at the
address ABH of the I/O address space?
Ex: Write a sequence of instructions that will output FFH to an output port at the address
B000H of the I/O address space?
;Note that 16-bit address must be in DX
Ex: Assume that the port address 22H is an input port for monitoring the temperature. Write
Assembly language instructions to monitor the port continuously for the temperature of 100
degrees. If it reaches 100, then BH should contain ‘Y’.