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 not working
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Graham Webb



Joined: 18 Apr 2008
Posts: 9

View user's profile Send private message

PostPosted: Tue Aug 10, 2010 3:23 am     Reply with quote

Was this resolved because I am having the same problem with the following code:
Code:

#include <C:\Program files\PICC\devices\16f876a.H>
#include <C:\Program files\PICC\drivers\stdio.h>
#fuses  HS,WDT,NOPROTECT,NOLVP
 
#define GREEN PIN_C1 //pin C1  = out green LED
#define BLUE PIN_C2 //pin C2  = out blue LED
 
SET_TRIS_C(0b00000000);
 
void main()   
{
   if (restart_cause() == WDT_TIMEOUT)
      {
     output_high(BLUE);
      }
   
   setup_wdt(WDT_2304MS);
   
   while(TRUE)
   {
      output_high(GREEN);
      output_low(GREEN);
   }
}

This uses a 20 MHz crystal, the green LED toggles rapidly (370 kHz) and the blue LED never comes on. I'm expecting the blue LED to come on once after 2.3 seconds.

I'm using MPLab 8.53 with the CCS c-compiler 3.223.

I did find that the configuration bit for the WDT in MPLab is off and reverts to off when I compile this, so I'm going to try manually switching it on now.
Graham Webb



Joined: 18 Apr 2008
Posts: 9

View user's profile Send private message

PostPosted: Tue Aug 10, 2010 3:40 am     Reply with quote

Whatever I do the WDT configuration bit reverts to off, very odd. Any ideas?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Aug 10, 2010 11:49 am     Reply with quote

Are you trying to run this program in Debug mode, with an ICD ?
The ICD2 Help file says:
Quote:

Debugger Limitations

The Watchdog Timer (WDT) cannot be used when debugging.

So either the compiler and/or MPLAB is turning it off for you. It won't
let you enable it in Debug mode.
Graham Webb



Joined: 18 Apr 2008
Posts: 9

View user's profile Send private message

PostPosted: Tue Aug 10, 2010 12:07 pm     Reply with quote

Thanks PCM Programmer, that solved it!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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