summaryrefslogtreecommitdiffstats
path: root/main.c
blob: aed94654138b0ca20d0ecc118cc705ca32160a27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <avr/io.h>
#include <avr/interrupt.h>

int main(void)
{
	DDRB |= (1 << DDB5);

	TCCR1A = 0;
	TCNT1 = 65535 - (F_CPU / 1024);
	TCCR1B = (1 << CS10) | (1 << CS12);
	TIMSK1 = (1 << TOIE1);

	sei();

	for (;;)
		;

	return 0;
}

ISR(TIMER1_OVF_vect)
{
	PORTB ^= (1 << 5);
	TCNT1 = 65535 - (F_CPU / 1024);
}