The PIC WDT actually makes the PIC almost bulletproof, and I ALWAYS
use it. I make sure that there is always just ONE clrwdt in the entire
program,
and it is placed at a point where I expect the PIC to be running
perfectly to
access it.
The PIC natural timeout is ~18ms. I execute CLRWDT every 10-15 ms, rarely
more often. I usually embed it inside a call that may check a few
critical items,
such as the state of the TRIS registers, INTCON, SSPCON etc.
Its possible that the PIC itself gets forced into a state that only a
RESET can
make it recover. This is especially important when the PIC is running
near an
RF source, like a cellular modem, or is line-powered (lightning), or can be
affected by ESD.
While it IS a good idea to rewrite the TRIS resisters often (and I do), I am
suspicious when something causes a TRIS registers or INTCON to be in a
wrong state, and I see that as a signal that an ESD event ocurred- and
if I can,
I allow a WDT reset.
Another reason I like the WDT reset is that it allows a clean reset to occur
after bootloading new firmware. Allowing the WDT to timeout causes a
clean start.
--Bob
Peter L. Peres wrote:
{Quote hidden}> On Mon, 25 Oct 2004, James A wrote:
>
>> I am using a PIC with startup delay, brown-out detect and watch-dog,
>> in a
>> $100 consumer item powered by a wall-wart and 7805. How necessary is
>> it to
>> also include a reset IC for starting up the PIC cleanly? The PIC is
>> going to
>> control the rest of the other ICs, so it's just the PIC.
>>
>> For your info, the unit is likely to be running all the time, 24/7
>> 365 days
>> per year (mainly in the unit's standby mode, but the PIC will be
>> running all
>> that time too).
>>
>> We are going to make about 1000 of them, and this is the first time I've
>> made more than about 100 of anything, and have not used reset ICs in the
>> past. Like most consumer entertainment items, it is not critical that it
>
>
> Plan for 1-3% failure rate in production (in despite of material
> quality control).
>
>> never crashes/starts up, but would be nice to avoid it if
>> cost-effective to
>> do so. The prices of reset ICs that I've seen are comparable to a PIC
>> itself
>> (unless someone can recommend a cheap one), so if it is going to
>> cause one
>> problem in 10k, I am tempted to leave it out.
>
>
> You can arrange your code to hawe the wdt running *and* time out
> deliberately (i.e. never run the clrwdt instruction in the idle loop,
> or better, never use it at all). You only use clrwdt when executing a
> task that should not be interrupted, and only at its start. I have
> used this method and it is nearly impossible to hang the pic when
> using it. It is equivalent to having a reset every 2.x seconds all the
> time. Obviously this cannot be used for more advanced programs but it
> is perfect for the simple buttons-sensors-leds-and-relays minder
> applications I have used it for.
>
> Peter
>
>
> ______________________________________________