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

watchdog problem (18f67k22)

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



Joined: 06 Oct 2008
Posts: 43

View user's profile Send private message

watchdog problem (18f67k22)
PostPosted: Mon Feb 04, 2013 4:32 am     Reply with quote

hi, can anybody look at this sample code?

Code:

#include <18F67K22.h>

#FUSES NOWDT, INTRC_IO, NOPROTECT, NOIESO, BROWNOUT, PUT, NOCPD, STVREN, NODEBUG, NOWRT, NOWRTD, NOEBTR, NOCPB, NOEBTRB, NOWRTC, NOWRTB, FCMEN, NOXINST, MCLR, RTCOSC_INT
#use delay(clock=16000000)

#use rs232(force_sw,baud=57600, xmit=PIN_G1, rcv=PIN_G2, stream=PC)

#include <stdlib.h>
#include <string.h>

void main(){
   
   delay_ms(2000);
   fprintf(PC,"start\n");
   setup_wdt(WDT_ON);
   do{
   }while(1);
}


the output i was hoping was the watchdog would be triggered and it would reset my program. however, it didnt. it just hangs in the while loop even if i have already placed the setup_wdt(WDT_ON). i tried it on a different chip (18f46k20) and it works. can anybody tell me what seems to be the problem here? thanks
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Mon Feb 04, 2013 4:47 am     Reply with quote

Read the data sheet.
What does the NOWDT fuse do on this chip?.

Key is that on some chips, you have only two settings. Watchdog on, and watchdog off, but can be enabled in software. On this chip, 'NOWDT', means the watchdog is completely off, and cannot be enabled in software. You need to select 'WDT_SW', which on this chip means the watchdog can be controlled by software.

Best Wishes
overmindx



Joined: 06 Oct 2008
Posts: 43

View user's profile Send private message

PostPosted: Mon Feb 04, 2013 5:32 am     Reply with quote

thanks for your help Ttelmah... :D
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