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

PIC18F wdt timer problem

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



Joined: 24 Apr 2007
Posts: 7

View user's profile Send private message

PIC18F wdt timer problem
PostPosted: Sun Jul 22, 2007 5:12 pm     Reply with quote

Hi all,

I have been playing around with the wdt on the PIC18F4580. The problem I have noticed is that when the fuses for the wdt timer is set and I try to disable the wdt timer using the function setup_wdt(wdt_off), it doesn't make any difference the watchdog timer still continues to reset the processor at the specified time-interval (in this case about 15 sec).

Below is my test code, could someone tell me what I am doing wrong. I basically want to control the start and stop of the watchdog timer within my code.


#include <18F4580.h>
#fuses XT,NOLVP,WDT4096,PUT,NOBROWNOUT
#use delay (clock=4000000)
#include <STDLIB.H>

void main(){
setup_wdt(wdt_off);

while(1){
sleep();
output_toggle(PIN_E0); //CPU HEARTBEAT
}
}

Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jul 22, 2007 6:02 pm     Reply with quote

Post your compiler version. This is a 4-digit number, such as 3.249,
4.013, 4.045, etc. You can find it at the top of the .LST file, which is
in your project directory. Don't post any numbers that come after the
version number.
vikraml



Joined: 24 Apr 2007
Posts: 7

View user's profile Send private message

PIC18F wdt timer
PostPosted: Mon Jul 23, 2007 7:53 am     Reply with quote

The compiler version is 3.249.


Thanks
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Jul 23, 2007 8:17 am     Reply with quote

Quote:
24.2.1 CONTROL REGISTER
Register 24-14 shows the WDTCON register. This is a
readable and writable register which contains a control
bit that allows software to override the WDT enable
configuration bit, but only if the configuration bit has
disabled
the WDT.
You can only disable (and enable) the watchdog from software when the WDT fuse is set to off.
vikraml



Joined: 24 Apr 2007
Posts: 7

View user's profile Send private message

PostPosted: Mon Jul 23, 2007 8:25 am     Reply with quote

ckielstra, thanks for your reply. If that's the case then my next question would be how do I set the timeout for the watchdog timer. The only way I can set the time is thru the fuses (eg. WDT256,WDT512, etc ) since this is a PIC18 or PCH part.


Thanks
Ttelmah
Guest







PostPosted: Mon Jul 23, 2007 8:53 am     Reply with quote

vikraml wrote:
ckielstra, thanks for your reply. If that's the case then my next question would be how do I set the timeout for the watchdog timer. The only way I can set the time is thru the fuses (eg. WDT256,WDT512, etc ) since this is a PIC18 or PCH part.


Thanks


The enable, is separate from the prescaler.
Just use:
#fuses WDT4096,NOWDT

Which leaves the watchdog _disabled_, allowing software control, but sets up the prescaler.

Best Wishes
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