Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

Watchdog Timer on Mega8

Watchdog Timer on Mega8

2006-06-18 by kernels_nz

Hi guys,

Im using a Mega8 at the moment and cant quite understand whats
happening with my watchdog timer. I have never used the watchdog timer
before, but have had quite a bit of general programming experience.

Basically, I do as the datasheet says, 

I write a one to WDCE and WDE simultaneously, then in the next
instruction write 0x0F to WDTCR (2048k prescaler, WDE = 1)

But, when I try to disable the watchdog by doing the same as above,
except writing 0x00 to WDTCR, the processor resets, like a watchdog
reset. 

I disable it will within the 2seconds I should have before it expires. 

Has anyone else had issues with the watchdog timer ?

By the way, im using an 8Mhz internal oscillator, Watchdog enable fuse
not blown, so it should be under software control.

Would greatly appreciate any help !!

Cheers
Hein B
Auckland, New Zealand.

Re: [AVR-Chat] Watchdog Timer on Mega8

2006-06-19 by John Samperi

At 11:09 AM 19/06/2006, you wrote:
>Has anyone else had issues with the watchdog timer ?

This is the recommender way to turn off the WDT. I guess
you have copied your routine from the data sheet. I guess you
could do a WDR before turning it off just in case it is about
to reset. Also the bits in the MCUCSR would show if in fact it
is the WD.

WDT_off:
; Write logical one to WDCE and WDE
ldi r16, (1<<WDCE)|(1<<WDE)
out WDTCR, r16
; Turn off WDT
ldi r16, (0<<WDE)
out WDTCR, r16
ret



Regards

John Samperi

********************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495       Fax (02) 9674-8745
Email: john@ampertronics.com.au
Website  http://www.ampertronics.com.au
*Electronic Design * Custom Products * Contract Assembly
********************************************************

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.