#include <avr/io.h>
#include <stdint.h>

void wacht1sec() {
	uint8_t i;

	TCNT0=160;
	TCCR0&=~(1<<WGM01|1<<WGM00|1<<CS01);
	TCCR0|=1<<CS02|1<<CS00;

	for (i=0; i<10; i++) {
		TIFR=1<<TOV0;
		while(!(TIFR&1<<TOV0));
	}

	TCCR0&=~(1<<CS02|1<<CS01|1<<CS00);
}

int main() {
	void wacht1sec();	

	DDRB=0xFF;
	PORTB=0xFF; /* alle LEDs uit */
	while(1) {	
		wacht1sec();
		PORTB^=1<<7; /* flip LED7 */
	}
	return 0;
}
