Инит:
void TimerInit(void)
{
TCCR0 = (1 << CS00) | (1 << CS01) | (1 << CS02);
TIMSK = 1 << TOIE0; ASSR = 1 << AS0;
}
#pragma vector = TIMER0_OVF_vect
__interrupt void TIMER0_OVF_Interrupt (void)
{
clrbit (MCUCR, SE);
}
В программе:
for (SleepSecondsCount = 0; SleepSecondsCount <= eeWaitState*8; SleepSecondsCount++)
{
MCUCR = (1 << SM0) | (1 << SM1); // Power-save
setbit (MCUCR, SE);
asm ("sleep");
}