MAS 863: How to Make (Almost) Anything

1.What is Fuses

You know about flash, eeprom and RAM as parts of the chip. What I did not mention is that there are also 3 bytes of permanent (by permanent I mean that they stick around after power goes out, but that you can change them as many times as you'd like) storage called the fuses. The fuses determine how the chip will act, whether it has a bootloader, what speed and voltage it likes to run at, etc. Note that despite being called 'fuses' they are re-settable and dont have anything to do with protection from overpowering (like the fuses in a home).

The fuses are documented in the datasheets, but the best way to examine the fuses is to look at a fuse calculator such asĀ the avr fuse calculator from the palmavr project

2. A complete tutorial on How to set fuse using Fuse Caculator

Notes on the Tutorial:
- you could check the fuse setting from datasheet, but going with the online fuse caculator is the fastest way. (http://www.engbedded.com/fusecalc/)
- by default, attiny has an internal 8MHz clock, which is divided by 8 (actually running at 1MHz). So if you are using the internal clock, you usually will go with this setting without the need to set fuse.
- if an external clock is added, to be safe, you just select the last one of the online caculator when you are using an external crystal. That is: Frequency 8 or >8 MHz, with slowest starting time: 16K CK/14CK +65ms
- the checking box of the on line caculator:
Divide clock by 8 internally; [CKDIV8=0 ]
means that the micro controller will run at 1M Hz; (by default, the internal clock is 8MHz, and /8 is turned on. In another word, by default microcontroller is running at 1MHz)

But in Neil's example, he is using the default fuse setting, but then in software, he is changing the clock back to 8MHz by:
// set clock divider to /1
//
CLKPR = (1 << CLKPCE);
CLKPR = (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0);

3. Neil's examples on external clock fuse setting

At the end of Embedded Programming week page

4. Neil's example on using internal clock

Any example from Input or Output week.

< Back to home