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=20 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%=20 but it could be much more accurate if measured against a crystal=20 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 =A05 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=20 write a loop in assembler that increments a counter, it is more=20 accurate. Do a recalibration every now and then, example, every hour, to account=20 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 =3D CONSTANT / count where: wait =3D how many WDT resets you need to wait for 1 minute. CONSTANT =3D (1000000 x 60) / (128+1) / 3.011 =3D 154472 where: 1000000 x 60 =3D 1 minute 128+1 =3D (WDT divided by 128, 1=3DTdrt=3Ddevice reset timer period) 3.011 =3D 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 =3D 0, reset WDT, then start incrementing "count" until WDT times_out. My program would get a count between 11956...43839 based on a loop=20 counter that took approx 3.011 CPU cycles to increment by 1 Accuracy is as accurate as your internal oscillator calibration value+/-=20 a bit. If you want better accuracy, use an external xtal. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist