Exact match. Not showing close matches.
'[PIC] implementing the WDT'
I was wondering if anyone knew of a good treatise on implementing the software WDT, various methods.
Just about every code example I've looked at has __WDT_OFF.
Jose Da Silva
|On June 9, 2005 11:52 pm, Roland wrote:
> Hi All
> I was wondering if anyone knew of a good treatise on implementing the
> software WDT, various methods.
> Just about every code example I've looked at has __WDT_OFF.
You haven't really mentioned what you want to use it for, so here are some random thoughts....
Here's one with it on.
Here's one that makes use of it.
Some information with an example... ;-)
For myself, I used the middle one to make a 20minute timer +/- about 10% but it could be much more accurate if measured against a crystal instead of an internal oscillator on a 12c508 ;-)
or to re-quote an old thread....
Re: [PIC]: 16F676 internal clock and external clock - low power required
Date: Wed May 5 03:04:04 2004
On Tuesday 04 May 2004 19:24, Peter Mcalpine wrote:
>I have a little project that must last quite
>a while on battery power. Basically it is the
>PIC micro plus an RFWaves transceiver. It will
>turn on once every 1 minute and transmit a couple
>of bytes, wait for a reply.
"Automatic Calibration of WDT Time-out Period" (DS91003A)
The example is in C and uses the timer for counting, however if you write a loop in assembler that increments a counter, it is more accurate.
Do a recalibration every now and then, example, every hour, to account for variables like battery etc...
Turn-off all services you normally have off during wait before doing a
calibration so that the battery is as close to ideal voltage during
Because you use a transceiver, you can occasionally use it to further
refine the 'wait' required.
wait = CONSTANT / count
wait = how many WDT resets you need to wait for 1 minute.
CONSTANT = (1000000 x 60) / (128+1) / 3.011 = 154472
1000000 x 60 = 1 minute
128+1 = (WDT divided by 128, 1=Tdrt=device reset timer period)
3.011 = average number of cycles for MY program to increment a 3byte
"count" (9ms approx 11956, 33msec approx 43839).
Your value depends on how tight your loop counter written.
To derive 'count', reset count = 0, reset WDT, then start incrementing
"count" until WDT times_out.
My program would get a count between 11956...43839 based on a loop counter that took approx 3.011 CPU cycles to increment by 1
Accuracy is as accurate as your internal oscillator calibration value+/- a bit.
If you want better accuracy, use an external xtal.
long time ago when I was using pic16c5x I always used wdt to replace
it was very useful for me. The only thing I do not like about wdt is it
is RC based clock
if the chip is going to work in hot environment when RC will change your
we also should be able to control WDT to cause interrupt instead of
reset the chip
I normally use the CD14541 timer as a hardware wdt, rather than the onboard RC.
The other day I wanted to use the internal wdt on a F628, but it only goes to ~2 seconds, which I thought was limiting in my application, until I was told of another way to do it;
The 'usual' method is to insert CLRWDT in the code at certain places.
Another is to use a variable, say tim_wdt. Then in the code, you instead write CLRF tim_wdt.
The internal wdt interval is set for say 1.5s
You have one of the timers rolling over every 1s
In the timer interrupt routine, you have (not 'proper' code here)
- incf tim_wdt,f
- if tim_wdt > d20 then goto 0x00
so you now have a watchdog timer set for ~20 seconds.
This is what I meant by methods, and I'm sure there are other tricks. The reason I wanted a long interval is because of the voice chip I'm using. I did'nt want to have a watchdog reset during the playing of the longest message, and thats because the same routine is used, but the messages vary from 1s to around 14s.
At 10:51 AM 10/06/2005 -0700, you wrote:
> The other day I wanted to use the internal wdt on a F628, but it
> only goes to ~2 seconds, which I thought was limiting in my
> application, until I was told of another way to do it;
The drop-in F88 has a WDT + prescaler that can cover 1ms to 268s
--- Jinx <clear.net.nz> wrote: joecolquitt
> The drop-in F88 has a WDT + prescaler that can cover
> 1ms to 268s
I sure wish it was so, I just spent a couple of hours
rerouting a 628 board to use the F88. The F628/A and
F88 have UART RX and TX on different pins. I still
don't get why they did that...
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
> > The drop-in F88 has a WDT + prescaler that can cover
> > 1ms to 268s
> I sure wish it was so
Sorry, "drop-in" isn't 100% true except for basic I/O. I guess
they (and we) really would have liked it to be a seamless drop-
in, but there are so many extra features on the F88 there are
probably good logical (as in routing) and die reasons why the
pins are what they are
More... (looser matching)
- Last day of these posts
- In 2005
, 2006 only
- New search...