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
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 9 pages and 3 million more documents.

Already have an account? Log in
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.)
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 9 pages and 3 million more documents.

Already have an account? Log in
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
00001111:
#include <avr/io.h>
int main(void)
{
DDRB = 0xFF; // Configure port B's 8 pins as outputs
while(1)
{
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
errors.
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.
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 9 pages and 3 million more documents.

Already have an account? Log in

Get OneClass Notes+

Unlimited access to class notes and textbook notes.

YearlyBest Value
75% OFF
$8 USD/m
Monthly
$30 USD/m
You will be charged $96 USD upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.