Unit-V Communication Interface Basics of Serial Communication

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

UNIT-V

COMMUNICATION INTERFACE
Basics of Serial communication
The transmission of binary data across a link can be accomplished either in parallel mode
or serial mode. In parallel mode, multiple bits are sent with each clock pulse. In serial
mode, one bit is sent with each clock pulse. While there is only one way to send parallel
data, there are two subclasses of serial transmission; synchronous and asynchronous

Parallel Transmission
Binary data, consisting of 1s and 0s, may be organized into groups of n bits each. By
grouping, we can send data n bits at a time instead of one. This is called parallel
transmission.
We use n wires to send n bits at one time. That way each bit has its own wire, and all n
bits of one group can be transmitted with each clock pulse from one device to another.
The Figure bellow shows how parallel transmission works for n = 8. Typically, the eight
wires are bundled in a cable with a connector at each end.

Parallel Transmission
The advantage of parallel transmission is speed. All else being equal, parallel
transmission can increase the transfer speed by a factor of n over serial transmission. A
significant disadvantage of parallel transmission is cost. Parallel transmission requires n

communication lines (wires in the example) just to transmit the data stream. Because
this is expensive, parallel transmission is usually limited to short distances.
Serial Transmission:
In serial transmission one bit follows another, so we need only one communication
channel rather than n to transmit data between two communicating devices.
The advantage of serial over parallel transmission is that with only one communication
channel, serial transmission reduces the cost of transmission over parallel by roughly a
factor of n.
Since communication within devices is parallel, conversion devices are required at the
interface between the sender and the line (parallel-to-serial) and between the line and
the receiver (serial-to-parallel).

Serial Transmission
Differences between Serial data transfer and Parallel data transfer
S.No

Serial Communication

Parallel Communication

Data is transmitted bit after the bit in a


single line

Data is transmitted simultaneously


through group of lines(Bus)

Data congestion takes place

No, Data congestion

Low speed transmission

High speed transmission

Implementation of serial links is not an


easy task.

Parallel
data
links
are
implemented in hardware

5.

In terms of transmission channel costs


such as data bus cable length, data bus
buffers, interface connectors, it is less
expensive
No effect of inter symbol interference
and noise

It is more expensive

The bandwidth of serial wires is much


higher.

easily

Parallel ports suffer extremely from


inter-symbol interference (ISI) and
noise, and therefore the data can be
corrupted over long distances.
The bandwidth of parallel wires is
much lower.

Serial interface is more flexible to


upgrade , without changing the hardware

Serial communication work effectively


even at high frequencies.

Parallel data transfer mechanism rely


on hardware resources and hence not
flexible to upgrade.
Parallel buses are hard to run at high
frequencies.

SERIAL DATA TRANSFER SCHEMES:


Serial transmission occurs in one of two ways; asynchronous or synchronous.
1. Asynchronous Transmission:
Asynchronous transmission is so named because the timing of a signal is
unimportant. Instead, information is received and translated by agreed-upon patterns.
Patterns are based on grouping the bit stream into bytes. Each group, usually eight bits,
is sent along the link as a unit.
To alert the receiver to the arrival of a new group, an extra bit is added to the beginning
of each byte. This bit, usually a 0, is called the start bit. To let the receiver know that
the byte is finished, one or more additional bits are appended to the end of the byte.
These bits, usually 1s, are called stop bits. By this method, each byte is increased in
size to at least 10 bits, of which 8 are information and 2 or more are signals to the
receiver. In addition, the transmission of each byte may then be followed by a gap of
varying duration. This gap can be represented either by an idle channel or by a stream
of additional stop bits.
In asynchronous transmission, we send one start bit (0) at the beginning and one or
more stop bits (1s) at the end of each byte. There may be a gap between each byte.
The start and stop bits and the gap alert the receiver to the beginning and end of each
byte and allow it to synchronize with the data stream. This mechanism is called
asynchronous because, at the byte level, sender and receiver do not have to be
synchronized. But within each byte, the receiver must still be synchronized with the
incoming bit stream. That is, some synchronization is required, but only for the duration
of a single byte. The receiving device resynchronizes at the onset of each new byte.
When the receiver detects a start bit, it sets a timer and begins counting bits as they
come in. After n bits, the receiver looks for a stop bit. As soon as it detects the stop bit it
ignores any received pulses until it detects the next start bit.
Asynchronous here means asynchronous at the byte level, but the bits are
still synchronized; their durations are the same.
The following Figure is a schematic illustration of asynchronous transmission. In this
example, the start bits are 0s, the stop bits are 1s, and the gap is represented by an idle
line rather than by additional stop bits.

