INPUT AND OUTPUT (1/0) DEVICES
Input/Output devices are the means through which the MPU communicates with "the outside world." The MPU accepts binary data as input from devices such as keyboards and analog-to-digital (A/D) converters and sends data to output devices such as LEDs or printers. There are two different methods b which an MPU can identify I/O devices :one uses an 8-bit address and the other a 16- bit address These methods are described briefly in the following sections.
I/Os with 8-Bit Addresses (Peripheral-Mapped I/O)
In this type of I/O, the MPU uses eight address lines to identify an input or an output device; this is also known as peripheral-mapped I/O .The eight address lines can have 256 (28 combinations) a dresses ;thus the MPU can identify 256 input devices and 256 output devices with addresses ranging from 00H to FFH· The input and output devices are differentiated by the control signals I/O Read for input devices and I/O Write for output devices. The entire range of I/O addresses from 00H to FFH is also known as an I/O map. and individual addresses are also referred to as I/O device addresses or I/O port numbers.
If we use LEDs as output or switches as input. we need to resolve two issues: how to assign addresses and how to connect these I/O devices to the data bus . In a bus architecture ,these devices cannot be connected directly to the data bus or the address bus; all connections must be made through tri-stale interfacing devices so they will be enabled and connected to the buses only when the MPU chooses to communicate with them .In the case of memory . we did not have to be concerned with these problems because of the internal address decoding, Read/Write buffers .and availability of CS’ and control signals of the memory chip .In the case of I/O devices, we need to use external interfacing devices.
The steps in communicating with an I/O device are similar to those in communicating with memory and can be summarized as follows:
1. The MPU places an 8-bit address on the address bus, which is decoded by the external decode logic
2. The MPU sends a control signal (I/O Read or I/O Write) to enable the I/O device.
3. Data are transferred on the data bus.
I/Os with I6-bit Addresses (Memory-Mapped I/O)
In this type of I/O. the MPU uses 16 address lines to identify an I/O device; an I/O is connected as if it is a memory register. In memory-mapped I/O, the MPU uses the same control signals (Memory Read or Memory Write)and instructions as those of memory and follows the same steps as when it is accessing a memory. register. In some microprocessors. such as the Motorola 6800, all I/Os have 16- bit addresses so that I/Os and memory share the same memory map (64K) .
The peripheral- and memory-mapped I/O techniques will be discussed in detail in the context of interfacing I/O devices .