You are on page 1of 10

Communications using the RS-232 standard

Objective: In this lab the students will achieve the following


1.
2.
3.
4.
5.
6.
7.

Understand what serial communication is.


Become familiar with typical data communication over RS-232.
Understand the RS-232 signaling and protocol.
Observe and identify the line code used in RS-232 communications.
Learn what the purpose of a breakout box/board is and how it is used.
Identify ASCII characters from physical layer observations.
Understand the concept of a null-modem and how to create one when
necessary.

Equipment:
1.
2.
3.
4.

Oscilloscope with FFT functionality (DSO 3102)


DB9 Dual Breakout Boards
DB9 Extension Cable, Male-Female, 10ft
Computer with RS-232 port available and terminal emulation program
installed.

Background:
RS-232:
There are many ways that two entities may communicate information between each
other: audible, visible, and electronic. Yet, there is still another dimension to the specific
characteristics that each method has. Specifically, we are referring to transmission of data
in serial or in parallel.
For example, when you write a letter to someone, you dont write three different words at
once, but rather one word after another. This is an example of serial communications.
Different pieces of information are sent one after the next.
However, you dont mail one word at a time to your friend if you want to send them a
letter. Instead, you write everything down and send everything all at once. This is an
example of parallel communications.
In digital systems, the idea is similar. The basic unit of information in the digital world is
the bit. Multiple bits are sent out when there is a need to communicate something
between two points. Whether the information is sent through a wire, cable, optical fiber,
sea, or air, it is being sent through a channel.
If were transmitting bits serially, then they are sent one bit after another. However, if we
are able to transmit multiple bits, i.e. 8, at a time then we say that we are performing
parallel communications.

-1-

Prepared by Prof. Z. Marantz

In this lab, we will observe a very classic form of serial communications. It is known as
the RS-232 standard, which is an internationally well-known and used standard. It was
originally conceived in 1969, but despite its maturity it is still one the most common
forms of communicating with devices such as power supplies, generators, scopes,
network switches and other nodes.
The reason for its longevity is due to its simplistic physical, electrical, and procedural
requirements. In fact, in order to achieve communications between any two RS-232
enabled devices you need at least 3 wires: transmit, receive, and ground.
Please take note of any and all observations you make as you will be required to verify if
what you observe follows the RS-232 standard as defined by the Electronic Industries
Association (EIA) / Telecommunications Industry Association (TIA).
ASCII:
One of the oldest digital codes used in communication is the American American
Standard Code for Information Interchange (ASCII). This is a special 7-bit informational
code that was able to represent 27 possible characters.
I this lab you will decipher the physical line codes that are being transmitted along an RS232 communications channel into the corresponding ASCII code. You will also learn
how to connect two terminal devices back-to-back and have them communicate with each
other by means of a set-up called a null-modem.
Bauds and bits:
When digital information is transmitted over a channel we expect to have bits sent over
the channel, but a bit, i.e. 0 or 1, is a very abstract thing. Its like sending a letter A over
the channel. How do we transmit an A? Do we write it on a piece of paper and stick it
into the wire? Ridiculous, true, but we have to get a deeper understanding of what is
happening.
We can say that the letter A is actually something that we want to send from the higher
layers of the OSI model, maybe the application layer. When the A is sent down through
the rest of the layers it is converted to logical 0s and 1s. So one way of representing the
A is by a series of bits. Still, they are still abstract characters.
Communications is done through physical means and therefore we have to understand
what those 0s and 1s mean. One thing that they may represent are open and closed
electrical switches. Equivalently, an open or closed switch represents different voltage
values, 0V or 5V as in Figure 1 for example.

-2-

Prepared by Prof. Z. Marantz

Figure 1: A typical signal that may represent binary data.

There is still some ambiguity since a 1 might represent an up part only, or an up and a
down. The signal might be interpreted to mean that there are a string of 0s and 1s being
transmitted, or just a bunch of 1s. How is this possible? Observe
A
symbol
for a 1
bit.

A
symbol
for a 0
bit.

Figure 2: A symbol here either represent a high or low voltage corresponding to a '0' or a '1' bit.

A
symbol
for a 1
bit.

Figure 3: A symbol here is a cycle of the square wave and represents a '1' bit.

So, the symbol, that we end up communicating here is a voltage or current that
represents a 0 or a 1 bit. The interesting thing is that we may have currents and voltages
represent multiple bits. Well see this possibility in the next lab experiment.
Now the question is, how fast are we transmitting stuff? The signal is changing at a
certain rate, but since each symbol in the physical signal may represent a different
number of bits we have multiple ways of describing what is happening.
The symbol rate, or baud rate, described how fast the symbols are transmitting. While
the bit rate tells us how fast the bits are essentially being sent over.

-3-

Prepared by Prof. Z. Marantz