Asynchronous transmission

Asynchronous transmission is slower than other forms of transmission because of the


addition of control information. But it is cheap and effective, two advantages that make
it an attractive choice for situations like low-speed communication. For example, the
connection of a terminal to a computer is a natural application for asynchronous
transmission. A user types only one character at a time, types extremely slowly in data
processing terms, and leaves unpredictable gaps of time between each character.
2. Synchronous Transmission
In synchronous transmission, the bit stream is combined into longer "frames," which
may contain multiple bytes. Each byte, however, is introduced onto the transmission link
without a gap between it and the next one. It is left to the receiver to separate the bit
stream into bytes for decoding purposes. In other words, data are transmitted as an
unbroken string of 1s and 0s, and the receiver separates that string into the bytes, or
characters, it needs to reconstruct the information.
In synchronous transmission, we send bits one after another without start/stop bits or
gaps. It is the responsibility of the receiver to group the bits.
The following Figure gives a schematic illustration of synchronous transmission. We have
drawn in the divisions between bytes. In reality, those divisions do not exist; the sender
puts its data onto the line as one long string. The receiver counts the bits as they arrive
and groups them in eight-bit units.

The advantage of synchronous transmission is speed. With no extra bits or gaps to


introduce at the sending end and remove at the receiving end and, by extension, with
fewer bits to move across the link, synchronous transmission is faster than asynchronous
transmission. For this reason, it is more useful for high-speed applications like the
transmission of data from one computer to another.
Serial Communication Standards (or) Protocol:
The RS-232 interface is the Electronic Industries Association (EIA) standard for the
interchange of serial binary data between two devices.

Figure - Common RS-232 Connector Plugs


RS - 232C:

The TTL logic signals are not what is transmitted between equipment such as
modems computers and terminals.
One standard that describes the signals for communicating is the RS-232C
standard.
Defined in early 1960s, Serial, Asynchronous, Full duplex, 100ft+ cables
+12
SPACE = 0
+ 3
3
MARK = 1
12

o
o
o
o
o
o
o

This standard causes as much trouble as any standard you can name because it
deals with two types of equipment,
o Data communications equipment (DCE) and
o Data terminal equipment (DTE).
Typically, a modem is DCE and a terminal or computer is DTE.
The problem is that the cable to connect DCE to DTE is different from the cable to
connect DTE to DTE.
Also, nonstandard use of the control signals is a problem.
Murphys Law says that if you need to connect to a serial port, you always have
the wrong cable.
RS-232C specifies 25 signal pins with a
o male DTE connector and
o a female DCE connector.
Most of these signals are not used in most applications so a 9 pin subset is used.
Actually in some cases, only three wires are used.
The mark and space signals are inverted by the standard to the following levels:

A logic high or mark is between -3 V and -15 V under load

o
o

A logic low or space is between +3 V and +15 V under load.


Typically, +12 and -12 volts are used.
The voltage swing is > the TTL 5 volts for noise immunity.

Fig: Signal Conversion to and from TTL and RS-232C levels.

RS-232 Signals:

Serial ports RS-232 standard

