I am very new to AVR (and uControllers in general). I am trying to figure out how to set up ATmega for diferent clock frequencies.
I am working thru this tutorial http://electrons.psychogenic.com/modules/arms/art/14/AVRFusesHOWTOGuide.php.
In part it says:
By checking the Clock Sources section of the datasheet, you can see that the clocking options are set using 4 CKSEL bits that specify the type of clock source the chip will use, and the CKOPT bit (which tells the chip to pay attention to our CKSEL bits and influences startup time).
The actual bits you use depend on the hardware you've got. Here we'll say we're using a 2MHz crystal. In this case, we determine that we should set CKSEL3..0 (this notation, used in the datasheets, indicates CKSEL bits 3 to 0, starting at 3) to 1100 and we should also ensure the CKOPT bit is 1.
Now that we know which bits we wish to set we need to know where they fit in, in the grand fuse byte scheme of things. To do this, have a look at the following tables, which indicate the position and function of each bit in the low and high fuse bytes (for the ATmega8).
I am confused as to how the value for CHSEL0 is determined. When I look at the data sheet (pg26 thru 29), table 4 says that CKSEL3..1 should be set to 110. But table 5 is not clear as to how CKSEL0 is determined?
Another question is this: what got me started on this "rabbit trail" was that I wanted to (for leducational purposes) set up a circuit and write a program that read a switch (so I was looking over tis tutorial - http://www.micahcarrick.com/05-15-2006/avr-tutorial-switch-debounce.html. It suggests using an external 8Mhz crystal. Can i just use the 8Mhz internal RC Oscillator?
Thank you for the any help :D