You are on page 1of 43

1

1.4 DESCRIBE INPUT / OUTPUT DATA


TRANSFER
2

1. Define the asynchronous serial transfer.


2. Describe the asynchronous communication
interface.
3. Describe the mode of transfer:
• Programmed I/O
• Interrupt-initiated I/O
• Direct Memory Access
3

Introduction
• Data transmission in computer systems using two
methods like as serial and parallel.
Serial Parallel
• Serial means the various bits of data are • Parallel means all the bits of data are
transmitted serially one after the other by transmitted simultaneously on separate
using only one wire. wire.

• Each wire carries only one-bit data.


4

*Only Asynchronous serial transfer will be cover in this syllabus .


5
6

FACTOR SERIAL PARALLEL


Number of bits One bit n bits
transmitted at one
clock pulse
Data flows in 2 Data flows in
directions, bit by bit multiple directions, 8
bits (1 byte) at a time

No of lines required One line n lines


to transmits n bits

Speed of data Slow Fast


transfer
Cost of transmission Low as one line requires Higher as n lines are
required

Application Long distance Short distance


communication between communication like
two computer computer to printer
7

Define Asynchronous serial transfer


• Asynchronous transmission sends only one character at a time where
a character is either a letter of the alphabet or number or control
character i.e. It sends one byte of data at a time.
• By using this technique, each character consist of :
Start bit • indicates the beginning of data.
• to alerts the receiver to the arrival of new group of bits.
• A start bit usually 0 is added to the beginning of each byte.

Stop bit • indicates the end of data.


• to let the receiver know that byte is finished, one or more additional
bits are appended to the end of the byte.
• These bits, usually 1s are called stop bits.

Character bit / • The actual data to be transmitted


Data bits
Parity bit • to detect error in data transmission. (a check on a set of binary
values)
• calculated the number of 1s in the set plus the parity bit should
always be even (or occasionally, should always be odd).
8

Interface Of Asynchronous Transmission


9

Sending data is character ‘A’ = 0100 0001

If using even parity:

If using odd parity :


10

Application of Asynchronous Transmission


• A) Asynchronous transmission is well suited for keyboard type-
terminals and paper tape devices. The advantage of this method is
that it does not require any local storage at the terminal or the
computer as transmission takes place character by character.

• B) Asynchronous transmission is best suited to Internet traffic in


which information is transmitted in short bursts. This type of
transmission is used by modems.
11

1.4.3 Describe mode of transfer

Modes of Transfer for


managing input and
output

Programming I/O Direct Memory


Interrupt-driven Access (DMA)
(also known as
polling) I/O
Think???
• Consider a computer that is playing back an mpeg file in
say media player.
• You click some icon on desktop and the computer
responds immediately .
• How does it happen?? The computer had no way of
knowing when this event would occur, but yet it deal with
it.
• A computer receives input from a number of
different sources.

• Characters keyed in on the keyboard, the click of


a mouse, data from scanner , data from printer.

• The arrival of this type of input is not necessary


expected at any particular time and the computer
has to have a way of detecting it.
• There are two ways that this can happen,
Programming I/O (polling ) and interrupts.

• Both of these method allow the processor to deal


with events that can happen at any time and that
are not related to the process it is currently
running.
15

a) Programming I/O (also known as polling)


• By using this method data transfer is direct control by
processor under driver software control to access
registers or memory on a device.
• Processor continuously polls or test every device in turn
as whether it requires attention ( eg. has data to be
transferred).
• Processor cannot do other task beside than continuously
check every I/O devices that attached with system.
• This is not efficient method because of much of processor
time is wasted on unnecessary polls.
16

Managing I/O using Programming I/O Method:

1. Processor does nothing except polling

2. Processor executes an I/O instruction by issuing command to appropriate


I/O module

3. I/O module performs the requested action and then sets the appropriate
bits in the I/O status register

4.I/O module takes no further action to alert the processor – it does not
interrupt the processor

5.The processor periodically checks the status of the I/O module until it
determines that the operation is complete.
17

Managing I/O using Programming I/O Method:


18

