#define F_CPU 1000000UL #include #include #include #include ISR(TIMER1_COMPA_vect) { sleep_disable(); TCNT1 = 0; } int main (void) { uint8_t min; uint8_t hour; DDRB = 0x03; TCCR1B |= ((1 << CS10) | (1 << CS12)); // Set up timer at Fcpu/1024 OCR1AH = 0xe4; OCR1AL = 0xc0; TIMSK = (1 << OCIE1A); min=0; hour=0; sei(); while (1) { PORTB ^= (1 << 0); sleep_enable(); sleep_cpu(); min++; if (min==60) { hour++; min=0; } if (hour==1 && min==0) { PORTB ^= (1 << 1); } if (hour==1 && min==2) { PORTB ^= (1 << 1); hour=0; } } return 0; }