|
UNIT – III |
||||||||||||||||||||||||||||||||||||||||
|
INTRODUCTION |
||||||||||||||||||||||||||||||||||||||||
|
Unit-03/Lecture-01 |
||||||||||||||||||||||||||||||||||||||||
|
Input Output
Organization ·
Modes
of data transfer ·
Interrupt
driven ·
Direct
memory access ·
Interrupt
structures ·
I/O
Interface ·
Asynchronous
data transfer ·
I/O
processor ·
8085
I/O structure ·
8085 instruction
set and basic programming ·
Data
transfer – Serial / parallel ·
synchronous/asynchronous ·
Simplex/half
duplex and full duplex Modes of data transfer Modes
of transfer refer to the various modes by which the data residing
in the memory is transferred to CPU or back
to memory. The need to transfer data: The data originates from
the input units. The originated data is then transferred
to the memory for storage. This binary data received from
any external device is in general stored in memory for later
processing. So there is need to transfer data . Then for processing
the data residing in memory is read by the computer brain
i.e. CPU for carrying out various operations and transforming it to
make it useful information. The CPU temporarily
stores data just for the time being of executing the operation.
After that the CPU also need to transfer
the information back to the memory. There
are lot of transferring between the CPU and
the memory for reading or writing
of data or information respectively. There are various
modes of transfer of data. Some uses the CPU as in between the
transfer and some directly transfers the data to and from
the memory unit. Data to and from the peripherals
are handled in one of the three possible modes: 1.
Programmed input-output 2.
Interrupt- initiated input output 3.
Direct memory access Programmed input-output Programmed I/O (PIO) refers to data transfers initiated by a CPU under
driver software control to access registers or memory on a device. The CPU issues a command then waits for I/O
operations to be complete. As the CPU is faster than the I/O module, the
problem with programmed I/O is that the CPU has to wait a long time for the
I/O module of concern to be ready for either reception or transmission of
data. The CPU, while waiting, must repeatedly check the status of the I/O
module, and this process is known as Polling. As a result, the level of the
performance of the entire system is severely degraded. Programmed I/O basically works in these ways:
Interrupt The CPU issues commands to the I/O module then
proceeds with its normal work until interrupted by I/O device on completion
of its work. ->
Here the program enters a wait loop in which it repeatedly checks the device
status. During this process the processor is not performing any useful
computation. ->There
are many situations where tasks can be performed while waiting for an I/O
device to be ready, to allow this the I/O device should alert the processor
when it becomes ready. It can be done by sending a hardware signal called
an interrupt. ->The routine executed in response to an interrupt
request is called Interrupt Service Routine(ISR). ->The
processor first completes execution of instruction then it loads the program counter(pc) with the
address of 1st instruction of ISR. For input, the device interrupts the
CPU when new data has arrived and is ready to be retrieved by the system
processor. The actual actions to perform depend on whether the device uses
I/O ports, memory mapping. For output, the device delivers an interrupt
either when it is ready to accept new data or to acknowledge a successful
data transfer. Memory-mapped and DMA-capable devices usually generate
interrupts to tell the system they are done with the buffer. Although Interrupt relieves the CPU of having to
wait for the devices, but it is still inefficient in data transfer of large
amount because the CPU has to transfer the data word by word between I/O
module and memory. Below are the basic operations of Interrupt:
DMA based data transfer
By DMA approach , large blocks of data at high
speed can be sent between external device and main memory. DMA CONTROLLER:- ->It allows the data transfer between I/O
device and memory. ->DMA controllers acts a processor but it is
controlled by the CPU. To initiate the transfer of a block of words, the
processor sends the following data to controller
->The DMA
controller performs the required I/O operation and send a interrupt to the
processor upon completition. Types of DMA
Transfer:-
Cycle
Stealing:- DMA controller ‘steals’ memory cycles from the
processor though processor originates most memory access. Allows DMA
controller to transfer one data word at a time after which it must
return control of the buses to the CPU. Brust
mode:- The DMA
controller may be given exclusive access to the main memory to transfer a
block of data without interruption. Conflicts Of
DMA:- ->Conflict
between processor and DMA ->Two DMA
Controller try to access the BUS at same time to access the main memory.
|
|
Unit-02/Lecture-03 |
|||||||||||||||||||||||||||
|
Fig:
Input/Output Interface Input-output interface provides a method for
transferring information between internal storage and external I/O devices.
Peripherals connected to a computer need special communication links for
interfacing them with the central processing unit. The purpose of the
communication link is to resolve the differences that exist between the
central computer and each peripheral. The major differences are:
To resolve these differences, computer systems include special hardware
components between the CPU and peripherals to supervise and synchronize all
input and output transfers. These components are called interface units
because they interface between the processor bus and the peripheral device. Need for I/O interface
There are two types for
interfacing I/O devices:
Isolated
I/O: Memory
- Mapped I/O:
Interface Circuits An I/O interface consists of the circuitry required to
connect an I/O device to a computer bus. On one side of the interface, we
have bus signals. On the other side,we have a data path with its associated
controls to transfer data between the interface and the I/O device – port. We
have two types: Serial port Parallel port A parallel port transfers data in the form of a number of
bits (8 or 16) simultaneously to or from the device. A serial port transmits
and receives data one bit at a time. Communication with the bus is the same
for both formats. The conversion from the parallel to the serial format, and
vice versa, takes place inside the interface circuit. In parallel port, the
connection between the device and the computer uses a multiple-pin connector
and a cable with as many wires. This arrangement is suitable for devices that
are physically close to the computer. In serial port, it is much more convenient
and cost-effective where longer cables are needed. Typically, the functions of an I/O interface are: • Provides a storage buffer for at least one word of data • Contains status flags that can be accessed by the
processor to determine whether the buffer is full or empty • Contains address-decoding circuitry to determine when it
is being addressed by the processor • Generates the appropriate timing signals required by the
bus control scheme • Performs any format conversion that may be necessary to transfer
data between the bus and the I/O device, such as parallel-serial
conversion in the case of a serial port Parallel Port The hardware components needed for connecting a keyboard to
a processor Consider the circuit of input interface which encompasses
(as shown in below figure): – Status flag, SIN – R/~W – Master-ready – Address decoder |
|||||||||||||||||||||||||||
|
Unit-02/Lecture-04 |
|||||||||||||||||||||||||||
|
Fig: Asynchronous data transfer The internal operations in a
digital system are synchronized by means of clock pulses supplied by a common
pulse generator. Clock pulses are applied to all registers within a unit and
all data transfers among internal registers occur simultaneously during the
occurrence of a clock pulse. Two units, such as a CPU and an I/O interface,
are designed independently of each other.
There are two types of asynchronous data transmittion
methods:- 1. Strobe control 2. Handshaking. Strobe Control
This method of asynchronous data transfer uses a single control line
to time each transfer. The strobe may be activated by the source or the
destination unit. (i) Source Initiated Data Transfer: ·
The data bus carries the information from source to
destination. The strobe is a single line. The signal on this line informs the
destination unit when a data word is available in the bus. ·
The strobe signal is given after a brief delay, after
placing the data on the data bus. A brief period after the strobe pulse is
disabled the source stops sending the data.
Fig: Source - initiated
strobe for data transfer (ii) Destination Initiated Data Transfer: ·
In this case the destination unit activates the strobe
pulse informing the source to send data. The source places the data on the
data bus. The transmission is stopped briefly after the strobe pulse is
removed. ·
The disadvantage of the strobe is that the source unit
that initiates the transfer has no way of knowing whether the destination
unit has received the data or not. Similarly if the destination initiates the
transfer it has no way of knowing whether the source unit has placed data on
the bus or not. This difficulty is solved by using hand shaking method of
data transfer.
Fig:Destination -
initiated strobe for data transfer
A Handshaking Protocol
Fig: A Handshaking Protocol
|
|||||||||||||||||||||||||||
|
Unit-02/Lecture-05 |
|||||||||||||||||||||||||||
|
I/O processor ·
The
concept of I/O processor is an extension of the concept of DMA. The I/O
processor can execute specialised I/O program residing in the memory without
intervention of the CPU. ·
Thus,
CPU only needs to specify a sequence of I/O activity to I/O processor. The
I/O processor then executes the necessary I/O instructions which are required
for the task; and interrupts the CPU only after the entire sequence of I/O
activity as specified by CPU have been completed. ·
An
advanced I/O processor can have its own memory, enabling a large set of I/O
devices to be controlled without much involvement from the CPU. ·
Thus,
an I/O processor has the additional ability to execute I/O instructions which
provide it a complete control on I/O operations. ·
Thus,
I/O processors are much more powerful than DMA which provides only a limited
control of I/O device. For example, if an I/O device is busy then DMA will
only interrupt the CPU and will inform the CPU again when the device is free
while I/O device and once it has found to be free go a head with I/O and when
I/O finishes, communicate it to the CPU. The I/O processor is termed as
channel in IMB machines. ·
In
computer systems which have IOPs the CPU normally do not execute I/O data
transfer instructions. ·
I/O instructions are stored in memory and
are executed by IOPs. The IOP can be provided with the direct access to the
memory and can control the system bus. ·
An IOP can execute a sequence of data
transfer instructions involving different memory regions and different
devices without intervention of the CPU.
Fig: Input/Output Processor Fig: I/O processor ·
Communicate
directly with all I/O devices. ·
Fetch
and execute its own instruction. »
IOP
instructions are specifically designed to facilitate I/O transfer »
DMAC
must be set up entirely by the CPU ·
Designed
to handle the details of I/O processing. ·
Command Instruction that are read form memory by an IOP Distinguish from
instructions that are read by the CPU Commands are prepared
by experienced programmers and are stored in memory Command word = IOP
program ·
CPU -
IOP Communication : Fig. 11-20 ·
Memory
units acts as a message center : Information ·
each
processor leaves information for the other
·
The IOP attaches to the system I/O bus
and one or more input/output adapters
(IOAs). The IOP processes instructions from the system and works with the
IOAs to control the I/O devices. ·
There are many different
kinds of IOPs. o
Some IOPs can only
support one type of I/O device. In this case the IOA is embedded in the IOP
so you can not remove the IOA or change it. o
Some IOPs can support
multiple device types, but only one at a time. The type of IOA that is attached
determines what device can be used. IOAs on these IOPs can be changed with
another IOA to support a different I/O device. o
Some IOPs can support
multiple types of I/O devices at the same time. These are known as MFIOPs
or CFIOPs
(this depends on the type of IOP). IOAs for the supported types of I/O
devices attach to the IOP. ·
There are several
important I/O devices in the system. These include the load source disk unit,
the alternate IPL device, the console, and the electronic customer support
hardware. The system needs to know where to locate these special devices on
secondary partitions. When you create a logical partition, you need to
identify the IOPs that control these important devices: o
The IOP that controls the
disk unit
that will be the load source. o
The IOP that controls the
console. o
The IOP that controls the
alternate IPL device. o
The IOP that controls the
electronic customer support line.
·
IOPs must remain
dedicated to a single logical partition. You can not share them. All devices
connected to an IOP are bound to the same logical partition. You can not
switch one I/O device to another logical partition without switching all devices
on the IOP. ·
On a shared bus, you can
add and remove IOPs from a logical partition without restarting the system. Three characteristics
are useful in organizing the wide variety of I/O systems. Ø Behavior : Input (read once), Output (write only) or storage
Ø Partner: Either Human or a machine at the end of the I/O
device. Ø Data rate : The peak rate at which the data can be
transferred between the i/o devices and main memeory or processor. Ex : A key board,
i/p device used by a human with data rate about 10 bytes per second. Fig:A typical
collection of I/O devices
|
|
Unit-03/Lecture-06 |
||||||||||||
|
8085 I/O structure ·
The 8085 supported up to 256 input/output (I/O) ports, accessed via dedicated
Input/Output instructions—taking port addresses as operands. This I/O mapping
scheme was regarded as an advantage, as it freed up the processor's limited
address space. The IN and OUT instructions are used to read and write I/O
port data. ·
8085 Micro Processor is single board
Microprocessor training/ Development Kit configured around the most widely
used Microprocessor of todays world. Based on 8085 Microprocessor, it can be
used to train engineers to control any industrial process and to develop
software for 8080 and 8085 based systems. ·
The 8085 communicates with the outside
world through a key board having 28 keys and seven segement hexadecimal
displays. The kit also has the capability of interacting with CRT Terminal
and IBM PC compatible computer system through the serial interface provided
on the board. ·
The 8085 model has an extra on board
facility of audio cassette interface. ·
The
I/O devices are not given separate addresses other than memory i.e. 0000 to
FFFF.(64k).but part of the space is reserved for I/O devices. The advantage
is any instruction that references memory can also transfer data between an
I/O device and the ·
Consider
an example in which address bit A15 designates whether
instructions reference memory or an I/O device.2f A15= 0, a memory
register is addressed; If A15= 1, than a memory mapped I/O device
is address .this assignment elevates the first 32kbytess of memory address
space to memory and second 32k to memory mapped I/O devices. External logic
generates devices select pulses for memory mapped I/O only when ·
Input
and output transfer using memory mapped I/O are not limited to the
accumulator. For example, same of 8085 A instructions that can be used for
input from memory mapped I/O ports. MOV r, m
move the connects of input port whose address is available in (H,L) reg pair
to any internal register. LDA addr load the acc with the
content of the input port whose address is available as a second and third
byte of the instruction. ·
Other
instructions include, ANA M, ADD M, 1HD add (input from two ports and store
the contents is reg pair (L) and (H) ADD M and ANA M provide input data
transfer and computation in a single instruction. same instruction that out
the data from memory mapped ports are
MOV M,r
STA addr
MVI M, data
SHLD addr ·
LHLD
and SHLD carry out 16- bit I/O transfers with single instructions which
reduce program executive time considerably. The price paid for this added
capability is a reduction in directly addressable main memory and the
necessity of decoding a 16- bit rather than an 8-bit address. ·
When a
microprocessor puts out an address and generates a control strobe for a
memory read, it has no way of determining whether the device that responds
with data is a memory device or an I/O device; nor does it care. If only
requires that the devices that respond does so with in the allowable access
time or uses the READY line to request a sufficient number of WAIT states.
The some of true when a |
||||||||||||
|
Unit-03/Lecture-07 |
||||||||||||
|
Instruction
Set of 8085: An
Instruction is a command given to the computer to perform a specified
operation on given data. The instruction set of a microprocessor is the
collection of the instructions that the microprocessor is designed to
execute. The instructions described here are of Intel 8085. These
instructions are of Intel Corporation. They cannot be used by other
microprocessor manufactures. The programmer can write a program in assembly
language using these instructions. These instructions have been classified
into the following groups: 1.
Data Transfer Group 2.
Arithmetic Group 3.
Logical Group 4.
Branch Control Group 5.
I/O and Machine Control Group Data Transfer Group Instructions,
which are used to transfer data from one register to another register, from
memory to register or register to memory, come under this group. Examples
are: MOV, MVI, LXI, LDA, STA etc. When an instruction of data transfer group
is executed, data is transferred from the source to the destination without
altering the contents of the source. For example, when MOV A, B is executed
the content of the register B is copied into the register A, and the content
of register B remains unaltered. Similarly, when LDA 2500 is executed the
content of the memory location 2500 is loaded into the accumulator. But the
content of the memory location 2500 remains unaltered.
Arithmetic Group The
instructions of this group perform arithmetic operations such as addition,
subtraction; increment or decrement of the content of a register or memory.
Examples are: ADD, SUB, INR, DAD etc.
The instruction DAA is used in the
program after ADD, ADI, ACI, ADC, etc instructions. After the execution of
ADD, ADC, etc instructions the result is in hexadecimal and it is placed in
the accumulator. The DAA instruction operates on this result and gives the
final result in the decimal system. It uses carry and auxiliary carry for
decimal adjustment. 6 is added to 4 LSBs of the content of the accumulator if
their value lies in between A and F or the AC flag is set to 1. Similarly, 6
is also added to 4 MSBs of the content of the accumulator if their value lies
in between A and F or the CS flag is set to 1. All status flags are affected.
When DAA is used data should be in decimal numbers. Logical Group The
Instructions under this group perform logical operation such as AND, OR,
compare, rotate etc. Examples are: ANA, XRA, ORA, CMP, and RAL etc.
The 2nd byte of the instruction is data,
and it is subtracted from the content of the accumulator. The status flags
are set according to the result of subtraction. But the result is discarded.
The content of the accumulator remains unchanged.
The content of the accumulator is rotated
left by one bit. The seventh bit of the accumulator is moved to carry bit as
well as to the zero bit of the accumulator. Only CS flag is affected.
The content of the accumulator is rotated
right by one bit. The zero bit of the accumulator is moved to the seventh bit
as well as to carry bit. Only CS flag is affected.
Branch Control Group This
group includes the instructions for conditional and unconditional jump, subroutine
call and return, and restart. Examples are: JMP, JC, JZ, CALL, CZ, RST etc.
CALL instruction is used to call a
subroutine. Before the control is transferred to the subroutine, the address
of the next instruction of the main program is saved in the stack. The
content of the stack pointer is decremented by two to indicate the new stack
top. Then the program jumps to subroutine starting at address specified by
the label.
I/O and Machine Control Group This
group includes the instructions for input/output ports, stack and machine
control. Examples are: IN, OUT, PUSH, POP, and HLT etc.
|
||||||||||||
|
Unit-03/Lecture-08 |
||||||||||||
|
Data
transfer – A given transmission on a communications channel between two
machines can occur in several different ways. The transmission is
characterised by: ·
the direction of the exchanges ·
the transmission mode: the number of bits sent simultaneously ·
synchronization between the transmitter and receiver Serial
/ parallel The transmission mode refers
to the number of elementary units of information (bits) that can be
simultaneously translated by the communications channel. Parallel connection Parallel
connection means simultaneous transmission of N bits. These
bits are sent simultaneously over N different channels (a
channel being, for example, awire, a cable or any other physical
medium). The parallel connection on PC-type
computers generally requires 10 wires.
These
channels may be: ·
N physical lines: in which case each bit is sent on a
physical line (which is why parallel cables are made up of several wires in a
ribbon cable) ·
one physical line divided into several sub-channels by
dividing up the bandwidth. In this case, each bit is sent at a different
frequency...
Since the conductive wires are close to each
other in the ribbon cable, interference can occur (particularly at high
speeds) and degrade the signal quality... Serial connection In
a serial connection, the data are sent one bit at a time over the
transmission channel. However, since most processors process data in
parallel, the transmitter needs to transform incoming parallel data into
serial data and the receiver needs to do the opposite.
These operations are performed by a
communications controller (normally aUART (Universal
Asynchronous Receiver Transmitter) chip). The communications controller
works in the following manner: ·
The parallel-serial transformation is performed using a shift register.
The shift register, working together with a clock, will shift the register
(containing all of the data presented in parallel) by one position to the
left, and then transmit the most significant bit (the leftmost one) and so
on:
·
The serial-parallel transformation is done in almost the same way using a
shift register. The shift register shifts the register by one position to the
left each time a bit is received, and then transmits the entire register in
parallel when it is full:
|
||||||||||||
|
Unit-03/Lecture-09 |
||||||||||||
Synchronous and asynchronous transmission
Given the problems
that arise with a parallel-type connection, serial connections are normally
used. However, since a single wire transports the information, the problem is
how to synchronize the transmitter and receiver, in other words, the receiver
can not necessarily distinguish the characters (or more generally the bit
sequences) because the bits are sent one after the other. There are two types
of transmission that address this problem: ·
An
asynchronous connection, in
which each character is sent at irregular intervals in time (for example a
user sending characters entered at the keyboard in real time). So, for
example, imagine that a single bit is transmitted during a long period of
silence... the receiver will not be able to know if this is 00010000,
10000000 or 00000100... To remedy this
problem, each character is preceded by some information indicating the start
of character transmission (the transmission start information is called a START
bit) and ends by sending end-of-transmission information (called STOP
bit, there may even be several STOP bits). In asynchronous
transmission, data is coded into a series of pulses, including a start bit
and a stop bit. A start bit is sent by the sending modem to inform the
receiving modem that a character is to be sent. The character is then sent,
followed by a stop bit designating that the transfer of that bit is complete. Two Asynchronous Data
Transfer Methods Strobe
pulse - A strobe pulse is supplied by one unit
to indicate the other unit when the transfer has to occur. -
Employs a single control line to time each transfer. -
The strobe may be activated by either the source or the destination
unit. Handshaking - A control signal is accompanied with
each data being transmitted to indicate the presence of data - The receiving unit responds with
another control signal to acknowledge receipt of the data. Source-Initiated Strobe for Data Transfer
HANDSHAKING Strobe
Methods Source-Initiated The source unit that initiates
the transfer has no way of knowing whether the destination unit has actually
received data Destination-Initiated The destination unit that
initiates the transfer no way of knowing whether the source has actually
placed the data on the bus. ·
In a synchronous
connection, the transmitter and receiver are paced by the same clock. The
receiver continuously receives (even when no bits are transmitted) the
information at the same rate the transmitter send it. This is why the
transmitter and receiver are paced at the same speed. In addition,
supplementary information is inserted to guarantee that there are no errors
during transmission.
In synchronous data transmission, data is sent via a bit-stream, which
sends a group of characters in a single stream In order to do this, modems
gather groups of characters into a buffer, where they are prepared to be sent
as such a stream. In order for the stream to be sent, synchronous modems must
be in perfect synchronization with each other. They accomplish this by
sending special characters, called synchronization, or syn, characters. When
the clocks of each modem are in synchronization, the data stream is sent.
The main
disadvantage of synchronous transmission is recognising the data at the
receiver, as there may be differences between the transmitter and receiver
clocks. That is why each data transmission must be sustained long enough for
the receiver to distinguish it. As a result, the transmission speed can not
be very high in a synchronous link. Simplex, half-duplex and full-duplex connections
There are 3
different transmission modes characterised according to the direction of the
exchanges: ·
A simplex
connection is a
connection in which the data flows in only one direction, from the
transmitter to the receiver. This type of connection is useful if the data do
not need to flow in both directions (for example, from your computer to the
printer or from the mouse to your computer...).
·
A
half-duplex connection (sometimes
called an alternating
connection orsemi-duplex)
is a connection in which the data flows in one direction or the other, but
not both at the same time. With this type of connection, each end of the
connection transmits in turn. This type of connection makes it possible to
have bidirectional communications using the full capacity of the line.
·
A
full-duplex connection is a
connection in which the data flow in both directions simultaneously. Each end
of the line can thus transmit and receive at the same time, which means that
the bandwidth is divided in two for each direction of data transmission if
the same transmission medium is used for both directions of transmission.
|