3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Swiss AVR Knife

Step 4Programming the Microcontroller

Programming the Microcontroller
C code Don't criticize what I don't understand. I am not a programmer, C is not my native language, and I am holding on by a Java-thin thread and a lot of web searching when working in C. Even though much of the code came from other projects (see credits), I did have to make some additions and modifications. The source code for the Swiss AVR Knife is attached below both as a c source file and a hex file. I would appreciate hearing where the code could be improved.

There are a few changes I anticipate making in the code. Updates are forthcoming. In the meantime, the code does work as advertised.

Fuses Microcontroller fuses are confusing. I have disabled a few microcontrollers both by accidentally setting them to look for an external oscillator and by disabling the RESET pin. They can be recovered, but until then they are just dead bugs. Be careful if you choose to change the fuses.

To calculate the correct fuse values, use an online fuse calculator. Select the target part (ATtiny84) and the appropriate settings -- internal RC oscillator running at 8MHz (default value), DO NOT divide the clock by 8 internally, enable serial program downloading, and disable brownout detection. The result should be the following.

-U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m (low 0xE2 high 0xDF ext 0xFF).

You only need to burn the fuses once (unless you plan to change them). Eclipse makes this easy, as, I am sure, do other IDEs.

Questions that I would like answered

Any ideas on optimizing the code
Why do the blinking lights in the sound and light machine cause an oscillation in tone when enabled in the tin but not on the breadboard?
Why doesn't Eclipse like the lightOn and lightOff functions, even though they seem to work?

« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
36
Followers
7
Author:matth3w