You are on page 1of 19

RS-232

Lecture 13
What is RS-232?
• Back in the 1950s …

• RS-232 is a standard for an: “Interface between Data Terminal


Equipment (DTE) and Data Communication Equipment (DCE)
employing Serial Binary Data Interchange”.

• Computer is one example of DTE and modem is one example


of DCE.

• RS-232 is still one of the most widely used serial I/O


interfacing standards today.
What is RS-232?
• RS-232 defines many aspects of the serial data
channel
– Equipment definitions
– Connector construction and pin-outs
– Modem control signals
– Signal levels

• RS-232 line drivers and receivers


Connectors

D-Type-25 D-Type-9
Pin # Pin # Abbreviation Full Name
2 3 TD / TxD Transmit Data
3 2 RD / RxD Receive Data
4 7 RTS Request To Send
5 8 CTS Clear To Send
6 6 DSR Data Set Ready
7 5 SG / GND Signal Ground
8 1 CD / DCD Data Carrier Detect
20 4 DTR Data Terminal Ready
22 9 RI Ring Indicator
Wirings – Full handshaking
For full handshaking to support flow control
PIN 1: CD
PIN 2: TxD
PIN 3: RxD
PIN 4: DTR
PIN 5: GND
PIN 6: DSR
PIN 7: RTS
PIN 8: CTS
PIN 9: RI
Image source: http://www.cepd.com/calculators/serial.htm
Handshaking
DTE (PC with COM port) DCE (modem)
i.e. connected to telephone line
Turned on and ready
DTR Turned on and ready
DSR

has a byte to transmit


RTS
If ready to receive data

CTS

Note:
If DCE does not activate CTS, the DTE (PC) will deactivate DTR and try again.
Wirings – Null Modem
• Allows two DTEs to communicate directly.
• Typical for connecting between microcontroller and PC.

PIN 1: CD
PIN 2: TxD
PIN 3: RxD
PIN 4: DTR
PIN 5: GND
PIN 6: DSR
PIN 7: RTS
PIN 8: CTS
PIN 9: RI
Image source: http://www.cepd.com/calculators/serial.htm
Transmitter and Receiver
• There is a parallel I/O interface that transfers data
from the source to the transmit data buffer and from
the received data buffer to the destination.
Data framing
• Asynchronous serial data transmission is widely used for a
character-oriented transmission.

• Each character is put in between start and stop bits.


– The start bit is always one bit and always a 0 (space)
– the stop bit can be one or two bits and is always a 1
(mark). a frame
RS-232 Signal phases
RS-232 signal phases
• Idle
• Start bit (0)
• Data
• Parity
• Stop bit (1)
• Idle or Start next frame
one frame
ID L E o r
ID L E START D0 D1 D2 D3 D4 D5 D6 P STO P
START

Format: data_bits - party_bit - stop_bit


Common Configurations:
8–N–1
7–E–1
Data Transfer Rate
• The rate of data transfer in serial communication is
stated in bps (bits per second).
• Another widely used terminology is baud rate.
Baud rate is defined as a number of signal changes
per second.
• Typical baud rate: 1200, 2400, 4800, 9600, 14.4k,
19.2k, 38.4k and 115k bps.
Note: baud and bps rates are not necessary equal. There are occasions when
a single change of signal transfers represents several bits of data.
COM PORT 0 and 1 on MCB2300

To micro-
controller

COM PORT: P0.15 – TXD1


Pin 2 - Rx P0.2 – TXD0
Pin 3 - Tx P0.16 – RXD1
Pin 5 - GND P0.3 – RXD0
Source: MCB2300 schematic diagrams
MAX233 IC

Source: MAX233 datasheet


MAX 562 IC
Why use addition IC?
• The RS-232 standard is set long before the advent of TTL logic
family and computers and the electronics that drive them
were still unreliable, there are a couple of legacies to deal
with.
• The hardware interface is not simply a TTL or CMOS-level
buffer.

• The first is the voltage levels of the data.

• A mark (logic 1) is usually -15 V to -3 V

• A space (logic 0) is 3 V to 15 V (voltages in


the switching region are -3V to 3V.
RS-232 to TTL/CMOS voltage level
RS-232 voltage level: TTL voltage level: CMOS voltage level:
logic 1 is -15 to -3 V logic 1 is 2V - (5V  5%) logic 1 is 0.7VDD - VDD
logic 0 is 3 -15 V logic 0 is 0 – 0.5VDD
logic 0 is 0 - 0.8 V

• Before using RS-232 with a microprocessor/microcontroller


(using TTL/CMOS ) , voltage level conversion needs to be done.

• Commercial IC chips are available such as


– MAX 220-249
• +5V-Powered, Multichannel RS-232 Drivers/Receivers
– MAX563 (used on the MCB2300 board)
• +3.3V-powered EIA/TIA-562 transceiver with 2 Txs and Rxs
Flow Control
• The second is the handshaking signals. These additional
signal lines are used to interface between devices and control
the flow of information between the devices since the data
terminal equipment (DTE) may deliver data faster than the
receiving device can process.

• Flow control gives the receiver a way to signal the transmitter


to stop transmission.

• Flow control can be implemented in


– Software - XON/XOFF flow control protocol
– Hardware - RTS/CTS (Request to Send / Clear to Send)
Exercise 1
Given that 8-N-1 protocol and Baud rate of 9600 bps is used,
find total number of bits and time it takes to transfer 5 pages of data
and each page has 8025 characters.

For each character, a total of _________ bits is used.

For one page, a total of _________ bits per page.

For 5 pages, a total of ___________ bits will be transferred.

With Baud rate of 9600 bit per second (bps), the time it takes to
transfer 5 pages is:
___________ seconds
Exercise 2
Given that 7-E-1 protocol and Baud rate of 57600 bps is used,
find total number of bits and time it takes to transfer 5 pages of data
and each page has 8025 characters.

For each character, a total of _________ bits is used.

For one page, a total of _________ bits per page.

For 5 pages, a total of ___________ bits will be transferred.

With Baud rate of 57600 bit per second (bps), the time it takes to
transfer 5 pages is:
___________ seconds

You might also like