MATH 223 Lecture Notes - Lecture 1: Usb Flash Drive, Virtual Desktop, Vmware
8 views9 pages
UCR EE/CS 120B Winter 2012
Lab 1: Intro to AVR Studio 5 software (1 Day)
AVR microcontrollers are programmed using software called AVR Studio 5. This lab introduces AVR Studio 5,
including the C editor, compiler, simulator, and debugger functionalities. To open AVR Studio 5 on a lab
machine, first login and open a terminal. Type "vmware" to start a Windows virtual machine; AVR Studio 5
should be on the new virtual desktop (For additional help: Installing/Accessing RI Tools and AVR Studio 5).
Important: NEVER close VMWare by pressing the "X" in the top right corner of the window. Doing so
leaves the process running in the background, preventing other users from starting a new virtual machine.
Instead, shut down VMWare by going to start->shutdown from the start menu of Windows.
Important: VMWare is a static image and will not save local files when the virtual machine is rebooted,
thus causing all of your work to be lost. It is important to save your work elsewhere. Either to a mapped
network drive (your CS home directory), a USB flash drive, or email your files to yourself. Instructions for how
to map a network drive can be found in the Read Me!.txt file on the VMWare Windows Desktop.
Creating, compiling, and simulating a new project
1. Open AVR Studio 5 from the Start Menu or the Desktop
2. Select "File -> New -> Project" (from the menu at the top).
3. Select "C executable project" from the New Project window that pops up, type "lab1" in the name field
near the bottom, then press "OK"
4. Select "ATmega32" from the list in the Device Selection window that pops up, press "OK"
5. A sample program appears with an empty "while(1)" loop. Select "Build -> Build solution".
6. Select "Debug -> Continue". Select the ‘AVR Simulator” debugger and choose “OK”. The sample
program is now running in the simulator, though it has no useful behavior so there's nothing to see.
Select "Debug -> Stop debugging". (If a ‘No Source Available’ error occurs, ignore it and click the ‘xxx.c’
tab at the top and press continue again.)
First program: Writing to output pins
1. Replace the sample program by the following program (explained below) that sets port B's 8 pins to
DDRB = 0xFF; // Configure port B's 8 pins as outputs
PORTB = 0x0F; // Writes port B's 8 pins with 00001111
2. Select "Build -> Build solution". Check the Output window to ensure the build succeeded without any
3. Select "Debug -> Continue".
4. Find and press the "I/O View" button (near the top, has a symbol with a couple filled circles and a line),
causing an "IO View" sub-window to appear.