i'm new to this list (in fact this is my first post :)
well, i have some questions about WDT. i need some understanding about
1) what will WDT do ? is it the WDT will interrupt at every preset time
to check if the program hang ?
2) if the prescaler is set to 1:128 for WDT, will this mean the WDT will
interrupt every 6.5536 ms (20Mhz crystal) ? if so, is it possible to
have longer period ?
A WDT will cause a reset if it is not triggered before it times out. The idea
is for the WDT never to time out. So you scatter a routine throughout your
code to ensure it is triggered before it can time out.
Steve Landas wrote:
> The idea is for the WDT never to time out. So you scatter a routine
> throughout your code to ensure it is triggered before it can time out.
Err, no! That is not what you do. If you want to do that, it is much
easier to set WDT_OFF in the configuration word, *then* it will never
Correct use of the WDT is a FAQ and slightly involved. Basically, you
decide on a part of the code which is always executed if the program is
working correctly, at intervals less than the time-out period set up for
You then place *one* CLRWDT instruction in this code so that if the
code fails to execute this instruction because it incorrectly branches
somewhere else and gets caught in a loop or something, then the WDT
times out and causes a processor reset.
This to protect against a glitch causing code execution to go awry.
It is not intended to counteract a program error. In practice however,
it is often not needed for the protective purpose and used instead as an
extra, approximate timer function, particularly to allow current saving
in periods of sleep.
Sorry, I didn't check the original poster's calculations for the
timeout period but it is essentially *approximately* 18 ms times the
prescaler value set up for the WDT, *IF* it is assigned to the WDT. If
the prescaler is assigned to the counter, then timeout is 18 ms.
> 2) if the prescaler is set to 1:128 for WDT, will this mean the WDT will
> interrupt every 6.5536 ms (20Mhz crystal) ? if so, is it possible to
> have longer period ?
The WDT has it's own internal oscillator and therefore is independant of
the clock used for the chip itself, however, the WDT clock rate will
vary with changes in temp.
You can use the postcaler to get WDT timeouts of around 2 seconds when
set to 1:128. At 1:1 it is about 18mS.
More... (looser matching)
- Last day of these posts
- In 1999
, 2000 only
- New search...