Lab 2: AVR Programming

Assigned: Tuesday, June 28

The goal of this lab is to become familiar with the ins and outs of programming on the AVR mini.

0. Set up your environment to use the AVR

a. Copy the pre-prepared AVR and AVRlib files to your home directory by running the following script:

cd ~
/usr/ccrma/web/html/workshops/mid2005/setup

b. Make a directory for Lab 2 in your MID directory

cd ~
mkdir MID/lab2

c. Set up AVR connection to PC

Connect power cable, connect serial cable to right hand port, and power-up the AVRmini

d. Test AVR setup with "flash" test code

Make yourself a copy of the FLASH demo from avrlib-demos:

cd ~/MID/lab2
cp -r ~/avrlib-demos/flash .
cd 
flash

Compile and download the code to the AVRmini. Press the RESET button on the AVRmini and within 2 seconds type:

make 
load

You should see a sort of makeshift progress bar as a bunch of "#" characters print. If the program transferred successfully, then press RESET again. Connect the PBLED header to the PORTD header.

If everything is working, a LED on the AVRmini board should start flashing.

1. AVRMini Input/Output

a. Review architecture and programming, as necessary

b. Momentary pushbutton

Optional: Toggle pushbutton using debounce.

c. Four buttons:

d. Beep:

3. Compile, Run and Play the AVRsimon: