|
|
View previous topic :: View next topic |
Author |
Message |
qbeexx
Joined: 19 Jul 2007 Posts: 2
|
set watchdog time out period |
Posted: Wed Aug 29, 2007 10:14 pm |
|
|
dear all,
Im using pic16f887,
According to PIC16F887 datasheet, Page 222
///////////////////////////////////////////////////////////////////////////////////////////////
14.5 Watchdog Timer (WDT)
The WDT has the following features:
. Operates from the LFINTOSC (31 kHz)
. Contains a 16-bit prescaler
. Shares an 8-bit prescaler with Timer0
. Time-out period is from 1 ms to 268 seconds
. Configuration bit and software controlled
///////////////////////////////////////////////////////////////////////////////////////////////
I run the EX_WDT.C with setting Register OPTION_REG.PS<0..2> = 000
and WDTPS <0..3> = 000, The WDT period time out is 1ms.
by change the value of these 2 registers,
(1)the WDT time out period can ONLY be set for
1ms,2m,4ms,8ms,16ms,32ms,64ms,128ms,256ms,512ms,1024ms,2048ms,4096ms,8192ms,
16384ms,32768ms,65536ms,131072ms,262144ms, right?
(2)it's not possible to create a WDT time according to our wish e.g. 100 ms
time out, right?
Thanks. |
|
|
Ttelmah Guest
|
|
Posted: Thu Aug 30, 2007 3:58 am |
|
|
Yes. It doesn't say that the watchdog prescaller can take 'any' 16bit value, just that it has a 16bit range.
There are a number of comments that apply though.
First, the watchdog is not designed as a timer in the normal sense. It is designed as a 'disaster recovery' option, and as such timing errors are unimportant. The older watchdog on many chips, has a timing accuracy, that is worse than +/- about three hundred percent....
Even on this chip, the oscillator used for the watchdog, has a range of 15KHz, to 45KHz, giving the timeout from a 'nominal' 128mSec, between 88, and 264mSec.
Now, you can have an accurate time if required, by supplying an external clock, using the timer1 prescaler.
If you want a nominal 'time' of 100mSec, for a sleep for example, and can accept the timing errors, then simply count a shorter interval. Sleeping for 4mSec, and counting to 25 for example.
Best Wishes |
|
|
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
|
|
Posted: Thu Aug 30, 2007 8:26 am |
|
|
Yes the watchdog timing varies enough with respect to ambient temperature that there are applications that use the variation to measure temperature. From an accurate timing perspective the emphasis should be on the word dog not on the word watch. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|