Sei sulla pagina 1di 18

Recitation 2

Hung-Bin (Bing) Chang and Yu-Yu Lin


Electrical Engineering Department University of California (UCLA), USA,
hungbin@seas.ucla.edu and skywoods2001@ucla.edu
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 1 / 18
Outline
1
Introduction to RS-232
2
Homework Assignment 2 (Hints)
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 2 / 18
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
dened.
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 3 / 18
Introduction to RS-232
RS-232 Contd
RS-232 dictates 4 types of specications (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 dene 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 2014 Fall 4 / 18
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
Idle 7 data bits
Start
bit
Stop
bit
Idle
T
Figure : An example of RS-232 data transmission
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 5 / 18
Introduction to RS-232
RS-232C - Contd
Transmitter and receiver have to agree (beforehand) on:
How many bits are sent (7 or 8) for a character?
How long is T (period)?
What is
1
T
(bit per second, bps)?
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 6 / 18
Introduction to RS-232
Some Commonly RS-232 Signals
TD (Transmitted Data)
RD (Received Data)
DSR (Data Set Ready)
DTR (Data Terminal Ready)
R (Ring indication)
RTS (Request to Send)
CTS (Clear to Send)
RLSD (Received Line Signal Detector)
Computer
(DTE)
Modem
(DCE)
Figure : RS-232 Signals
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 7 / 18
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 ow control when we have a
fast transmitter and a slow receiver. Data will not be sent until a
CTS is certied 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 2014 Fall 8 / 18
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 dene their own standards for unused pins
It induces incompatibilities.
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 9 / 18
Introduction to RS-232
State Diagram
"state" of the system is dened 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 2014 Fall 10 / 18
Introduction to RS-232
State Diagram - Contd
Computer 1 Modem 1 Modem 2
Station 1 Station 2
Computer 2
(7,7) (7,7)
(5,7) (6,7)
(1,7) (4,7)
(1,7)
All line are idle
(A) I want to transmit
DT
DS

DT
DS, !
(") in#in# a si#nal tells a
DT$ %e %as a si#nal
(D) DT$ a&ti'ates DT,
&orrespondin# to answer t%e p%one
(C) DT is read(
Conne&tion Setup
Figure : State diagram for RS-232C
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 11 / 18
Introduction to RS-232
State Diagram - Contd
Computer 1 Modem 1 Modem 2
Station 1 Station 2
Computer 2
Connection Setup
(1, 7)
(1, 6)
(1, 2)
(1, 0)
(1, 7)
(1, 6)
RLSD
RTS
CTS
RTS
CTS
RLSD
Figure : State diagram for RS-232C
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 12 / 18
Introduction to RS-232
State Diagram - Contd
To terminate the call:
(1, 6)
(3, 6)
(7, 6)
DTR
DSR
(7, 7)
RLSD
Figure : State diagram for RS-232C
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 13 / 18
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 2014 Fall 14 / 18
Homework Assignment 2 (Hints)
Hint #1: Memoryless distribution
Future evolution of the process is independent of the past
evolution of the process.
P(T > t + s | T > t) =
P(T>t+s,T>t)
P(T>t)
= P(T > s).
It implies P(T > t + s) = P(T > t)P(t > s).
The only two distributions that satisfy this condition:
Continuous: Exponential f
X
(x) = e
x
, x [0, ).
Discrete: Geometric P(X = n) = p(1 p)
n
, n = 0, 1, 2, . . . .
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 15 / 18
Homework Assignment 2 (Hints)
Hint #2: Problem 4
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 n
a
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)
n
h
(overhead in each message packet) = 24 bits
n
a
(acknowledgement length) = 24 bits
t
p
(propagation time in one direction) = 1 msec
Minimum transition time between states (1,3) and (1,1) (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 2014 Fall 16 / 18
Homework Assignment 2 (Hints)
Problem 4 Contd
H Data message
H Data message ACK
ACK
t
p
t
p
CTS
delay in
RX
CTS
delay in
TX
H Data message
H Data message
t
p
t
t
Figure : Time ow for the transmission
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 17 / 18
Homework Assignment 2 (Hints)
Problem 4 Contd
Data rate =
L
T
, where L is the number of bits sent and T is the time
duration required to sent the bits.
Effective data rate =
L

, where L

is the number of bits sent


(excluding header and ack) and T

= T + delay.
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 18 / 18

Potrebbero piacerti anche