For example, say we were sending 1 symbol every millisecond (1 symbol/ms). The
symbol rate would be 1000 Baud. If each symbol represented 1 bits, then the bit rate
would be

bits
symbols
bits
1000
= 1000
symbol
sec
sec

Making observations:
The observations that you make will be made based on what you see on the scope, the
computer monitor, and the physical connections that you make.
Procedure:
Part A: Monitoring ASCII characters with a scope
1. Connect the computer, break-out board, and the scope to each other as per the
circuit diagram shown in Figure 4.
Male-male or
male-female cable

Ground

Transmit
Figure 4: Diagram connecting breakout board to computer and scope.

-4-

Prepared by Prof. Z. Marantz

2. Start the program HyperTerminal on your computer. (It may be found in


Programs Accessories Communication.)

Figure 5: Location of terminal emulation program.

You will be asked to create a new connection. Give it a name and press OK. At
the next window, make sure to select COM1 as your communications port. This
is how the serial port is known to the computer.

Figure 6: Choose 'COM1' port to access serial port.

3. You will then be asked to configure various settings for communication. Please
make the following settings:
Any bit rate
Parity: None or forced to 0, a.k.a. Space
Use 7-bit characters
Flow control: None

-5-

Prepared by Prof. Z. Marantz

Figure 7: Settings for 'COM1'

4. Make sure that you are connected. You should see the icons like this:

i.e. off-hook. If it looks like this:


, i.e. on-hook, then you are not
connected and you must click on the phone.
5. Go to File Properties and click on the Settings tab. Set Emulation to
VT100 and press OK.

-6-

Prepared by Prof. Z. Marantz

Figure 8 Select VT100 terminal emulation.

6. Hold down the e character. You my or may not see something on your scope
when you do. Try pressing Auto Scale on the scope and see what you get. If you
still see nothing, adjust the knobs for both the horizontal and vertical control of
the scope until you do. If you still dont see anything on your scope, make sure to
check over all your connections and program settings.
7. Make sure that you set your horizontal control to a value that will allow you to
observe the bits of one character on the display. Record the waveform.
8. Determine the character repetition rate when holding down the key. You may
have to readjust the horizontal control. Record your answer.
Question 1: What are your triggering settings (volts/div and time/div)?
Question 2: What is the relationship between the character repetition rate,
the baud rate, and the horizontal setting of your scope?
Question 3: What is the bit rate and the bit period which you observed?
Question 4: Determine the hexadecimal notation for the signal that you
recorded from the scope.

9. Go offline, i.e.
. Go to Properties and configure the COM1 port.
Change the communication settings to odd parity. Repeat steps 6 9 for other
-7-

Prepared by Prof. Z. Marantz

ASCII characters. Specifically, transmit E, 5, 9, and any control character as


defined by the ASCII code table given in Appendix A.
Question 5: Are the results of the hexadecimal notations you observe in
the recorded signals exactly what you expected? If not, please explain
why.
10. Question 6: Based on your observations, what is the relationship between the
baud rate and the bit rate in this system?
Part B: Study a terminal emulation and establish DTE DTE communication using a null
modem.
1. Using the equipment provided, connect two computers to each through their serial
ports as shown in the schematic of Figure 9.
Male-male or
Male-male or
male-female cable
male-female cable

5
3
2

5
3
2
Terminal 1

Terminal 2
Figure 9 DTE-DTE connection

Question 7: What is this type of connection called and why is it needed?

2. Configure your terminal emulator on both computers as follows:


Speed: 9600
Bits: 8
Stop bits: 1
Parity: none
Flow control: none
No local echo

Set the terminal emulator to Online, a.k.a. Call

3. Type the letters A through F and record your observations on both computers.
4. Change the setting on one of the computers from No local echo to Local echo
(located under ASCII Setup

-8-

Prepared by Prof. Z. Marantz

)
and repeat step 3.
Question 8: What is the purpose of echo?
5. Change the setting on one of the computers from Online to Offline and repeat
step 3.
Question 9: In communication terms, what is the difference between
echo and online?
6. Make sure both computers are Online. Change the speed settings on both of the
computers so that they have two different values and repeat step 3.
Question 10: Based on your observations, what happens if there is a
mismatch between transmit and receive speeds?
Homework:
Write up your lab report. Your report must contain the answers to the Questions posed in
the lab manual.
Your report is due in 1 week.
Appendix A: ASCII Codes

-9-

Prepared by Prof. Z. Marantz

ASCII Code Chart, scanner copied from the material delivered with
TermiNet 300 impact type printer with Keyboard, February 1972,
General Electric Data communication Product Dept., Waynesboro VA
(http://en.wikipedia.org/wiki/File:ASCII_Code_ChartQuick_ref_card.png)

- 10 -

Prepared by Prof. Z. Marantz