Вы находитесь на странице: 1из 31

10.

10 SERIAL COMMUNICATION INTERFACE

Serial Communication Port: I/O interface, used to connect peripheral units,


such as CRT terminals, modems, and printers, to a microcomputer.

It permits data to be transferred between two units using just two data lines

One line is used for transmitting data and the other for receiving data.

Types of serial data communications.

Synchronous communications.

Asynchronous communications.
Synchronous communications
The receiver and transmitter sections of the two pieces of equipment communicating
with each other must run synchronously.

To initiate synchronous transmission, the transmitter first sends out synchronization


characters to the receiver.

The receiver reads the synchronization bit pattern and compares it to a known sync
pattern. Once they are identified as being the same, the receiver begins to read
character data off the data line.

Transfer of data continues until the complete


block of data is received.

If large blocks of data are being sent, the


synchronization characters may be
periodically resent to assure that
synchronization is maintained.

Used in applications where


high speed data transfer is
required.
Asynchronous communications

The asynchronous method of communication eliminates the need for the Clock signal.

The simplest form of an asynchronous communication interface could consist of a


Receive data, Transmit data, and Signal common communication line.
The data to be transmitted are sent out one character at a time, and at the receiver
examining synchronization bits that are included at the beginning and end of each
character performs end of the communication line synchronization.

The synchronization bit at the beginning of the


character is called the Start bit, and that at the
end of the character the stop bit.

Depending on the communications


scheme, 1, 1.5, or 2 stop bits can be used.

The bits of the character are embedded


between the start and stop bits.

7-bit ASCII can be used and parity


added as an eighth bit for higher
reliability in transmission.
Simplex, Half-Duplex, and Full-Duplex Communication Links
Baud Rate and the Baud-Rate Generator

Baud rate: The rate at which data transfers take place over the receive
and transmit lines.

By baud rate we mean the number of bits of data transferred per second.

some of the common data transfer rates 300 bps


1200 bps
9600 bps

Baud rate is set by a part of the serial communication interface called the
Baud rate generator.

The baud rate at which data are transferred determines the bit time, that
is, the amount of time each bit of data is on the communication line. At
300 baud rate, the bit time is found to be 3.33 ms.
The RS-232C Interface

is a standard hardware interface for implementing asynchronous serial data


communication ports on devices such as printer,CRT terminal, keyboards, and
modem.

Electronic Industries Association (EIA) defines the pin definitions and


electrical characteristics of this interfaces.

In large systems it is common to have the microcomputer part of the system


in a separate room from the terminals and printers.

This leads us to the main advantage of using a serial interface to connect


peripherals to a microcomputer, which is that as few as three signal lines
can be used to connect the peripheral to the MPU. a receive-data lin e, a
transmit-data line. and signal common.

This result in a large saving in wiring costs, and the small number of lines
that need to be put in place also leads to higher reliability.
The RS-232C Interface
Data Terminal Equipment (DTE) & Data Communications Equipment (DCE)

How the signals of the RS-232C interface are used in a device depends on whether it is
configured as DTE or DCE.

The direction for signals in a DTE and a DCE device are reversed.

That is, signal Lines that are outputs on a DTE device are inputs on a DCE
and vice versa.

For instance, if pin 2 on a DTE is an output, it connects directly to pin 2


on the DCE, which acts as an input.

when both devices are configured as DTEs, the data transmitted by


one is received by the other and vice versa.
Cont.
Cont.

The control pins are provided to set up a handshake sequence for initiating
communication between serial devices, like request to send (RTS).

In many systems only three signals TxD, RxD. and common are used to
provide serial communication. In such a set up no handshakes sequences
used to initiate communication.

The RS-232C interface is specified to operate correctly over a distance


of up to 100 feet

To satisfy this distances specification, bus driver is used on the transmit


line and a bus receiver is used on the receive line.

These buffers do both the voltage level translation needed to convert the
TTL compatible signals to the mark (logic 1) and space (logic 0) voltage
levels defined for the RS-232C interface
10.11 PROGMMMABLE COMMUNICATION INTERFACE CONTROLLERS

The functions of RS-232 are normally implemented with a programmable


communication controller known as Universal synchronous/asynchronous
receiver transmitter (USART).

The programmability of the USART provides for a very flexible asynchronous


communication interface.

Typically. it contains a full-duplex receiver and transmitter which can be


configured through software.
Character lengths between 5 and 8 bits.

even or odd parity

with 1, 1.5, or 2 stop bits

has the ability to automatically check characters during data reception to


detect the occurrence of parity, framing, and overrun errors.
8251A USART

Includes four key sections:

the bus interface section, which consists of the data bus buffer
and read/write control logic blocks.
the transmit section, which consists of the transmit buffer and
transmit control block.
the receive section, which consists of the receive buffer and
receive control block.
the modem-control section.
The receiver section

Is responsible for reading the serial bit stream of data at the RxD (receive data)
input and converting it to parallel form.

When a mark voltage level is detected on this line, indicating a start bit, the
receiver enables a counter

As the counter increments to a value equal to one-half a bit time, the logic
level at the RxD line is sampled again.

If it is still at the mark level, a valid start pulse has been detected.

Then RxD is examined every time the counter increments through another bit
time.

This continues until a complete character is assembled and the stop bit is
read.
After this, the complete character is transferred into the receive-data register.
During reception of a character

the receiver automatically checks the character data for parity, framing, or
overrun errors.
If one of these conditions occurs, it is flagged by setting a bit in the status
register.
Then the RxRDy (receiver ready) output is switched to the 1 logic level.

This signal is sent to the microprocessor to tell it that a character is available


and should be read from the receive-data register.

RxRDy is automatically reset to logic 0 when the MPU reads the contents of the
receive_data register.

Through software, the 8251A can be set up to internally divide the


Clock signal input at Rxc by 1, 16, or 64 to obtain the desired baud rate.
The transmitter section

does the opposite of the receiver section.

It receives parallel character data from the MPU over the data bus.

The character is then automatically framed with the start bit, appropriate
parity bit and the correct number of stop bits and put into the transmit-data
buffer register.

Then, the serial output on the TxD line will be sent.

The TxRDY output switches to logic 1, This signal can be returned to the MPU
to tell it that another character should be output to the transmitter section.

In most applications, the transmitter receiver operate on the same baud


rate. Therefore, the same baud-rate generator supplies both Rxc and Txc.
Receiver and transmitter driven at the same baud rate.
Configuration of 8251A

8251 can be configured for various modes of operation through software.

It has three internal control registers:

mode-control register
command register
status register.
Mode instruction
Format.

configuration for
asynchronous
communications
Command
instruction
Format.

For serial
interface
flags for the receiver

Status register
Initialization of 8251A
Answer = 5E

assume
EXAMPLE 10.31
Reset

Вам также может понравиться