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

[Help] Setup WDT in PIC18F4680

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



Joined: 25 Aug 2009
Posts: 175

View user's profile Send private message Yahoo Messenger

[Help] Setup WDT in PIC18F4680
PostPosted: Wed Mar 18, 2015 12:46 am     Reply with quote

Hi
I have a problem when tried to setting WDT on PIC18F4680
In main program, i also used timer 0, and I can't config WDT with " setup_wdt() with another parameter, I can only setup with "WDT_512ms"
My config "
Code:

#include "18F4680_me.h"   #fusesH4,PUT,PROTECT,NODEBUG,NOLVP,WDT256,NOPBADEN,MCLR,BROWNOUT,BORV28
#use delay(clock=40000000)                                                                         
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, errors)


-timer0 setup
Code:

set_timer0(62);       
setup_timer_0 (RTCC_INTERNAL | RTCC_8_BIT | RTCC_DIV_256);   


- main code

Code:

void main(void)
{
.
.
.
   setup_wdt(WDT_ON|WDT_512mS);   // can't config with another parameters without WDT_512ms
   restart_wdt();   
   for(;;)                      // main loop
{
   restart_wdt();   
.
.
.
}

}


I'm using CCS C ver 5.021
Pls show me a problems when setup with WDT, is it conflict with timer0 ?
Thanks.
_________________
Begin Begin Begin !!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Mar 18, 2015 1:30 am     Reply with quote

The 18F4680 data sheet says:
Quote:

24.2 Watchdog Timer (WDT)

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
.

This means if you want to use setup_wdt(), you must put NOWDT (only)
in the #fuses. Remove the WDT256 and replace it with NOWDT.
tienchuan



Joined: 25 Aug 2009
Posts: 175

View user's profile Send private message Yahoo Messenger

PostPosted: Wed Mar 18, 2015 2:59 am     Reply with quote

Thank so much
I fixed!Smile
_________________
Begin Begin Begin !!!
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