1 | #include <avr/io.h> |
2 | #include <avr/interrupt.h> |
3 | |
4 | volatile uint8_t min = 0x00; |
5 | volatile uint8_t overflow = 0x00; |
6 | |
7 | int main(void) |
8 | {
|
9 | DDRB = 0x00; |
10 | PORTB = 0x00; |
11 | |
12 | TCCR1B |= (1<<CS12) ; |
13 | TIMSK |= (1<<TOIE1); |
14 | sei(); |
15 | |
16 | for(;;) { |
17 | PORTB = min; |
18 | }
|
19 | |
20 | return 0; |
21 | }
|
22 | |
23 | ISR(TIMER1_OVF1_vect) |
24 | {
|
25 | ++overflow; |
26 | if (overflow == 5) { |
27 | ++min; |
28 | overflow = 0; |
29 | }
|
30 | }
|