Lect 24
Lect 24
TRANSMITTER RECEIVER
UART UART
Data Encoding and Transmission (Cont.) Data Encoding and Transmission (Cont.)
• Data are encapsulated in two other bits called start bit • Typical bits in data transmission:
and stop bit.
Start bit: When the transmitter has data to send, it first changes
• Mark and space: the logic one and zero levels are called the line from the mark to the space level for one bit time. This
mark and space. synchronises the receiver with transmitter. When the receiver
When the transmitter is not sending anything, it holds the line at detects the start bit, it knows to start clocking in the serial data
bits.
mark level, also called idle level.
Data bits: Almost any number of data bits can be sent between
the start and stop bits. Typically, between 5 and 8 bits are sued.
Least Significant Optional Stop
Parity bit: The parity bit, used to detect errors in the data, is
Bit Parity Bit Bit
added to the data to make the total number of ones odd (odd
Mark parity) or even (even parity).
Space Stop bit: The stop bit is added at the end of data bits. It gives
one bit-time between successive characters. Some systems
Start 5 to 8
require more than one stop bit.
Bit Data Bits
11 12
Data Transmission Rate Standards for the Serial I/O Interface
• The rate at which bits are transmitted is called baud rate. Interface standards are needed to allow different
• It is given in bits per second. manufacturers’ equipment to be interconnected and must
• Standard data rates – Baud: define the following elements:
110, 150, 300, 600, 900, 1200, 2400, 4800, 9600, 14400, • Handshaking signals.
19200, 38400, 57800 • Direction of signal flow.
• Types of communication devices.
• Connectors and interface mechanical considerations.
• Electrical signal levels.
8 5 CTS Clear to send: Sourced by DCE, received 1 8 DCD Data carrier detect: Sourced by DCE,
by DTE. CTS must be asserted before the received by DTE. Indicates that a DCE has
DTE can transmit data. detected the carrier on the telephone line.
Originally it was used in half-duplex
6 6 DSR Data set ready: Sourced by DCE and
systems but can be used in full-duplex
received by DTE. Indicates that the DCE
systems, too.
has made a connection on the telephone
line and is ready to receive data from the 4 20 DTR Data terminal ready: Sourced by DTE and
terminal. The DTE must see this asserted received by DCE. Indicates that DTE is
before it can transmit data. ready to send or receive data.
5 7 SG Signal ground: Ground reference for this
9 22 RI Ring indicator: Sourced by DCE and
signal is separate from pin 1, protective
received by DTE. Indicates that a ringing
ground.
signal is detected.
COMP2121: Microprocessors and 27 COMP2121: Microprocessors and 28
Interfacing Interfacing
RS-232-C Interconnections RS-232-C Interconnections (Cont.)
DE9 DB25 DB25 DE9
• When two serial ports are connected, the data rate, the number
of data bits, whether parity is used, the type of parity, and the DTE DTE DCE DCE
number of stop bits must be set properly and identically on TxD 3 2 2 3 TxD
each UART. RxD 2 3 3 2 RxD
• Proper cables must be used. There are three kinds of cables SG 5 7 7 5 SG
from which to choose, depending on the types of devices to be RTS 7 4 4 7 RTS
interconnected.
CTS 8 5 5 8 CTS
The full DTE – DCE cable.
The DTE – DTE null modem cable.
DCD 1 8 8 1 DCD
The minimal DTE – DCE cable. DSR 6 6 6 6 DSR
DTR 4 20 20 4 DTR
D R
Up to 10
receivers
Up to 10
R receivers
D
R RS-485 line length and data rate
Up to 32 Up to 32
Line length (ft) Data rate
drivers receivers
40 10 Mbits/s
D 400 1 Mbits/
R
4000 100 Kbits/s
RS-485 Interface 37 38