Pages created and updated by Terry Sturtevant Date Posted: February 4, 2020


CP316: Microprocessor Systems and Interfacing

LCD shield and serial monitor

Background

This lab will introduce simple ways to provide user interaction with an Arduino.

Objectives

  1. To produce output to an LCD display and get input from switches.
  2. To use the serial monitor for user input and output.

Equipment

Procedure

Setup

  1. Attach the LCD shield to the Arduino.
  2. Reconnect the USB cable
  3. Create a new sketch using the sample code provided.
    Demonstrate the program working.

  4. Pin D10 is used by the shield to control the backlight. Connect the pin to GROUND to see the effect.
    Modify your sketch by making pin 10 an output, and when the "Down" key is pressed make it LOW, and when the "UP" key is pressed, make it HIGH. (See the Blink sketch for examples of how to make a pin HIGH or LOW.)
    Demonstrate the program working.

Shield control and display of timer

  1. Now combine the code with one of your PWM sketches from before where the frequency was controlled by OCnA. (If you need to adapt it for a different timer because of pins used by the display shield, do so.)
  2. Connect the oscilloscope to the output pin used by the timer.
  3. Adapt the code so that the UP and DOWN buttons increase and decrease the frequency, and RIGHT and LEFT buttons increase and decrease the duty cycle. Make the SELECT button cycle through the various prescaler options. Toggle the backlight each time the prescaler changes.
    Display the frequency and duty cycle on the LCD as well.
    Demonstrate the program working.

Serial monitor control and display of timer

  1. Now add code to mirror the LCD display on the serial monitor; i.e. send whatever you display to the serial monitor as well.
  2. Now adapt the code to take input from the serial monitor as well.Specifically, have one key turn on the backlight and another turn it off.
    Demonstrate the program working.

Creative Commons License

Information on this site which is produced by Terry Sturtevant is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Canada License.

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