Example of process:
1. CPU/ Processor checks status of
device by looking at status register in
I/O module.
2. If status register of device 1 is ready
(set to 0) - data will be put into bus
data and send to CPU to deal it.
3. If status register of device 1 is busy
(set to 1) – CPU will polling other
devices to check the status of
devices.
4. If data is ready in data register, it can
be effective data transfer because
data can be input / output depending
on what is particular task to be
execute.
19

Disadvantages of Programming I/O


a)If there are too many devices to check, the time required
to poll them can exceed the time available to service the
I/O device.

b)The processor has to wait a long time for the I/O module
of concern to be ready for either reception or transmission
of data.

c)The processor while waiting, must repeatedly


interrogate/ask about the status of the I/O module. As a
result, the level of the performance of the entire system is
severely degraded.
Think???
• Compare the method to teacher continually asking
student in a class, one after another, if they need help.

• Obviously the more efficient method would be for a


student to inform the teacher whenever they require
assistance.
21

b) Interrupt-driven I/O
• The weakness with programmed I/O is that the processor
has to wait a long time for the I/O module of concern to be
ready for either reception or transmission of data.

• The processor while waiting, must repeatedly interrogate


the status of the I/O module. As a result, the level of the
performance of the entire system is severely degraded.

• So how to overcome?
22

• The answer is by using interrupt method.

The processor will issue an I/O command to a module and then go


on to do some other useful work.

The I/O module will then interrupt the processor to request service
when it is ready to exchange data with the processor.

The processor then executes the data transfer, as before, and then
resumes its former processing.
Simple idea
• It happens to people all time, such as
receiving a phone call when you are doing
some work.

• You deal with the interruption and then


resume with your work from where you left
off.
24

• An Interrupt is a signal to get the attention of the processor,


which then will interrupt the current process and its usually
generated when I/O devices are required or need attention.

• The processor can accept two types of interruptions, i.e.


interrupt hardware and interrupt software.

• A hardware interrupt is an interrupt that is sent by hardware


through a special line.

• Software interrupt is an interrupt sent by the software (in


other words the signal sent from inside the processor itself).

• For example, hardware interrupts are generated when a key


is pressed or when the mouse is moved.
25

Flow of interrupt process


26

When an I/O device is ready to send data, the following


event occur:
1. The devices issues an interrupt to the processor.
2. The processor finishes execution of the current
instruction. It then responds to the interrupt signal.
3. The processor sends an acknowledgement signal to the
device that sent the interrupt.
4. The processor must save the state of the current (i.e. the
value of register, the address of the next instruction to be
executed, etc.). These are save onto a stack.
5. The processor then serves to the device that issued to
the interrupt signal.
6. When interrupt processing is over, the save register are
retrieved from the stack and the processor continues its
previous task from the point where it was last stopped.
27

Scenario of interrupt – press keyboard


• One of the characteristics of a computer  always works on commands
sequentially, step by step.
• But not always the execution path is always sequential.
• The processor can receive an important signal where it must immediately
handle and delay what it is doing at this time.
• Without an interrupt, the program must instruct the processor to periodically
check if there are buttons pressed on the keyboard.
• This technique is called polling. The more hardware involved in the polling
process, the processor load will be heavier.
• Remember that polls must check periodically even if there are no buttons
pressed on the keyboard.
• Interrupt offers a better solution: the processor will get a notification only
when the keyboard key is pressed.
28

Interrupt –driven I/O conclusion


• With interrupt-driven I/O, the CPU does not access a device until it needs
servicing, and so it is not caught up in busy-waits.

• In interrupt-driven I/O, the device requests service through a special


interrupt request line that goes directly to the CPU.

• Interrupt I/O is more efficient than programmed I/O because it eliminates


needless waiting.

• Reduce time and cost in such a way that interrupt only occurs when the
processor receives an interrupt signal. (compare with programming I/O
method)

• However, interrupt I/O still consumes a lot of processor time, because


every word of data that goes from memory to I/O module or from I/O
module to memory must pass through the processor.
29

Priority Interrupt
1. Priority Interrupt is a system that determine which
condition is to be services first when two or more
request arrive simultaneously.