Fig: Signals for a DTE (Data Terminal Equipment modem is a DCE (Data
Communication Equipment)

Signal meanings RS232:


o

Transmit data group


TD transmit data data from DTE to DCE
RTS ready to send DTE asserts before sending data and waits
for CTS before sending
CTS clear to send DCE sends in response to RTS
Receive data group
TD transmit data data from DCE to DTE
DSR data set ready DCE asserts before sending data and waits
for DTR before sending
DTR data terminal ready DTE sends in response to DSR
CD carrier detect modem is receiving a carrier from a modem
at other end
SG signal ground common return for all lines

PROGRAMMABLE COMMUNICATION INTERFACE (8251):


(Or)
8251 UNIVERSAL SYNCHRONOUS ASYNCHRONOUS RECEIVER TRANSMITTER
(USART)
The 8251 is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for
serial data communication. As a peripheral device of a microcomputer system, the 8251
receives parallel data from the CPU and transmits serial data after conversion. This
device also receives serial data from the outside and transmits parallel data to the CPU
after conversion.

Block diagram of the 8251 USART (Universal Synchronous Asynchronous


Receiver Transmitter)
The 8251 functional configuration is programed by software. Operation between the
8251 and a CPU is executed by program control. Table 1 shows the operation between a
CPU and the device.

Table 1 Operation between a CPU and 8251

D0 to D7 (l/O terminal): This is bidirectional data bus which receive control words and
transmits data from the CPU and sends status words and received data to CPU.
RESET (Input terminal): A "High" on this input forces the 8251 into "reset status." The
device waits for the writing of "mode instruction." The min. reset width is six clock inputs
during the operating status of CLK.
CLK (Input terminal): CLK signal is used to generate internal device timing. CLK signal
is independent of RXC or TXC. However, the frequency of CLK must be greater than 30
times the RXC and TXC at Synchronous mode and Asynchronous "x1" mode, and must
be greater than 5 times at Asynchronous "x16" and "x64" mode.
WR (Input terminal): This is the "active low" input terminal which receives a signal for
writing transmit data and control words from the CPU into the 8251.

RD (Input terminal): This is the "active low" input terminal which receives a signal for
reading receive data and status words from the 8251.
C/D (Input terminal): This is an input terminal which receives a signal for selecting
data or command words and status words when the 8251 is accessed by the CPU. If C/D
= low, data will be accessed. If C/D = high, command word or status word will be
accessed.
CS (Input terminal): This is the "active low" input terminal which selects the 8251 at
low level when the CPU accesses. Note: The device wont be in "standby status"; only
setting CS = High.
TXD (output terminal): This is an output terminal for transmitting data from which
serial-converted data is sent out. The device is in "mark status" (high level) after
resetting or during a status when transmit is disabled. It is also possible to set the
device in "break status" (low level) by a command.
TXRDY (output terminal): This is an output terminal which indicates that the 8251is
ready to accept a transmitted data character. But the terminal is always at low level if
CTS = high or the device was set in "TX disable status" by a command. Note: TXRDY
status word indicates that transmit data character is receivable, regardless of CTS or
command. If the CPU writes a data character, TXRDY will be reset by the leading edge or
WR signal.
TXEMPTY (Output terminal): This is an output terminal which indicates that the 8251
has transmitted all the characters and had no data character. In "synchronous mode,"
the terminal is at high level, if transmit data characters are no longer remaining and
sync characters are automatically transmitted. If the CPU writes a data character,
TXEMPTY will be reset by the leading edge of WR signal.
Note: As the transmitter is disabled by setting CTS "High" or command, data written
before disable will be sent out. Then TXD and TXEMPTY will be "High". Even if a data is
written after disable, that data is not sent out and TXE will be "High".After the
transmitter is enabled, it sent out. (Refer to Timing Chart of Transmitter Control and Flag
Timing)
TXC (Input terminal): This is a clock input signal which determines the transfer speed
of transmitted data. In "synchronous mode," the baud rate will be the same as the
frequency of TXC. In "asynchronous mode", it is possible to select the baud rate factor
by mode instruction. It can be 1, 1/16 or 1/64 the TXC. The falling edge of TXC sifts the
serial data out of the 8251.
RXD (input terminal): This is a terminal which receives serial data.
RXRDY (Output terminal): This is a terminal which indicates that the 8251 contains a
character that is ready to READ. If the CPU reads a data character, RXRDY will be reset
by the leading edge of RD signal. Unless the CPU reads a data character before the next
one is received completely, the preceding data will be lost. In such a case, an overrun
error flag status word will be set.
RXC (Input terminal): This is a clock input signal which determines the transfer speed
of received data. In "synchronous mode," the baud rate is the same as the frequency of

RXC. In "asynchronous mode," it is possible to select the baud rate factor by mode
instruction. It can be 1, 1/16, 1/64 the RXC.
SYNDET/BD (Input or output terminal): This is a terminal whose function changes
according to mode. In "internal synchronous mode." this terminal is at high level, if sync
characters are received and synchronized. If a status word is read, the terminal will be
reset. In "external synchronous mode, "this is an input terminal. A "High" on this input
forces the 8251 to start receiving data characters.
In "asynchronous mode," this is an output terminal which generates "high level"output
upon the detection of a "break" character if receiver data contains a "low-level" space
between the stop bits of two continuous characters. The terminal will be reset, if RXD is
at high level. After Reset is active, the terminal will be output at low level.
DSR (Input terminal): This is an input port for MODEM interface. The input status of
the terminal can be recognized by the CPU reading status words.
DTR (Output terminal): This is an output port for MODEM interface. It is possible to
set the status of DTR by a command.
CTS (Input terminal): This is an input terminal for MODEM interface which is used for
controlling a transmit circuit. The terminal controls data transmission if the device is set
in "TX Enable" status by a command. Data is transmittable if the terminal is at low level.
RTS (Output terminal): This is an output port for MODEM interface. It is possible to set
the status RTS by a command.

Control Words of 8251 USART:


There are two types of control word.
1. Mode instruction (setting of function)
2. Command (setting of operation)
1) Mode Instruction
Mode instruction is used for setting the function of the 8251. Mode instruction will be in
"wait for write" at either internal reset or external reset. That is, the writing of a control
word after resetting will be recognized as a "mode instruction."
Items set by mode instruction are as follows:

