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 support@ccsinfo.com

WDT setup problem...

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



Joined: 14 Mar 2005
Posts: 5
Location: TURKEY/Ankara

View user's profile Send private message Send e-mail ICQ Number

WDT setup problem...
PostPosted: Tue May 03, 2005 5:59 pm     Reply with quote

Quote:
..... When assigned to WDT, a CLRWDT instruction will clear the prescaler along with the Watchdog Timer. The Prescaler is not readible or writable....

writes in PIC16F628A datasheet, But CCS compiler (3.206) have no caution about restart_wdt(); --> CLRWDT command.

So do i need to set prescaler every time i clear WDT? Or it is enough to setup WDT once in whole code?

Which code is the right one?
......
setup_wdt (WDT_2304MS);
restart_wdt();
......
OR
......
restart_wdt();
setup_wdt (WDT_2304MS);
......


Thanks in advance,
_________________
---------------------------------------------------------
The only thing that equally given mankind is time.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue May 03, 2005 10:46 pm     Reply with quote

The prescaler is a binary counter. When you use the setup_wdt()
function, you are selecting one of the counter outputs, so that
your WDT timeout duration is multiplied by 1, 2, 4, 8, 16, 32, 64 or 128.
This selection doesn't change when you use restart_wdt().

The restart_wdt() function clears the prescaler counter to a value of 0.
But it doesn't change the selection of the counter output.

So the answer is, you use setup_wdt() one time, at the start of
your program. Then use restart_wdt() after that, in some suitable
location (or several locations) in your program.
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