Unit-V Communication Interface Basics of Serial Communication
Unit-V Communication Interface Basics of Serial Communication
Unit-V Communication Interface Basics of Serial Communication
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
Parallel
data
links
are
implemented in hardware
5.
It is more expensive
easily
Asynchronous transmission
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:
o
o
RS-232 Signals:
Fig: Signals for a DTE (Data Terminal Equipment modem is a DCE (Data
Communication Equipment)
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.
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
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)
12
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.
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.
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
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