Starting Electronics Needs Your Help!
It is that time of the year when we need to pay for web hosting and buy new components and equipment for new tutorials. You can help by making a donation. Contribute to this website by clicking the Donate button. The total will be updated once daily. (You may need to clear your browser cache to see the updates.)
Target Amount: $2000
Amount Raised: $1061
Top Donor: C.C. $100
Created on: 25 April 2013
Part 7 of the ATtiny2313 Tutorial
The system clock for the ATtiny2313 can be selected from a number of different sources: from an external clock source, internal 4MHz RC oscillator, internal 8MHz RC Oscillator, watchdog internal 128kHz oscillator or an external crystal / ceramic resonator.
The clock source can be selected by programming fuse bits in the microcontroller so that the desired clock source will be used by the microcontroller at startup.
Atmel Studio can be used to program the clock source selection bits. There is also a fuse bit that can be programmed in order to divide the clock source by 8 – the CKDIV8 fuse bit.
The system clock can be output on pin 6 of the ATtiny2313 by setting the CKOUT fuse bit.
This video shows the CKOUT bit being set so that the system clock can be viewed on an oscilloscope. Various system clock sources are then selected by setting the appropriate fuse bits using Atmel Studio.
Can't see the video? View on YouTube →
The image below shows part of the Device Programming dialog box from Atmel Studio – the default clock settings can be seen.
A new ATtiny2313 will have the default factory settings of the clock fuses set as follows:
This means that the system clock is set to 1MHz by default: 8MHz ÷ 8 = 1MHz.