Synchronous/asynchronous mode
Stop bit length (asynchronous mode)
Character length
Parity bit
Baud rate factor (asynchronous mode)
Internal/external synchronization (synchronous mode)
Number of synchronous characters (Synchronous mode)

The bit configuration of mode instruction is shown in Figures 2 and 3. In the case of
synchronous mode, it is necessary to write one-or two byte sync characters. If sync
characters were written, a function will be set because the writing of sync characters
constitutes part of mode instruction.

10

Figure 2: Bit Configuration of Mode Instruction (Asynchronous)

Figure 3: Bit Configuration of Mode Instruction (Synchronous)


2) Command

11

Command is used for setting the operation of the 8251. It is possible to write a
command whenever necessary after writing a mode instruction and sync characters.
Items to be set by command are as follows:

Transmit Enable/Disable
Receive Enable/Disable
DTR, RTS Output of data.
Resetting of error flag.
Sending to break characters
Internal resetting
Hunt mode (synchronous mode)

Figure 4: Bit Configuration of Command


Status Word:
It is possible to see the internal status of the 8251 by reading a status word. The bit
configuration of status word is shown in Fig. 5.

12

Figure 5: Bit Configuration of Status Word

IEEE-488 BUS:
In the early 1970's, Hewlett-Packard came out with a standard bus (HP-IB) to
help support their own laboratory measurement equipment product lines, which later
was adopted by the IEEE in 1975. This is known as the IEEE Std. 488-1975. The IEEE488 Interface Bus (HP-IB) or general purpose interface bus (GP-IB) was developed to
provide a means for various instruments and devices to communicate with each other
under the direction of one or more master controllers. The HP-IB was originally intended
to support a wide range of instruments and devices, from the very fast to the very slow.
Description:
The HP-IB specification permits up to 15 devices to be connected together in any given
setup, including the controller if it is part of the system. A device may be capable of any
other three types of functions: controller, listener, or talker. A device on the bus may
have only one of the three functions active at a given time. A controller directs which
devices will be talkers and listeners. The bus will allow multiple controllers, but only one
may be active at a given time.
Each device on the bus should have a unique address in the range of 0-30. The
maximum length of the bus network is limited to 20 meters total transmission path
length. It is recommended that the bus be loaded with at least one instrument or device
every 2 meter length of cable (4 meters is maximum). The use of GP-IB extenders may
be used to exceed the maximum permitted length of 20 meters.
IEEE-488 devices

13

The IEEE-488 standard provides for the following categories of device: listeners, talkers,
talkers and listeners, and controllers. We shall briefly examine the role of each type of
device.
Listeners
Listeners can receive data and control signals from other devices connected to the bus
but are not capable of generating data. An obvious example of a listener is a signal
generator.
Talkers
Talkers are only capable of placing data on the bus and cannot receive data. Typical
examples of talkers are magnetic tape, magnetic stripe, and bar code readers. Note that,
whilst only one talker can be active (i.e. presenting data to the bus) at a given time, it is
possible for a number of listeners to be simultaneously active (i.e. receiving and/or
processing the data).
Talkers and listeners
The function of a talker and listener can be combined in a single instrument. Such
instruments can both send data to and receive from the bus. A digital multi-meter is a
typical example of a talker and listener. Data is sent to it in order to change ranges and
returned to the bus in the form of digitized readings of voltage, current, and resistance.
Controllers
Controllers are used to supervise the flow of data on the bus and provide processing
facilities. The controller within an IEEE-488 system is invariably a microcomputer and,
whilst some manufacturers provide dedicated microprocessor-based IEEE-488
controllers, this function is often provided by means of a PC or PC-compatible
microcomputer.
The GP-IB defines operation of a three-wire handshake that is used for all data transfers
on the bus. The bus operation is asynchronous in nature. The data-transfer rate of the
GP-IB is 500 kHz for standard applications and can go up 1 MHz if special conventions
are followed. Each transaction carries 8 bits, the maximum data bandwidth is on the
order of 4 to 8 megabits (1 M byte) per second. The bus is a two way communications
channel and data flows in both directions. Figure illustrates the structure of the GP-IB
bus and identifies the 16 connections of the interconnecting cable.

