CP/PC364 Data Communications and Networks
Laboratory
Universal Asynchronous Receiver Transmitter (UART)
Overview
This week's laboratory investigates
RS-232
(or EIA 232) communication.
Background
The RS-232 protocol has been around since 1962. Originally designed
to basically connect a single "smart" device to a single "dumb"
device, it is now still very commonly used to connect sensors to
microprocessors or microcontrollers, and so will remain relevant for
the forseable future. It's also one of the simplest serial protocols,
and so it's easy to study.
The Arduino board has a UART built-in, so it can be used to study
RS-232 communications.
Note: The UART pins on the Arduino will be at
TTL levels, not at acceptable RS-232 levels.
Objectives
- Become familiar with the hardware layer of UART.
Equipment
- Arduino Uno board with LCD display
Exercise
- Look at a
very
simple Arduino serial communication example.
- Connect the Arduino to the oscilloscope, using one
channel for each of the TxD and RxD signals.
- Modify the simple example
to repeatedly send a character
out from the UART.
- Watch the signals on the scope and identify the transmission of
a single character. Sketch the signal or print it.
- On the sketch, identify the start bit(s), stop bit(s),
and the character bits to show how the character can be
decoded from the signal. If you're not sure which end of the
pattern is the beginning and which is the end, change the
character
being sent to clarify.
- On the sketch, show the time scale and explain how it relates
to the baud rate. (i.e. Identify how the time for one bit is
determined from the baud rate.)
-
Note: The Arduino uses the serial port internally, so
while you are programming you can't have the pins tied to each
other or some other device. Only make those connections after you
have finished uploading.
(The next lab will show you how to solve this problem.)
Connect the Tx and Rx pins of your Arduino so it communicates
with itself. Write a sketch to send a character every second and
display received characters on the LCD.
-
Show your pin assignments on the diagram.
Demonstrate and explain your results to the
lab instructor
Wilfrid Laurier University
© 2019 Wilfrid Laurier University