Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Devasi Sir Serial

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

Serial Communication

Serial v/s Parallel Communication


Serial v/s Parallel Communication

Parallel Communication Serial Communication


Often 8 or more lines (wire conductors) The data is sent one bit at a time on a
are used to transfer data. Multiple bits single line (wire)
are transferred at a time.
Preferred for short-distance Preferred over long-distance
communication communication
Costly as more resources are required Comparatively cheaper
Speed of data transfer is high Slow
Example: SPI, I2C, UART Example: PCI
Basics of Serial Communication
• Serial communication uses single data line making it much cheaper
• Enables two computers in different cities to communicate over the
telephone
• Byte of data must be converted to serial bits using a parallel-in-serial-
out shift register and transmitted over a single data line
• At the receiving end there must be a serial-in-parallel-out shift
register
• If transferred on the telephone line, it must be converted to audio
tones by modem for short distance
Modes of Serial Communication
Modes of Serial Communication
• In simplex transmissions, the computer can only send data. There is
only one wire.
• If the data can be transmitted and received, then it is a duplex
transmission
• Duplex transmissions can be half or full duplex depending on
whether or not the data transfer can be simultaneous
• If the communication is only one way at a time, it is half duplex
• If both sides can communicate at the same time, it is full duplex
 Full duplex requires two wire conductors for the data lines
(in addition to the signal ground)
Basics of Serial Communication
• Serial Communication can be
 Asynchronous
 Synchronous
Synchronous Communication
• Synchronous methods transfer a block of data (characters) at a time
• The events are referenced to a clock
• Example: SPI bus, I2C bus
Asynchronous Communication
• Asynchronous methods transfer a single byte at a time
• There is no clock. The bytes are separated by start and stop bits.
• Example: UART
Basics of Serial Communication
• To support serial communication, special interfaces are built in the
microcontroller.
• The microcontrollers use special IC chips called UART (universal
asynchronous receiver-transmitter) and USART (universal
synchronous asynchronous receiver-transmitter)
• 8051 chip has a built-in UART
Data Framing in Asynchronous Serial
Communication
• Data is transmitted in 0s and 1s
• To have a sense of synchronization between transmitter and
receiver and to make sense of the data, transmitter and receiver
agree on a set of rules i.e protocol, which describes
 how the data is packed
 how many bits constitute a character
 when the data begins and ends
Data Framing in Asynchronous Serial
Communication
Start and stop bits
• Each character is placed between start and stop bits. This is called
framing.
• Start bit is always one bit, stop bit can be one, two or one and half
bits
• In 8051 serial port, when there is no transmission, the TxD line is
held high. This is called mark.
• Start bit is always a 0 (low), stop bit(s) is 1 (high)
• LSB is sent out first
Data Framing in Asynchronous Serial
Communication
Framing ASCII A

• The transmission begins with a start bit, followed by the LSB(D0),


then the rest of the bits until MSB (D7), and finally, the one stop
bit indicating the end of the character
• When there is no transfer, the signal is 1 (high), which is referred
to as mark
Data Framing in Asynchronous Serial
Communication
• Assuming that we are transferring a text file of ASCII
characters using 1 stop bit, we have a total of 10 bits for each
character
 This gives 25% overhead, i.e. each 8-bit character with an
extra 2 bits
• In some systems in order to maintain data integrity, the parity
bit of the character byte is included in the data frame
 UART chips allow programming of the parity bit for odd-,
even-, and no-parity options
Data Transfer Rate in Asynchronous
Serial Communication
• The rate of data transfer in serial data communication is stated in
bps (bits per second)
• Another widely used terminology for bps is baud rate
 It is modem terminology and is defined as the number of signal
changes per second
 In modems, there are occasions when a single change of signal
transfers several bits of data
• As far as the conductor wire is concerned, the baud rate and bps
are the same, and we use the terms interchangeably
• The data transfer rate of given computer system depends on
communication ports incorporated into that system
 IBM PC/XT could transfer data at the rate of 100 to 9600 bps
RS232 Standards
• An interfacing standard RS232 was set by the Electronics
Industries Association (EIA) in 1960
• In RS232, a 1 is represented by -3 ~ -25 V, while a 0 bit is +3 ~
+25 V, making -3 to +3 undefined
• The standard was set long before the advent of the TTL logic
family, its input and output voltage levels are not TTL compatible
• A microcontroller system must use voltage converters such as
MAX232 to convert the TTL logic levels to the RS232 voltage
levels, and vice versa
• MAX232 IC chips are commonly referred to as line drivers
DB9 pin connections

• RS232 supports both DB25 and DB 9 pin connector


• DB-9 Pin Connector
Handshaking in Rs232
• Current terminology classifies data communication equipment as
DTE (data terminal equipment) refers to terminal and
computers that send and receive data
DCE (data communication equipment) refers to
communication equipment, such as modems
• The simplest connection between a PC and microcontroller
requires a minimum of three pins, TxD, RxD, and ground
Handshaking signals in Rs232
DTR (data terminal ready)
When terminal is turned on, it sends out signal DTR to indicate that it is
ready for communication
DSR (data set ready)
When DCE is turned on and has gone through the self-test, it assert DSR to
indicate that it is ready to communicate
RTS (request to send)
When the DTE device has byte to transmit, it assert RTS to signal the
modem that it has a byte of data to transmit
CTS (clear to send)
When the modem has room for storing the data it is to receive, it sends out
signal CTS to DTE to indicate that it can receive the data now
Handshaking signals in Rs232
DCD (data carrier detect)
The modem asserts signal DCD to inform the DTE that a valid carrier
has been detected and that contact between it and the other modem
is established

RI (ring indicator)
• An output from the modem and an input to a PC indicates that the
telephone is ringing
• It goes on and off in synchronous with the ringing sound

You might also like