CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

set watchdog time out period

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
qbeexx



Joined: 19 Jul 2007
Posts: 2

View user's profile Send private message

set watchdog time out period
PostPosted: Wed Aug 29, 2007 10:14 pm     Reply with quote

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







PostPosted: Thu Aug 30, 2007 3:58 am     Reply with quote

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

View user's profile Send private message AIM Address

PostPosted: Thu Aug 30, 2007 8:26 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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