Sunday, July 6, 2008

Timer interrupt on Tiny13

Sometimes we have to do somethings in certain period, so timer may be useful for you.
AVR tiny13 have one timer and it count until to 0xFF value for each clock. An interrupt will be then generated and call your interrupt routine.

In our example, we have the following interrupt routine:

ISR(TIM0_OVF_vect) {
if (led){
led = 0;
} else {
led = 1;

This routine is used to toggle the LED On or Off.

The complete project code can be found here:

No comments: