At 04:11 PM 4/18/2006, Phillip wrote: >I wanted to enable the WDT and then in my main loop reset the thing every so >often so it never issues a reset unless my code gets lost and never makes it >back to my main loop. > >Much to my surprise when I read the instruction CLRWDT it says it resets the >prescaler for the thing. > >So I assume it means I will have to do a write to the prescaler each time I >top off the WDT. You've already gotten some good answers to this but I thought I'd fill in a couple of pieces . . . Issuing a CLRWDT command clears the prescaler *IF* the prescaler is assigned to the watchdog. Microchip take care to mention this to help you avoid an unintended watchdog reset if you should need to change the prescale value. You do not have direct access to the prescaler. The only way to clear it is to clear whatever the prescaler is assigned to: CLRWDT clears the prescaler if the prescaler is assigned to the watchdog; clrf TMR0 clears the prescaler if the prescaler is assigned to TMR0. Note that the only way to get a prescale value of 1 assigned to TMR0 is to assign the prescaler to the watchdog. I have seen code where it was necessary to change the TMR0 prescale ratio on the fly from some other value to 1: the only safe way to do that is clear TMR0 *before* assigning the prescaler to the watchdog. Hope this help. dwayne -- Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax Celebrating 22 years of Engineering Innovation (1984 - 2006) .-. .-. .-. .-. .-. .-. .-. .-. .-. .- `-' `-' `-' `-' `-' `-' `-' `-' `-' Do NOT send unsolicited commercial email to this email address. This message neither grants consent to receive unsolicited commercial email nor is intended to solicit commercial email. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist