Rev 687 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 687 | Rev 689 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | TCCR2A &= ~((1<<COM2B1)|(1<<COM2B0)|(1<<COM2A0)); |
31 | TCCR2A &= ~((1<<COM2B1)|(1<<COM2B0)|(1<<COM2A0)); |
32 | TCCR2A |= (1<<COM2A1)|(1<<WGM21)|(1<<WGM20); |
32 | TCCR2A |= (1<<COM2A1)|(1<<WGM21)|(1<<WGM20); |
Line 33... | Line 33... | ||
33 | 33 | ||
Line 34... | Line 34... | ||
34 | // Timer/Counter 2 Control Register B |
34 | // Timer/Counter 2 Control Register B |
35 | 35 | ||
36 | // Set clock divider for timer 2 to SYSKLOCK/8 = 20MHz / 8 = 2.5MHz. |
36 | // Set clock divider for timer 2 to SYSKLOCK/8 = 20MHz / 8 = 2.5MHz |
Line 37... | Line 37... | ||
37 | // The timer increments from 0x00 to 0xFF with an update rate of 2.5 MHz, |
37 | // The timer increments from 0x00 to 0xFF with an update rate of 2.5 MHz, |
38 | // hence the timer overflow interrupt frequency is 2.5 MHz / 256 = 9.765 kHz |
38 | // hence the timer overflow interrupt frequency is 2.5 MHz / 256 = 9.765 kHz or 0.1024 ms |
39 | 39 |