The Atmega 8 can't do an interrupt through the WDT module. It only can do a direct reset of the whole CPU. So this way to wake up the CPU from the sleep isn't practicable. Another way is to run the timer with an external clock in the sleep mode and generate an interrupt through this. I use a 32.768kHz crystal for this job.
Activated the Asynchronous mode of Timer2
ASSR |= (1<<AS2);
TCNT2 = 0x00;
OCR2 = 32;
TCCR2 = (1<<CS20);
And it seems to work!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.