From 77fa66a6d9a74819f92961a68b7da1ebe414c8cc Mon Sep 17 00:00:00 2001 From: Olaf Rempel Date: Sat, 21 Jun 2008 15:40:07 +0200 Subject: [PATCH] disable watchdog after reset --- main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/main.c b/main.c index 2a50ae0..a61160d 100644 --- a/main.c +++ b/main.c @@ -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<