Searching \ for 'WDT (was: PIC Wierdness)' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'WDT (was: PIC Wierdness)'.

Truncated match.
PICList Thread
'WDT (was: PIC Wierdness)'
1999\10\24@214601 by Thomas Brandon

flavicon
picon face
The WDT appears to be one of the most misunderstood parts of a PIC (or
Scenix). The basic idea of the WDT is to allow you to detect logical failure
of your system and trigger a reset. The WDT is a timer that like the other
timers increments every x instruction where x is the value fo the prescaler.
However where other timers generate an interrupt on overflow from 0xFF (255)
to 0x00 (0). Hence with a 10MHz clock and prescaler of 1:1 would increment
every inst. (10MHz = 2.5MIPS = 400ns). Thus it would take 256 inst. (256 *
400 = 102.4us) to rollover. Hence, if you don't clear the WDT (with CLRWDT)
every ~100us, the MCU will generate a reset.

I'm not exactly sure why Jason used the WDT for his timing if he had a
CLRWDT in every routine. I would have thought using TMR0 to generate an
interrupt on overflow would have been easier in terms of not having to keep
track of when CLRWDTswere executed.

The general use of the WDT is to generate a reset when the devices enters an
unknown state and thus fails to function correctly. For instance, if you
have a device that is recieving serial communications, you could use the WDT
to reset communications if the device lost synchronisation for a given
period. In this case you could set the WDT prescaler to overflow at the
maximum time without synchronisation. You would then add a CLRWDT at a point
that was only executed when synchronisation was present (e.g. when the stop
bit was checked indicating succesful transfer). Thus the WDT would only be
reset when synchronisation was present, so if you lost sync. for more than
the overflow time of the WDT, a reset would automatically be generated.
Then, the reset code would have a routine to reset tyhe serial channel
allowing sync to be reestablished.

However, if CLRWDT's are scattered throughout the code it is difficult to do
anything useful with the WDT. The main problem is if multiple routines are
resetting the WDT within th e appropriate period, they must all go wrong for
the reset to occur. For instance, if you added a CLRWDT to the recieving
routine of the above example. Now, recieving may not be occuring but as it
continues to send data a reset is never generated. Hence, care must be
exercised when using a WDT to detect multiple critical failures as one
section may fail but fail to create a long enough delay to generate a reset.

Tom.
{Original Message removed}

1999\10\25@065822 by Dr. Imre Bartfai

flavicon
face
Hi,

sorry, but the text below contains parts which are simply not true. The
correction:

In fact, WDT is an independent timer has a nominal 18msec timeout. It has
nothing to do with instructions or whatever, e. g. WDT runs even in sleep
mode. The prescaler multiplies that 18msec, so the longest WDT timeout is
nominally 2.304 sec. I say nominally as it runs an independent RC
oscillator with a fairly tolerance and temperature dependence. The
programmer has no access to the WDT counter except he can clear it by
means of CLR WDT instruction.

Please consider this when interpreting the otherwise correct text below.

Regards,

Imre


On Mon, 25 Oct 1999, Thomas Brandon wrote:

{Quote hidden}

> {Original Message removed}

1999\10\25@082413 by PDRUNEN

picon face
In a message dated 99-10-25 07:28:56 EDT, you write:

<< In fact, WDT is an independent timer has a nominal 18msec timeout. >>

We found that this value, 18msec could go as low as 6msec with tempertures
around -20 F.

Paul

1999\10\25@191222 by Thomas Brandon

flavicon
picon face
Oooopss, wrote that one too early in the morning. You are of course correct,
WDT is generated from internal RC oscillator, hence, it's use to reset
devices from sleep and it's variations with temperature. Not sure about PIC,
but I've seen the Scenix WDT specced with up to 30% innacuracy in extreme
cases. You can also control the WDT period by assigning the TMR0 prescaler
to it (TMR0 prescaler = 1:1), but yes the actual value is inaccesible.


BTW: Very nice use of WDT by Jason.
Tom.
{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...