Searching \ for '[PIC] implementing the WDT' 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: 'implementing the WDT'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] implementing the WDT'
2005\06\10@005237 by Roland

flavicon
face
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.

Regards
Roland Jollivet

2005\06\10@041714 by Jose Da Silva

flavicon
face
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.
http://www.markworld.com/hamradio/buildbeacon.html

Here's one that makes use of it.
http://ww1.microchip.com/downloads/en/AppNotes/91003a.pdf

Some information with an example... ;-)
http://www.engj.ulst.ac.uk/sidk/PIC/AN606.pdf

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:
>Hi All,
>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
waiting period.

Because you use a transceiver, you can occasionally use it to further
refine the 'wait' required.

wait = CONSTANT / count

where:
wait = how many WDT resets you need to wait for 1 minute.

CONSTANT = (1000000 x 60) / (128+1) / 3.011 = 154472
where:
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.

count:
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.

2005\06\10@135057 by Andre Abelian

flavicon
face
Roland,

long time ago when I was using pic16c5x  I always used wdt to replace
interrupt function
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
WDT time.
we also should be able to control WDT to cause interrupt instead of
reset the chip

Andre








Roland wrote:

{Quote hidden}

2005\06\11@133606 by Roland

flavicon
face
Hi

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)
- clrwdt
- 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.

Regards
Roland




At 10:51 AM 10/06/2005 -0700, you wrote:
{Quote hidden}

>-

2005\06\11@174911 by Jinx

face picon face
> 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

2005\06\11@214721 by phil B

picon face
--- Jinx <spam_OUTjoecolquittTakeThisOuTspamclear.net.nz> wrote:
...
>
> 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...    

Phil




               
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail

2005\06\11@220335 by Jinx
face picon face
> >
> > 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
- Today
- New search...