2. The highest priority interrupt are served first.

3. Device with high speed transfer are given high


priority and slow devices such keyboards receive low
priority.

4. When 2 devices interrupt the CPU at the same time


the CPU will service the device with highest priority
30

c)Direct Memory Access (DMA)

Direct memory access (DMA) is a method that allows an


input/output (I/O) device to send or receive data directly to or
from the main memory, bypassing the CPU to speed up
memory operations.

The process is managed by a chip known as a DMA controller


(DMAC).

This situation will relieve congestion on the system bus.

In this mode, the I/O module and main memory exchange data
directly, without processor involvement.
Direct Memory Access (DMA)
• In DMA,

 Data transfer between memory peripheral / I/O devices

Controlled externally

Microprocessor not involved during transfer

This method used in cases where microprocessor


control too slow

DMA process requires a controlled chip – 8257 DMA


controller
32

Direct Memory Access (DMA)

DMA Controller
• DMA services are usually provided by DMA
controller, which is, itself a specialized processor
whose specialty is transferring data directly to or
from I/O devices and memory.

• It takes the place of microprocessor. The transfer


directly between memory and peripherals I/O
33

Direct Memory Access (DMA)


34

Diagram Module DMA


35

• The DMA module is capable of representing the processor


and taking over control of the system from the processor.
It needs to do this to transfer data to and from memory
over the system bus.

• For this purpose, the DMA module must use the bus only
when the processor does not need it, or it must force the
processor to suspend operation temporarily.

• CYCLE STEALING  A method of accessing memory


(RAM) or bus without interfering with the CPU
36

• When the processor wishes to read or write a block of data, it issues a


command to the DMA module, by sending to the DMA module the
following information:

1. Whether a read or write is requested, using the read or


write control line between the processor and the DMA
module
2. The address of the I/O device involved, communicated on
the data lines
3. The starting location in memory to read from or write to,
communicated on the data lines and stored by the DMA
module in its address register

CPU DMA module


1, 2,3,4
37

4. The number of words to be read or written, again


communicated via the data lines and stored in the data count
register.

The processor then continues with other work. It has given this
I/O operation to the DMA module. The DMA module transfers the
entire block of data, one word at a time, directly to or from
memory, without going through the processor.
1, 2,3,4

CPU DMA module memory


Send interrupt signal,
after complete.
When the transfer is complete, the DMA module sends an interrupt signal
to the processor. Thus, the processor is involved only at the beginning
and end of the transfer.
• Data transfer using DMA is faster than (programming and
interrupt).

• The CPU would inform the DMA controller what it should


do, and then the CPU can continue executing other
processes while the DMA controller uses the bus.

• During data transfer from peripheral ( I/O devices) to main


memory , DMA controller will control bus system.

• External peripheral / devices, will use interrupt technique to


tell DMA controller if there are a data to be transfer or not.
39

EXERCISE 1.4
1. Give two differences between serial and parallel
transfer.
2. State the type of communications that transmit
character of data in byte size in one time.
3. Draw the diagram of data transmissions of
“11001100” by using asynchronous serial transfer.
4. Draw the diagram of data transmissions of
“11001100” by using asynchronous serial transfer.
( using even parity)
40
41

Match terms with correct description


Method for managing I/O Description

Programming I/O Bypass CPU and allows an input/output (I/O)


device to send or receive data directly to or
from the main memory

Interrupt Driven Data transfer is direct control by processor


under driver software control to access
registers or memory on a device.

Processor continuously polls or test every


device in turn as whether it requires attention
( eg. has data to be transferred).

Direct Memory Access The CPU does not access a device until it
needs servicing,

The I/O module will interrupt the processor to


request service when it is ready to exchange
data with the processor.
42

1. There are THREE method for managing I/O modules.


Explain each mode of transfer.

2. Following is the disadvantages of Programming I/O


EXCEPT.
A. Performance of system are degraded because of waiting time
B. Too many devices need to check by processor
C. Processor need to wait for long time and must repeatedly
interrogate the status of the I/O module
D. The processor will issue an I/O command to a module and
then go on to do some other useful work.
43

You might also like