'Novice help with WDT'
Thanks for the reply. I am (and have always been) a little fuzzy on what the
pre-scalar does. Now looks like a good time to get a handle on what I expect
is a simple thing. I read the data sheets and I've tried to get a handle on it
but everything assumes I know what it is - and of course I don't.
How long does it take for the WDT to time out? How do I use the pre-scalar to
slow it down. I assume the prescalar does some sort of adjustment to the way
the WDT counts but I don't understand exactly how. I'm using a 16C84 at 4Mhz
so I get 1uS per instruction FWIW. Does the prescalar affect anything else?
Ok, I looked at the data sheet of the PC16C84...
>How long does it take for the WDT to time out?
The WDT has a nominal timeout period of 18ms. If you use no postscaler the
chip will be reset 18ms after the last CLRWDT instruction. With the
postscaler you can slow it down.
>How do I use the pre-scalar to slow it down.
If you would enable the postscaler with instructions like :
MOVLW B'xxxx1111' ; where x depends on other req.
MOVWF OPTION_REG ; bit 0-2 sets the scale to 1:128
; bit 3 assigns the scaler to the WDT
(Note: You can't use the scaler for the
WDT and Timer0 at the
same time . So now you wouldn't have a prescale
r for Timer0 )
you would slow it down to the maximum, about 18ms*128 ~= 2.3s.
In your case after ~2,300,000 instructions. Don't get to close to that
value for the next CLRWDT. In very cold enviroment timeout may be shorter.
In my docu at page 85.
By modifying bit 0-2 you can adjust the timeout period. ( In my docu on
page 15 OPTION REGISTER)
>I assume the prescalar does some sort of adjustment to the way the WDT
counts but I don't understand exactly how.
To be more precise, the timer will still run out after 18ms. But now it
will increase the postscaler instead of doing the reset. The time the
postscaler overflows the reset is generated. (That's how I understand it.
Microchip may forgive me if I am talking bs now)
>Does the prescalar affect anything else?
You can use it only for the WDT !or! timer0.
for timer0 it works as a prescaler for the WDT as a postscaler.
More... (looser matching)
- Last day of these posts
- In 1997
, 1998 only
- New search...