Hi Dwayne thanks for the reply Here is what the data sheet says. I copied this from the directly from the data sheet. CLRWDT instruction resets the Watchdog Timer. It also resets the prescaler of the WDT. Status bits TO and PD are set. Resetting something is different to me than resetting and preloading a divisor....(wouldn't be the first time my definition was different the rest of the world's) So I thought this would clear the Watchdog Timer Period Select bits. I feel the data sheet should read CLRWDT instruction resets the Watchdog Timer. It also resets the prescaler and reloads the divisor value determined by the state of the Watchdog Timer Period Select bits of the WDT. The Status bits TO and PD are set. The watch dog has two prescalers available to it. One is dedicated (The low freq clk has to pass through ) and the second (timer0s prescaler) is available the WDT can be made to pass through if you set the PSA bit then the WDT is routed though both prescalers (maybe calling it a post scaler would be more appropriate) After I figured out the first "preload" issue I was still having difficulty because the time out of 150 seconds was longer than could be achieved with only the WDTs dedicated prescaler. So I knew clearing the PSA of the OPTION_REG was not happening and the timer0 prescaler was being used. Out of desperation I selected bank 3 and cleared the PSA of the OPTION_REG and everything worked fine. Olin says I'm nuts........that this can't be happening which I would tend to believe over my lying eyes. All I know is that this makes the thing time out at 1 about one sec when I preload with the divisor setting that selects a 32768 divisor. 32768 * 32.26 usec = 1.06 sec This works i.e. gives me a time out roughly ever sec config_WDT: bsf STATUS,RP0 ;Select bank 3 bsf STATUS,RP1 ; bcf OPTION_REG,PSA bsf STATUS,RP0 ;Select bank 1 bcf STATUS,RP1 ; bcf WDTCON,WDTPS0 bsf WDTCON,WDTPS1 bcf WDTCON,WDTPS2 bsf WDTCON,WDTPS3 bsf WDTCON,SWDTEN ;not needed if config bit is set return and this does not ...........i.e. gives a WDT time out every 150 seconds so in my mind the timer0 prescaler is in play config_WDT: bsf STATUS,RP0 ;Select bank 1 bcf STATUS,RP1 ; bcf OPTION_REG,PSA bcf WDTCON,WDTPS0 bsf WDTCON,WDTPS1 bcf WDTCON,WDTPS2 bsf WDTCON,WDTPS3 bsf WDTCON,SWDTEN ;not needed if config bit is set return Thanks to all and if anyone has a bank1 verses bank 3 theory I'd be happy to hear it. Phillip Things should be as simple as possible but no simpler Phillip Coiner CTO, GPS Source, Inc. Your source for quality GNSS Networking Solutions and Design Services, Now! -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf Of Dwayne Reid Sent: Thursday, April 20, 2006 12:48 PM To: Microcontroller discussion list - Public. Subject: Re: [PIC] watch dog prescaler 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 -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist