View previous topic :: View next topic |
Author |
Message |
valemike Guest
|
setup_wdt(2304_MS) |
Posted: Wed Sep 01, 2004 8:00 am |
|
|
I tried using setup_wdt(2304_MS) on a PIC16F627, using internal oscillator, and I used it as a timer. Everytime I woke up from sleep, i'd increment my timer, then go back to sleep.
I found that by using the "2304ms" option, over time, it actually averaged to 2.85ms.
Is the WDT's RC not that exact? Or is "2304ms" a misnomer?
Thanks,
Mike |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Sep 01, 2004 10:35 am |
|
|
Look in the datasheet and you will find the Min, Type, and Max values.
An example for the 16F87X family with out the prescaler is
Min 7ms
Typ 18ms
Max 33ms
which with the prescaler set to max would have a range from 896ms to 4.224 seconds. |
|
|
valemike Guest
|
|
Posted: Wed Sep 01, 2004 11:41 am |
|
|
Thanks Mark. Darn, looks like i'll need a 32khz external oscillator! Then again, i can always tweak that number per chip shipped. oh well.
-Mike |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Sep 01, 2004 11:47 am |
|
|
Temp will also affect that time |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Sep 01, 2004 11:50 am |
|
|
The problem is not just accuracy but stability. The timeout is likely to vary with temperature, voltage, age, and who knows what else. It is file as a watchdog but doesn't even try to be exact. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
valemike Guest
|
|
Posted: Wed Sep 01, 2004 7:47 pm |
|
|
I was thinking of letting the thing "self-calibrate" itself. That is, I would sample one of the timers, let the wdog trigger, and read one of the timers again. But then, i realized that it would reset, since the wdog would time out. (Unlike when your're in sleep, then the wdog timeout will only wake it up). Nor can i use tmr1,2, or 3 to measure since they don't run when asleep.
So i guess i can just get an external clock which supposedly will keep counting for two minutes. Then again, i can just stay awake for two minutes. That's probably better. |
|
|
|