You are on page 1of 17

Recitation 2: RS232

Yu-Yu Lin
Electrical Engineering Department University of California (UCLA), USA,
yuyu@seas.ucla.edu

Prof. Izhak Rubin (UCLA)

EE 132B

Fall 2015

1 / 17

Outline

Introduction to RS-232

Homework Assignment 2 (Hints)

Prof. Izhak Rubin (UCLA)

EE 132B

Fall 2015

2 / 17

Introduction to RS-232

RS-232
RS-232 (Recommended Standard 232) is a standard for serial
binary data signals connecting between a DTE (Data terminal
equipment) and a DCE (Data Circuit-terminating Equipment).
A standard is a set of conventions that is designed to resolve
equipment incompatibilities, as well as to coordinate data
transmission between senders and receivers.

The devices in RS-232 are divided into two main categories


DTE: Data Terminal Equipment (e.g., computer).
DCE: Data Communications Equipment (e.g., a modem).

It is commonly used in computer serial ports.


In its simplest standard it dictates how computers and modems
communicate.
Physical layer: what transmission of data between devices is
defined.
Prof. Izhak Rubin (UCLA)

EE 132B

Fall 2015

3 / 17

Introduction to RS-232

RS-232 Contd
RS-232 dictates 4 types of specifications (Spec.)
Mechanical: 25 pin connector, physical dimension of plug and
connectors, assignments of circuits to pins.
Electrical: "ON" (1) if voltage < 3V; "OFF" (0) if voltage > 3V.
Functional: assign meaning to pins, like define which pins are used
for data, control, timing, ground,...
Procedural: dictate sequences of events (control and data
activations) to activate, use, and deactivate the connection.

Figure : Diagram for RS-232 with 25 pins

Prof. Izhak Rubin (UCLA)

EE 132B

Fall 2015

4 / 17

Introduction to RS-232

RS-232C
Serial, Asynchronous Communication, bit-oriented, characters
transmitted one at a time.
When the line is idle, a negative voltage exists on the cable
Start bit: transmitter sends a "0" positive voltage
Stop bit: transmitter sends a "1" negative voltage after each
character
T

Idle

7 data bits
Start
bit

Idle
Stop
bit

Figure : An example of RS-232 data transmission


Prof. Izhak Rubin (UCLA)

EE 132B

Fall 2015

5 / 17

Introduction to RS-232

RS-232C - Contd

Transmitter and receiver have to agree (beforehand) on:


How many bits are sent for a character?
How long is T (period)?
What is T1 (bit per second, bps)?

Prof. Izhak Rubin (UCLA)

EE 132B

Fall 2015

6 / 17

Introduction to RS-232

Some Commonly RS-232 Signals


TD (Transmitted Data)
RD (Received Data)
DSR (Data Set Ready)

Computer
(DTE)

DTR (Data Terminal Ready)


R (Ring indication)

Modem
(DCE)

RTS (Request to Send)


CTS (Clear to Send)
RLSD (Received Line Signal Detector)

Figure : RS-232 Signals

Prof. Izhak Rubin (UCLA)

EE 132B

Fall 2015

7 / 17

Introduction to RS-232

Circuit used in RS-232C - Contd


Duplex mode
Send and receive at the same time

Half duplex mode


Either send or receive at a time

Signal purpose and its corresponding pin number


"TD" (2): Carries data from DTE to DCE.
"RD" (3): Carries data from DCE to DTE.
"DSR" (6): DCE is ready to receive commands or data.
"DTR" (20): it indicates presence of DTE to DCE.
"R" (22): Ringing signal due to an incoming call is received.
"RTS" (4) and "CTS" (5) are used in flow control when we have a
fast transmitter and a slow receiver. Data will not be sent until a
CTS is certified by the receiver.
"RLSD" (8): carrier signal detected from another modem (i.e., The
modem is receiving a valid carrier signal from the remote modem).
Prof. Izhak Rubin (UCLA)

EE 132B

Fall 2015

8 / 17

Introduction to RS-232

Limitations of RS-232C

Distance between DTE and DCE < 15 m


