disable watchdog after reset

This commit is contained in:
Olaf Rempel 2008-06-21 15:40:07 +02:00
parent 639c0e9bb9
commit 77fa66a6d9
1 changed files with 12 additions and 0 deletions

12
main.c
View File

@ -126,6 +126,18 @@ ISR(TIMER1_OVF_vect)
}
}
/*
* For newer devices (mega88) the watchdog timer remains active even after a
* system reset. So disable it as soon as possible.
* automagically called on startup
*/
void get_mcusr(void) __attribute__((naked, section(".init3")));
void get_mcusr(void)
{
MCUSR = 0;
WDTCSR = (1<<WDCE) | (0<<WDE);
}
int main(void)
{
DDRB = PHASE_A_EN | PHASE_A_PWM | LED_RT | LED_GN;