Sie sind auf Seite 1von 14

Serial Data

Communication
Varun Garg
Akshat Gupta

Contents
Parallel

and Serial communication


Asynchronous and Synchronous
Duplex and Simplex
Basics of Serial Communication
Transmission Requirements

Parallel and Serial communication

Parallel Communication (Printer)

Fast
Distance cannot be great
Expensive

Serial

Communication (Telephone line)


Slower
Long distance
cheaper

Asynchronous and Synchronous


Two methods of Serial Communication
Synchronous: Transfer block of data (characters)
at time.
Asynchronous: Transfer a single byte at a time.
You could write S/W to use either of these methods,
but the programs can be tedious and long. So, H/W
is developed instead.
This H/W is called UART or USART
UART: Universal Asynchronous Receiver-Transmitter
USART: Universal Synchronous-Asynchronous
ReceiverTransmitter
The 8051 chip has a built-in UART.

Duplex and Simplex


Duplex

Simplex

(only transmit)

Duplex
Full

Duplex: Data is transmitted both way at


the same time.

Half

Duplex: Data is transmitted one way at a


time.

Basics of Serial
Communication
Bit

rate:
-Number of bits sent every second (BPS)
Baud

rate:
-Number of symbols sent every second, where every symbol can
represent more than one bit.
Ex.

high-speed modems which use phase shifts to make every data


transition period represent more than one bit.

For

the PIC 16f877As USART, with every clock tick one bit is sent,
each symbol represents one bit.

So,

we can consider bit rate and baud rate the same thing.

Transmission Requirements

Before transmission begins, transmitter and


receiver must agree on :
- Baud rate (75, 150, 300, 600, etc)
- 1, 1.5 or 2 stop bits
- 5, 6, 7 or 8 data bits
- even, odd or no parity

UART Block Diagram

UART Block
Each

UART is accessed by two SFRsSBUFx


and SCONx
The Serial Port Buffer (SBUFx) is essentially two
buffers: writing loads data to be transmitted to
the buffer and reading accesses received data
from the buffer.
These are two separate and distinct buffers
(registers): the transmit write-only buffer and
the receive read-only register

UART Block (cont)


The

Serial Port Control register (SCONx)


contains status and control bits.
The control bits set the operating mode for the
serial port, and status bits indicate the end of
the character transmission or reception
The status bits are tested in software (polling)
or programmed to cause an interrupt

UART Block (cont)

UART Clock Requirements


A

UART needs a clock input for bit timing.


UART baud rates are usually much lower than
the MCU system clock, so the system clock
cannot be directly used as the UART clock.
Timers are used to generate the UART baud
rate by dividing down the system clock.
A bit time accuracy of 2% or better is
required at both the transmitter and receiver
ends to be able to communicate without
errors.

Applications
Communication

between distant computers


Serializes data to be sent to modem
De-serializes data received from modem