/* code015.c ATmega88 @ 8MHz */
#include <avr/io.h>

uint32_t counter = 100000;

int main(void)
{
	DDRD = 0xFF;
	PORTD = 0x00;
	
	asm ("WDR");	// watchdog reset
	
	WDTCSR = (1<<WDCE)|(1<<WDE);						// watchdog change enabled
	WDTCSR = (1<<WDE)|(1<<WDP0)|(1<<WDP1)|(1<<WDP2);	// watchdog system reset enabled,
	
	// set timeout 2s
	asm ("NOP");	// no operation
	
	while(1)
	{
		while (counter >= 1)
		{
			counter --;
			PORTD = (1<<PD7);	// LED ON
		}
		asm ("WDR");			// watchdog reset
		counter = 100000;
	}
}