34 Input - Output - and - Communication Systems
34 Input - Output - and - Communication Systems
1
Introduction
3
Interface requirements
• Electrical buffering/isolation:
– when peripherals operates at a different current/voltage
that on the microprocessor bus system or there are
different ground references.
• Timing control-
– It is needed when the data transfer rates of the peripheral
and the microprocessor are different i.e. interfacing a
microprocessor to a slower peripherals.
4
• This can be achieved by using special lines between the
microprocessor and the peripheral to control the transfer of data.
Such lines are called handshake lines and the process is called
handshaking.
• Code Conversion:
– Required when codes used by peripherals are different to that
used by microprocessor.
• Changing the number of lines-
– microprocessor uses 4 bits, 8 bits or 16 bits. This determines the
no. of lines in microprocessor data bus. Peripherals may have
different no. of lines.
5
• Serial to parallel and vice versa data transfer-
– a 8 bit microprocessor manipulates 8 bits of data at same
time. This can be done by parallel data transfer where all
data are send simultaneously whereas in serial data
transfer signals are send one by one.
• Conversion from analogue to digital and vice versa.
6
Buffers
• It does not change the logic of the input but just changes the
current or voltage levels. We can use amplifier.
7
Handshaking
8
Polling & Interrupts
9
Serial Interfacing
10
Peripheral Interface Adapters (PIA)
11
• MC6821 PIA
12
• The PIA contains two parallel data ports termed A and B. each
port has
• A peripheral interface register.
• A data direction register.
• A control register.
• Two control lines CA1 and CA2 or CB1 and CB2.
• Microprocessor address lines RS0 & RS1.
13
Initialisation of Peripherals
14
Communication Systems
• An external bus is a set of signal lines that interconnects
microprocessors, microcontrollers, computers and
programmable logic controllers (PLCs) and also connects them
with peripheral equipment.
• For example, in a car there are likely to be several
microcontrollers with each controlling a different part of the
system, e.g. engine management, braking and instrument panel,
and communication between them is necessary.
15
Centralized Computer Control
• Centralized computer control involves the use of one central
computer to control an entire plant.
• This has the problem that failure of the computer results in the
loss of control of the entire plant. This can be avoided by the use
of dual computer systems.
• Such centralized systems were common in the 1960s and 1970s.
The development of the microprocessor and the ever reducing
costs of computers have led to multi-computer systems
becoming more common and the development of hierarchical
and distributed systems.
16
Hierarchical System
• With the hierarchical system, there is a hierarchy of computers according
to the tasks they carry out.
• The computers handling the more routine tasks
are supervised by computers which have a greater decision-making role.
• For example, the computers which are used for direct digital control of
systems are subservient to a computer which performs supervisory
control of the entire system.
• The work is divided between the computers according to the function
involved.
• There is specialization of computers with some computers only receiving
some information and others different information.
17
Distributed System
18
Modern Systems
• In most modern systems there is generally a mixture of
distributed and hierarchical systems.
• For example, the work of measurement and actuation may be
distributed among a number of microcontrollers/ computers
which are linked together and provide the database for the
plant.
• These may be overseen by a computer used for direct digital
control or sequencing and this in turn may be supervised by
one used for supervisory control of the plant as a whole.
19
• Distributed/hierarchical systems have the advantage of
allowing the task of measurement scanning and signal
conditioning in control systems to be carried out by sharing it
between a number of microprocessors.
• This can involve a large number of signals with a high
frequency of scanning. If extra measurement loops are
required, it is a simple matter to increase the capacity of the
system by adding microprocessors.
• Failure of one unit does not result in failure of the entire
system.
20
Ways of Data
communication
Simplex mode
Half-duplex mode
Full-duplex mode
21
Parallel Data Transmission
• Parallel data buses transmit 8, 16 or 32 bits simultaneously, having a
separate bus wire for each data bit and the control signals.
• Thus, if there are eight data bits to be transmitted, e.g. 11000111,
then eight data wires are needed. The entire eight data bits are
transmitted in the same time as it takes to transmit one data bit
because each bit is on a parallel wire.
• Parallel data transmission permits high data transfer rates but is
expensive because of the cabling and interface circuitry required.
• It is thus normally only used over short distances or where high
transfer rates are essential.
22
Serial Data Transmission
23
• For example, with a car when a number of microcontrollers
are used, the connections between them are by serial data
transmission.
• Without the use of serial transmission the number of wires
involved would be considerable.
• Serial data transmission can be either asynchronous or
synchronous in nature.
24
• Asynchronous transmission:
• It implies that both the transmitter and receiver computers are not
synchronized, each having its own independent clock signals.
• The time between transmitted characters is arbitrary.
• Each character transmitted along the link is thus preceded by a start
bit to indicate to the receiver the start of a character, and followed
by a stop bit to indicate its completion.
• This method has the disadvantage of requiring extra bits to be
transmitted along with each character and thus reduces the
efficiency of the line for data transmission.
25
• With synchronous transmission there is no need for start and
stop bits since the transmitter and receiver have a common
clock signal and thus characters automatically start and stop
always at the same time in each cycle.
26
Rate of Data Transmission
• The rate of data transmission is measured in bits per second.
• If a group of 𝑛 bits form a single symbol being transmitted and
the symbol has a duration of 𝑇 seconds then
𝑟𝑎𝑡𝑒 𝑜𝑓 𝑑𝑎𝑡𝑎 𝑡𝑟𝑎𝑛𝑠𝑚𝑖𝑠𝑠𝑖𝑜𝑛 = 𝑛/𝑇
• The baud is the unit used. The baud rate is only the same as
the number of bits per second transmitted if each character is
represented by just one symbol.
• Thus a system which does not use start and stop pulses has a
baud rate equal to the bit rate.
27
Serial Data Communication Modes
28
2. Half-Duplex Mode:
• Data is transmitted in one direction at a time but the
direction can be changed.
• Terminals at each end of the link can be switched from
transmit to receive.
• Thus device A can transmit to device B and device B to device
A but not at the same time.
Transmit
A or receive B
29
3. Full-duplex mode
• Data may be transmitted simultaneously in both directions
between devices A and B.
• This is like a two-lane highway in which traffic can occur in
both directions simultaneously.
• The telephone system is an example of full-duplex mode in
that a person can talk and receive at the same time.
Transmit
A B
Receive
30
Networks
• Network is used for a system which allows two or more
computers/ microprocessors to be linked for the interchange
of data.
• The following are commonly used forms of network.
33
3. Ring:
– This is a very popular method for local area networks, involving each
station being connected to a ring. The distances between nodes are
generally less than 100 m. Data put into the ring system continues to
circulate round the ring until some system removes it. The data is
available to all the stations.
4. Mesh:
– This method has no formal pattern to the connections between
stations and there will be multiple data paths between them.
34
• Local area network (LAN) is used for a network over a local
geographic area such as a building or a group of buildings on
one site. The topology is commonly bus, star or ring.
• A wide area network is one that interconnects computers,
terminals and local area networks over a national or
international level.
35
Serial Communication Interfaces
• Serial interfacing can involve synchronous or asynchronous
protocols. Commonly used asynchronous interfaces are RS-232, the
20 mA current loop, I 2 C, CAN and USB.
RS-232
1. The most popular serial interface is RS-232. This was first defined by
the American Electronic Industries Association (EIA) in 1962.
2. RS-422 uses a pair of lines for each signal and can operate up to
about 1220 m or at higher transmission speeds up to 100 bits/s and
in noisier environments; maximum speed and maximum distance
cannot, however, be achieved simultaneously. RS-485 can be used
up to about 1220 m with speeds of 100 kbits/s.
36
• data terminal equipment
(DTE)
• data circuit-terminating
equipment (DCE)
37
The 20 mA current loop
• This uses a current signal rather than a voltage signal.
• A pair of separate wires is used for the transmission and the
receiver loops with a current level of 20 mA used to indicate a
logic 1 and 0 mA for logic 0.
• The serial data is encoded with a start bit, eight data bits and
two stop bits.
• Such current signals enable a far greater distance, a few
kilometers, between transmitter and receiver than with the
standard RS-232 voltage connections
38
20 mA Current
transmit Detector
Current 20 mA
Detector transmit
42
Controller Area Network (CAN) Bus
• CAN is a multi-master serial bus standard for connecting ECUs.
Each node in the system is able to both send and receive
messages and requires the following.
1. Host processor
2. CAN controller
3. Transceiver
43
Universal Serial Bus (USB)
• The Universal Serial Bus (USB) is designed to enable monitors,
printers, modems and other input devices to be easily
connected to PCs – the term plug-and-play is used.
• USB uses a star topology, thus only one device needs to be
plugged into a PC with other devices then being able to be
plugged into the resulting hub so resulting in a tiered star
topology.
• The low-speed version USB 1.0 specification was introduced in
1996 and has a transfer rate of 12 Mbits/s and is limited to
cable lengths of 3 m.
44
• The high-speed version USB 2.0 specification was introduced in
April 2000 and has a data transfer rate of 480 Mbits/s and is
limited to cable lengths of 5 m.
• A super speed USB 3.0 specification was released by Intel and
partners in August 2008 for a data transfer rate of 4.8 Gbits/s.
• Data is transmitted in half-duplex mode for USB 1.0 and
USB 2.0 with full-duplex being possible with USB 3.0
45
Firewire
46
Parallel Communication Interfaces
• The most commonly used parallel interface in communications is
the General Purpose Instrument Bus (GPIB), developed by
Hewlett Packard to link its computers and instruments and thus
often referred to as the Hewlett Packard Instrumentation Bus.
• Each of the devices connected to the bus is termed a listener,
talker or controller.
• Listeners are devices that accept data from the bus, talkers place
data, on request, on the bus and controllers manage the flow of
data on the bus by sending commands to talkers and listeners
and carry out polls to see which devices are active.
47
References
48
Thank You
49