Input Output Methods
Input Output Methods
INTRODUCTION
The technique of data transfer between a microcomputer and an external device is called
input/output (I/O).Peripherals are the I/O devices that connected to a microcomputer will
provide an efficient means of communication between the microcomputer and the outside
world. Because the characteristics of I/O devices are normally different from those of a
microcomputer like (speed and word length) we need interface hardware circuitry between the
microcomputer and I/O devices. Interface hardware provide all input and output transfers
between the microcomputer and peripherals by using an I/O bus. An I/O bus carries three
types of signals: device address, data, and command.
Transferring of data between a microcomputer and physical I/O devices is done using
various methods/schemes. These methods are:
A) PROGRAMMED I/O
There are typically two ways in which programmed I/O can be utilized: Unconditional I/O
when the CPU can send data to the peripheral device at any time i.e. the external device is
always ready for data transfer.
In conditional I/O, the microprocessor outputs data to an external device via handshaking.
This means that data transfer occurs via the exchange of control signals between the
microprocessor and an external device. A disadvantage of conditional programmed I/O is
that the microcomputer needs to check the status bit (a conversion complete signal of the A/D
converter) by waiting in a loop when the CPU has to check the status of the external device
before data transfer. The CPU waits for I/O module to complete operation thus CPU time is
wasted.
In programmed I/O the microprocessor executes a program to perform all data transfers
between the microcomputer and the external device. These method is divided into two;
In this method the same instructions used to transfer data between the mocroprocessor and the
memory are the same used to transfer data between the microprocessor and the I/O port i.e
MOV , STA, LDA
Example 1.STA OOFFH
If address OOFFH is for I/O port ,the data transfer will be between the microprocessor
and an output port.
2. LDA OOFFH: Data transfer will be between the microprocessor and an
input port
3.STA OOOAH
If address OOOAH is for the memory the microprocessor will store data into a
memory location whose address is OOOAH
ADVANTAGES
1. All addressing modes for memory access are available
2. Data transfer between I/O port and the microprocessor is not restricted to IN and OUT
instructions
3. No special commands for I/O
4. Large selection of memory access commands available
DISADVANTAGES
1.Memory address range available is reduced
2.Difficult to distinguish in a program between memory and input and output data transfer
3.Less suitable for simple and small systems
ii) PROGRAMMED /ISOLATED INPUT/OUTPUT DATA TRANSFER
Uses an output pin such as the M / IO pin. Has separate address spaces and thus requires
I/O or memory select lines. As a result the IO/M pin is active when an I/O port is referred and
low when memory address is referred.
In this method there exist alternative memory address i.e memory location and
input/output port addresses are separately allocated. Instructions IN and OUT are used for
input and output ports.
e.g IN 21H This transfer data from an input port whose address is 21H into the
microprocessor system
OUT 22H This transfer data from the microprocessor into an output port whose address
is 22H
ADVANTAGES
1. IN and OUT instruction uses short addresses from OOH to FFH hence simple in
decoding the program
2. Programmes are clear and easier to interprete since input/output and memory transfer
are easily distinguished
3. Special commands for I/O areavailable
DISADVANTAGES
1. Need I/O or memory select lines
With the above TWO methods the peripheral device has no control during the process. Also it
is assumed only a few device are connected to the microprocessor
Due to this two disadvantages, there are several other methods in which data transfer between
microprocessor and peripheral can be interrupted.
B)POLLING SYSTEM/STATUS CHECK
In this system the processor interrogate each device connected to it in turn and if service is
required the device is serviced otherwise it is left and the next peripheral is examined.
A read line from each external device is read again and again.This is reffered to as polling.
DISADVANTAGES
1.A lot of time is wasted in interrogating
2. Peripheral device has no control as all device are treated the same
3. Polling system cannot respond to an emergency
C) INTERRUPT SYSTEM
Interrupt input/output transfer is a method of data transfer where by an external device inform
the processor that it is ready for communication and it require attention. It can be intiated at
any time without refference to the system clock i.e It is asynchronous
The peripheral requiring service interrupt the microprocessor system using an Interrupt
signal.Interrupt signals are used to synchronise the microprocessor with the peripheral device
because the peripheral are slower.The response to the interrupt request is directed or
controlled by the microprocessor.
For voluminous data transfer the above three methods are time consuming and quite
uneconomical.
In such a situation, it is advisable to facilitate for transfer of data directly between the I/O
device and external memory without going through the accumulator. This is achived by the
DMA technique