Speed < 20 Kbps
Unbalanced signaling technique (ground voltage is not the same
at DTE and DCE)
Some manufacturers define their own standards for unused pins
It induces incompatibilities.

Prof. Izhak Rubin (UCLA)

EE 132B

Fall 2015

9 / 17

Introduction to RS-232

State Diagram

"state" of the system is defined by two octal numbers


(DSR, DTR, R), (RTS, CTS, RLSD)
Ex: (1,1,1) = 7
Note. 0 = "ON" (active), 1 = "OFF"

Example
Show the state transition diagram for a half duplex call: Station 1
initiates a call to station 2. Then the user at station 2 hears the
phone, picks up and say "hello".

Prof. Izhak Rubin (UCLA)

EE 132B

Fall 2015

10 / 17

Introduction to RS-232

State Diagram - Contd

Computer 1

Modem 1

Modem 2

Station 1
All line are idle

Computer 2

Station 2

(A) I want to transmit

(7,7)
DTR

(7,7)

(D) DTR is ready

(5,7)
DSR

DTR

(6,7)

(1,7)

(4,7)
DSR, R

(B) Ringing a signal tells a


DTE he has a signal
(C) DTE activates DTR,
corresponding to answer the phone

(1,7)
Connection Setup

Figure : State diagram for RS-232C

Prof. Izhak Rubin (UCLA)

EE 132B

Fall 2015

11 / 17

Introduction to RS-232

State Diagram - Contd

Computer 1

Modem 1

Modem 2

Station 1

Computer 2

Station 2

Connection Setup
(1, 7)
RLSD
(1, 6)
RTS
(1, 2)
CTS
(1, 0)

(1, 7)
RLSD
(1, 6)
RTS
CTS

Figure : State diagram for RS-232C

Prof. Izhak Rubin (UCLA)

EE 132B

Fall 2015

12 / 17

Introduction to RS-232

State Diagram - Contd

To terminate the call:


(1, 6)
DTR
(3, 6)
DSR
(7, 6)
RLSD
(7, 7)
Figure : State diagram for RS-232C

Prof. Izhak Rubin (UCLA)

EE 132B

Fall 2015

13 / 17

Introduction to RS-232

Others
Timing diagram
Please refer to class notes

Connection between two DTEs (one example)


Treat each other as they are the DCEs for each other

Figure : Connection between two DTEs

Prof. Izhak Rubin (UCLA)

EE 132B

Fall 2015

14 / 17

Homework Assignment 2 (Hints)

Example: Hint for HW2


Two DTEs are communicating via modems and RS-232C interfaces
over a half duplex link. Data transmission is one directional with each
message of length M. After a message is transmitted, the sender waits
for a CTS message of length na before sending another message.
Assume error-free operation and the following parameter values:
R (line bit rate) = 9600 bps
M (message length) = 1000 bits (all data bits)
nh (overhead in each message packet) = 24 bits
na (acknowledgement length) = 24 bits
tp (propagation time in one direction) = 1 msec
Minimum transition time between states (1,2) and (1,0) (CTS delay) is
equal to 10 msec at message transmitting end, and 20 msec at
message receiving end (CTS transmitting end). All other delays during
message transmission and reception are assumed to be negligible.
For the stated conditions, determine the effective data rate in bps.
Prof. Izhak Rubin (UCLA)

EE 132B

Fall 2015

15 / 17

Homework Assignment 2 (Hints)

Problem 4 Contd

Data message

ACK

Data message

tp

Data message
t

CTS
delay in
TX

tp

ACK
CTS
delay in
RX

Data message

tp

Figure : Time flow for the transmission

Prof. Izhak Rubin (UCLA)

EE 132B

Fall 2015

16 / 17

Homework Assignment 2 (Hints)

Problem 4 Contd

Data rate = TL , where L is the number of bits sent and T is the time
duration required to sent the bits.

Effective data rate = TL , where L is the number of bits sent


(excluding header and ack) and T = T + delay.

Prof. Izhak Rubin (UCLA)

EE 132B

Fall 2015

17 / 17

You might also like