Figure: GP-IB Instrumentation Bus Structure

14

The cabling limitations make it a less-than-ideal choice for large separation between
devices. These limitations can be overcome with bus extenders. Those attempting to use
bus extenders should be aware that few extenders are as transparent as claimed. This is
especially true in handling of continuous data and interrupts. In non-extended
environments, it provides an excellent means for high-speed computer control of
multiple devices.

IEEE-488 bus signals


The operation of GPIB is based around the handshaking protocol. Three lines, DAV (DAta
Valid), NDAC (Not Data ACepted), and NRFD (Not Ready For Data), control this. All the
listeners on the bus use the NRFD line to indicate their state of readiness to accept data.
If one listener holds the line low then this prevents any data transfer being initiated. This
means that when all the instruments are ready as indicated by the NRFD being line is
high and then data can be transferred. Once all the instruments have released the NRFD
line and it is in the high state, only then can the next stage be initiated.
Data is placed onto the data lines by the talker and once this has settled, the DAV line is
pulled low. This signals to all the listeners that they are able to read the data that is
present. During this operation the NDAC line will be held low by all the active listeners,
i.e. those which have been instructed to receive the data. Only when they have read the
data will each device stop trying to hold this line low. When the last device removes its
hold, the level of the line will rise and the talker will know that all the data has been
accepted and the next byte of data can be transferred.

GPIB / IEEE 488 handshaking protocol


By transferring data in this way the data is placed onto the bus at a rate which is
suitable for the talker, and it is held until the slowest listener has accepted it. In this way
the optimum data transfer rate is always used, and there are no specifications and
interface problems associated with the speeds at which data must be transferred.

IEEE 488 bus management:


1. Attention, ATN line: One of the most important lines is the ATN (Attention) line.
Using this the controller is able to signal whether the data to be placed onto the data
lines is control information or data. When the line is pulled low then the bus is said to
be in command mode and bus commands may be placed onto the bus. These
commands are the same for all bus systems and each device is programmed to
respond to any commands that have a useful or applicable meaning. One of the most
common bus commands is to give the address of an instrument to which data is

15

about to be sent. In addition to this when the line is pulled low it causes any talker to
relinquish its control of the DAV line and cease its data transmission. Another result
is that all listeners whether active or not will listen to the control data being
transmitted.
When the ATN line is high the bus is said to be in data mode and data transfers
between the instruments can take place. In command mode not all the data lines are
used. Bit seven is ignored, whilst bits five and six indicate the type of information to
be transmitted. It may be a bus command, a talk address, or a listen address.

2. Interface Clear, IFC; The IFC line is used by the controller to reset the bus and
place it into its quiescent state. Any talker or listener which is active is stopped and
control is returned to the controller. This is not used in the course of normal
operation. However it can be used when the system needs re-setting or at initial
power up when the bus may be in a random state.
3. Remote Enable, REN: Remote enable (REN) is a function that is used by the
controller to set instruments on the bus to local i.e. front panel control or to bus
control. Bus controlled instruments may be returned to their local state by a go to
local message sent in conjunction with the ATN line being pulled low.
4. End or Identify, EOI: End or Identify (EOI) is an optional GPIB function used to
signify the end of a multiple byte data transfer. As an alternative, talkers can use a
carriage return or carriage return line feed to terminate the message. This can then
be interpreted by the controlled dependent upon how its software is configured.
5. Service Request, SRQ The next control line is SRQ or service request. Any device
fitted with this function can pull the service request line low. When this happens it
indicates that it wants to interrupt the current activities so that attention can be
given to a particular event. One instance where this facility is needed is when a
printer runs out of paper, or in another instance, an instrument may be overloaded
or "over-ranged". Once the SRQ line has been pulled low, the controller then has to
identify which instrument has caused the interrupt. A process called polling
accomplishes this. Essentially this just requests status information from the devices
on the bus.
Advantages

Simple & standard hardware interface


Interface present on many bench instruments
Rugged connectors & connectors used (although some insulation displacement
cables appear occasionally).
Possible to connect multiple instruments to a single controller

Disadvantages

Bulky connectors
Cable reliability poor - often as a result of the bulky cables.
Low bandwidth - slow compared to more modern interfaces
Basic IEEE 422 does not mandate a command language (SCPI used in later
implementations but not included on all instruments.

16

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy