MPU communicates with the outside world with the help of some external devices which are known as Input/Output devices. The MPU accepts the binary data from input devices such as keyboard and analog/digital converters and sends data to output devices such as printers and LEDs. For performing this task, MPU first need to identify the input/output devices.
There are two different methods by which I/O devices can be identified: Using 8-bit address, and Using 16-bit address. These methods are described briefly in the following sections:
- I/Os with 8-bit addresses –
This is also known as peripheral-mapped I/O or I/O-mapped-I/O. In this type of I/O, MPU uses eight address lines to identify an input or an output devices. This is an 8-bit numbering system for I/Os used in conjunction with the input and output instructions. This is also known as I/O space that is separate from the memory space which is 16-bit numbering system. The eight address lines have 2^8 combinations which is total 256 addresses; therefore MPU can identify 256 input devices and 256 output devices with addresses ranging from 00H to FFH.
The input and output devices can be differentiated by using the control lines I/O Read and I/O Write. MPU uses I/O Read control signal for input devices and I/O Write control signal for output devices. The individual addresses of I/O Map is known as I/O port numbers. These I/O devices cannot be connected directly to the data bus or the address bus; all connections must be made through tri-state interfacing devices so they will enabled and connected to the buses only when the MPU chooses to communicate with them.
- I/Os with 16-bit addresses –
This is also known as Memory-mapped I/O. In this type of I/O, MPU uses sixteen address lines to identify an input or an output devices; an I/O is connected as if it is a memory register. The MPU uses same control signal (Memory Read and Memory Write) and instructions as those of memory. In some microprocessors, such as the Motorola 6800, all I/Os have 16-bit addresses; I/Os and memory share the same memory map (64K). The steps in communicating with an I/O device are similar for both 8-bit and 16-bit addresses. The steps are summarized below:
- The MPU places an 8-bit address ( or 16-bit address) on the address bus, which is decoded by external decode logic.
- The MPU sends a control signal (I/O Read or I/O Write) and enables the I/O device.
- Data are transferred using the data bus.