AVR tutorial 3

Your first project: A flashing light.

6 March 2009 changed firmware to prevent the compiler from optimizing the delay loop out of existence.
13 November 2006 recompiled using WinAVR 20060412.
WinAVR 20040621 is introduced in tutorial # 1

Circuit diagram


The files included :
image1.gif : the above circuit diagram.
main.c : the main c application.
makefile : the file created by AVRMakeGen.

Download (12KB) the software and diagram in one Zip.

To build your project simply extract all the files to the same directory.
Next, using programmers note pad, open main.c.
Now click on tools and then on make all.

You should see a new window called output opening.
In this window you can see the build results. If there are no errors the output should end in :

Any warnings or errors will be highlighted and a simple click will result in a jump to the error or warning location.

Programming the device

Note: The provided makefile is generated for a SP12 type programmer as shown in tutorial 2. If you are using a different programmer you'll have to recreate the makefile using AVRMakeGen.

Insert the AVR into the programmer.

Click on "Tools", then on "make program".

More information should come up in your output window. This information relates to the programmer and if no errors occurred, your device is programmed.

Then simply insert the AVR into the test circuit and apply 5V.

Forward to tutorial 4

Home mail add