Lab 3: Bouncing Lights Revisited

Overview

The purpose of this lab is to gain some experience with branching, loops, and the bit instruction set.

Lab activity

In this lab, you will redesign the program developed for the previous lab. Your redesigned program must:

  1. Begin with all but the right most LED (LED 0) off. The position should not change initially.
  2. When any key in row R1 is pressed, the “on” LED should rotate to the left continuously. The “on” LED should wrap around to the right most position after being in the left most position. The rotation should terminate when all keys in R1 are no longer depressed.
  3. When any key in row R4 is pressed, the “on” LED should rotate to the right continuously. The “on” LED should wrap around to the left most position after being in the right most position. The rotation should terminate when all keys in R4 are no longer depressed.
  4. If keys in both rows R1 and R4 are pressed at the same time, the “on” LED should blink. When all keys in one or both rows are no longer pressed, the “on” LED should be restored to the “on” state.

Design constraints:

  • You must make use of a subroutine for the delay loop used for the left and right rotations and the blinking LED.
  • The delay loop must be exactly 75 ms. (You will be required to prove the timing with an oscilloscope in lab.)
  • The direction of the LED rotation or blinking must change immediately after the state of the switches changes. This means that the switch must be checked after each output / before each left/right shift or blink.

Hints:

  • The LEDs should be wired to PORTB and the keypad to PORTC. See the example in Lab 0 for how to read from the keypad.
  • Develop and debug your program in AVR Studio first. To simulate an input switch in the I/O view, select the bit in PINC corresponding to the input the switch would set.
  • You may find the SBIC and SBIS instructions convenient for this assignment, but you are not required to use them.

Demonstration

You are required to demonstrate your program to your instructor. As part of your demonstration, you must use the oscilloscope to demonstrate the timing of your delay loop.

FAST Data

You should indicate how much time (in minutes) you spend on this assignment in the FAST database. You are encouraged to log your activity as you work on the project. At a minimum, you should log all of the time spent on this assignment before the due date given above. All time spent on this assignment should be entered into the week 4 column (even if you worked on it in week 3 or 5).

Lab Deliverables

You should follow your instructor's instructions for your lab submission.

Taylor

If you have any questions, consult your instructor.

ce2800labs/lab3.txt · Last modified: 2009/06/03 11:22 (external edit)
 

This website is not owned or managed by the Milwaukee School of Engineering.

© 2003-2010 Dr. Christopher C. Taylor, et. al. • Office: L-343 • Phone: 277-7339 • npǝ˙ǝosɯ@ɹolʎɐʇ • -> RSS <-