Project 1: Digital I/O and Timing
- All components of the project are due by February 26th at 5:00pm.
- Two person groups are required
At the end of this project, you should be able to:
- Create, compile, and download code to the Atmel Mega8,
- Manipulate digital I/O lines, and
- Use the internal timers/interrupts to produce regularly timed events.
- Implement an internal 4-bit counter (use a variable of type uint8_t).
- The state of the counter is indicated using 4 LED channels:
- Bit 0: Yellow
- Bit 1: Blue
- Bit 2: Red
- Bit 3: Green
- Each time the button is released, the counter should
be incremented. Incrementing the counter from 0xf should result in a
value of 0.
- Produce a musical tone using the speaker. Tones can be
produced by turning the speaker "on" and "off" at some
- The frequency of the tone should decrease with higher counter
values. (alternatively, you could play one bar of Yankee
Doodle with each counter value)
Things You Should Know
We are using the bion
boards for this project (so there is no hardware development).
Note: you should only configure the LED and speaker pins as outputs.
All other pins should be configured as inputs (otherwise, you can
damage the chip).
- There are three debugging LEDs (red, green, and yellow) attached to PORTB, pins 0, 1, 2
- The blue LEDs are all attached to PORTC, pin 5
- The piezoelectric speaker is attached to PORTD, pin 2
- Switch 1 is the reset switch (pushing it will cause the processor to reboot)
- Switch 2 is attached to PORTD, pin 3. This pin will read 1 when the button is not pressed and 0 when it is pressed.
- Modularize your code: keep routines simple. For example, you
should separate the counting process from the LED state
changes. In particular, we expect you to implement a
DisplayCounter() function that is responsible for
updating the state of the LEDs
What to Hand In
All components of the project are due by February 26th at 5:00pm.
- Group report: Turn in your documented code to the
project 1 digital dropbox on D2L (text format). Only hand in
one copy of code per 2-person group.
- Group demonstration: Demonstrate your working
implementation to either a TA or the instructor).
This demonstration is due at the same time as the
reports. All group members must be present for the
- Personal report: State the relative contribution of you
and your partner (in terms of percentage of effort) (short and
in text format)
- 50%: Project implementation
- 25%: Demonstration of working project
- 25%: Internal documentation of the code
fagg [[at]] ou.edu
Last modified: Wed Feb 13 22:17:16 2008