Professional Documents
Culture Documents
Unit 5
Input/Output
Peripheral Device
Input or output devices that are connected to computer are called peripheral devices. These devices are designed
to read information into or out of the memory unit upon command from the CPU and are considered to be the
part of computer system. These devices are also called peripherals.
For example: Keyboards, display units and printers are common peripheral devices.
There are three types of peripherals:
1. Input peripherals : Allows user input, from the outside world to the computer. Example: Keyboard, Mouse
etc.
2. Output peripherals: Allows information output, from the computer to the outside world. Example: Printer,
Monitor etc
3. Input-Output peripherals: Allows both input(from outside world to computer) as well as, output(from
computer to the outside world). Example: Touch screen etc.
Interfaces
Interface is a shared boundary between two separate components of the computer system which can be used to
attach two or more components to the system for communication purposes.
There are two types of interface:
1. CPU Interface
2. I/O Interface
I/O Interface
Peripherals connected to a computer need special communication links for interfacing with CPU. In computer
system, there are special hardware components between the CPU and peripherals to control or manage the input-
output transfers. These components are called input-output interface units because they provide communication
links between processor bus and peripherals. They provide a method for transferring information between
internal system and input-output devices.
The Input/output Interface is required because there are exists many differences between the central computer
and each peripheral while transferring information. Some major differences are:
1. Peripherals are electromechanical and electromagnetic devices and their manner of operation is different from
the operation of CPU and memory, which are electronic device. Therefore, a conversion of signal values may be
required.
2. The data transfer rate of peripherals is usually slower than the transfer rate of CPU, and consequently a
synchronization mechanism is needed.
3. Data codes and formats in peripherals differ from the word format in the CPU and Memory.
4. The operating modes of peripherals are differ from each other and each must be controlled so as not to disturb
the operation of other peripherals connected to CPU.
These differences are resolved through input-output interface.As input-output interface(Interface Unit) contain
various components, each of which performs one or more vital function for smooth transforming of information
between CPU and Peripherals.
I/O Ports
A connection point that acts as interface between the computer and external devices like mouse, printer, modem,
etc. is called port. Ports are of two types −
Internal port − It connects the motherboard to internal devices like hard disk drive, CD drive, internal modem,
etc.
External port − It connects the motherboard to external devices like modem, mouse, printer, flash drives, etc. or
more vital function for smooth transforming of information between CPU and Peripherals.
Serial Port
Serial ports transmit data sequentially one bit at a time. So they need only one wire to transmit 8 bits. However it
also makes them slower. Serial ports are usually 9-pin or 25-pin male connectors. They are also known as COM
(communication) ports or RS323C ports.
Parallel Port
Parallel ports can send or receive 8 bits or 1 byte at a time. Parallel ports come in form of 25-pin female pins and
are used to connect printer, scanner, external hard disk drive, etc.
USB Port
USB stands for Universal Serial Bus. It is the industry standard for short distance digital data connection. USB
port is a standardized port to connect a variety of devices like printer, camera, keyboard, speaker, etc.
PS-2 Port
PS/2 stands for Personal System/2. It is a female 6-pin port standard that connects to the male mini-DIN cable.
PS/2 was introduced by IBM to connect mouse and keyboard to personal computers. This port is now mostly
obsolete, though some systems compatible with IBM may have this port.
Infrared Port
Infrared port is a port that enables wireless exchange of data within a radius of 10m. Two devices that have
infrared ports are placed facing each other so that beams of infrared lights can be used to share data.
Bluetooth Port
Bluetooth is a telecommunication specification that facilitates wireless connection between phones, computers
and other digital devices over short range wireless connection. Bluetooth port enables synchronization between
Bluetooth-enabled devices. There are two types of Bluetooth ports −
Incoming − It is used to receive connection from Bluetooth devices.
Outgoing − It is used to request connection to other Bluetooth devices.
FireWire Port
FireWire is Apple Computer’s interface standard for enabling high speed communication using serial bus. It is
also called IEEE 1394 and used mostly for audio and video devices like digital camcorders.
Interrupts
Interrupt Hardware
An interrupt is a signal to the processor emitted by hardware or software indicating an event that needs
immediate attention. Whenever an interrupt occurs, the controller completes the execution of the current
instruction and starts the execution of an Interrupt Service Routine (ISR) or Interrupt Handler. ISR tells the
processor or controller what to do when the interrupt occurs. The interrupts can be either hardware interrupts or
software interrupts.
Hardware Interrupt
A hardware interrupt is an electronic alerting signal sent to the processor from an external device, like a disk
controller or an external peripheral. For example, when we press a key on the keyboard or move the mouse, they
trigger hardware interrupts which cause the processor to read the keystroke or mouse position.
1. Hardware Interrupts: If the signal for the processor is from external device or hardware is called
hardware interrupts. Example: from keyboard we will press the key to do some action this pressing of
key in keyboard will generate a signal which is given to the processor to do action, such interrupts are
called hardware interrupts. Hardware interrupts can be classified into two types they are
• Maskable Interrupt: The hardware interrupts which can be delayed when a much highest priority
interrupt has occurred to the processor.
• Non Maskable Interrupt: The hardware which cannot be delayed and should process by the
processor immediately.
2. Software Interrupts: Software interrupt can also divided in to two types. They are
1. Normal Interrupts: the interrupts which are caused by the software instructions are called
software instructions.
2. Exception: unplanned interrupts while executing a program is called Exception. For example:
while executing a program if we got a value which should be divided by zero is called a
exception.
Exception
Exception is a software interrupt, which can be identified as a special handler routine. Exception can be
identified as an automatically occurring trap. Generally, there are no specific instructions associated with
exceptions (traps are generated using a specific instruction). So, an exception occurs due to an “exceptional”
condition that occurs during program execution.
relevant to the current process
• Faults, arithmetic traps, and synchronous traps
• Invoke software on behalf of the currently executing process
Arithmetic overflow occurs during the execution of an add, addi, or sub instruction. If the result of the
computation is too large or too small to hold in the result register, the Overflow output of the ALU will become
high during the execute state. This event triggers an exception.
Undefined instruction occurs when an unknown instruction is fetched. This exception is caused by an
instruction in the IR that has an unknown opcode or an R-type instruction that has an unknown function code.
System call occurs when the processor executes a syscall instruction. Syscall instructions are used to implement
operating system services (functions).
Example of Programmed I/O: In this case, the I/O device does not have direct access to the memory unit. A
transfer from I/O device to memory requires the execution of several instructions by the CPU, including an input
instruction to transfer the data from device to the CPU and store instruction to transfer the data from CPU to
memory. In programmed I/O, the CPU stays in the program loop until the I/O unit indicates that it is ready for
data transfer. This is a time consuming process since it needlessly keeps the CPU busy. This situation can be
avoided by using an interrupt facility.
Direct Memory Access: The data transfer between a fast storage media such as magnetic disk and memory unit
is limited by the speed of the CPU. Thus we can allow the peripherals directly communicate with each other
using the memory buses, removing the intervention of the CPU. This type of data transfer technique is known as
DMA or direct memory access. During DMA the CPU is idle and it has no control over the memory buses. The
DMA controller takes over the buses to manage the transfer directly between the I/O devices and the memory
unit.
Bus Request : It is used by the DMA controller to request the CPU to relinquish the control of the buses.
Bus Grant : It is activated by the CPU to Inform the external DMA controller that the buses are in high
impedance state and the requesting DMA can take control of the buses. Once the DMA has taken the control of
the buses it transfers the data. This transfer can take place in many ways.
Burst Transfer : DMA returns the bus after complete data transfer. A register is used as a byte count, being
decremented for each byte transfer, and upon the byte count reaching zero, the DMAC will release the bus.
When the DMAC operates in burst mode, the CPU is halted for the duration of the data transfer.
2. Transfer the entire block of data at transfer rate of device because the device is usually slow than the
speed at which the data can be transferred to CPU.
3. Release the control of the bus back to CPU So, total time taken to transfer the N bytes = Bus grant
request time + (N) * (memory transfer rate) + Bus release control time
Where,
% CPU Busy=(X/X+Y)*100
DMA Function
• DMA module may temporarily force processor to suspend operations – cycle stealing.
DMA Operation
1. Read or write
• DMA module transfers the entire block of data – one word at a time – directly to or from memory without
going through the processor
• The DMA module transfers one word and returns control to the processor.
• Since this is not an interrupt the processor does not have to save context.
• The processor executes more slowly, but this is still far more efficient that either programmed or interrupt-
driven I/O.
DMA Configurations
• An example of synchronous transmission would be the transfer of a large text file. Before the file is
transmitted, it is first dissected into blocks of sentences. The blocks are then transferred over the
communication link to the target location.
• Because there are no beginning and end bits, the data transfer rate is quicker but there’s an increased
possibility of errors occurring. Over time, the clocks will get out of sync, and the target device would
have the incorrect time, so some bytes could become damaged on account of lost bits. To resolve this
issue, it’s necessary to regularly re-synchronise the clocks, as well as to make use of check digits to
ensure that the bytes are correctly received and translated.
Asynchronous Communication
• In asynchronous transmission, data moves in a half-paired approach, 1 byte or 1 character at a time. It
sends the data in a constant current of bytes. The size of a character transmitted is 8 bits, with a parity bit
added both at the beginning and at the end, making it a total of 10 bits. It doesn’t need a clock for
integration—rather, it utilises the parity bits to tell the receiver how to translate the data.
• It is straightforward, quick, cost-effective, and doesn’t need 2-way communication to function.
Characteristics of Asynchronous Transmission
• Each character is headed by a beginning bit and concluded with one or more end bits.
• There may be gaps or spaces in between characters.