Pages created and updated by Terry Sturtevant Date Posted: April 18, 2018


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

  1. Become familiar with the hardware layer of UART.

Equipment

Exercise

  1. Connect the Arduino to the oscilloscope, using one channel for the TxD signal. (Since the communication is only being tested in one direction, only one serial signal matters.)
  2. Use SimpleSerialCharOut to repeatedly send a character out from the UART.
  3. Watch the signal on the scope and identify the transmission of a single character. Sketch the signal or print it. This will be needed for the postlab.
  4. 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.
  5. 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.)

  6. The built-in UART on the Arduino board is also used for USB communication with the board, so using it for other things can cause problems. There is a library for software serial ports which allows you to use other pins to create a UART. The SimpleSoftwareSerialCharOut example makes the changes to the previous example so that you can now change the pins to any not used by the shield using a software serial port.
    Load the software serial sketch and change the pins to demonstrate that ability.

  7. Combine this sketch with the LCD shield sketch so that pressing different buttons on the display shield will change the character being transmitted.
  8. Show your pin assignments on the diagram.
Demonstrate and explain your results to the lab instructor

Resources

To view pdf documents, you can download Adobe Acrobat Reader .
get Acrobat Reader
If you need to update a browser, you might try Firefox which is Get Firefox!
Since this page uses cascading style sheets for its layout, it will look best with a browser which supports the specifications as fully as possible.

If you are looking for an office package, with a word processor, spreadsheet, etc., you might try LibreOffice which is Get LibreOffice!

Go to the main page for the Department of Physics and Computer Science.

Valid XHTML 1.1

Valid CSS!

WCAG
2.0
(Level AA)

Wilfrid Laurier University