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

16F1937 WDT and Sleep

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



Joined: 21 Nov 2003
Posts: 200

View user's profile Send private message

16F1937 WDT and Sleep
PostPosted: Fri Mar 25, 2011 8:53 am     Reply with quote

Using 4.119
Setting WDT #FUSES WDT
SETUP_WDT(WDT_ON|WDT_2S);

Sleep();

The processor will not wake up from sleep using the WDT in this instance. It will come out with an external int so I know it can come out. Any thoughts?
curt2go



Joined: 21 Nov 2003
Posts: 200

View user's profile Send private message

PostPosted: Fri Mar 25, 2011 10:56 am     Reply with quote

Did some more playing around and I cant even get the WDT to reset the processor at all. Any thoughts? Thanx
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 25, 2011 1:15 pm     Reply with quote

I was able to make it work. Take the existing Ex_wdt.c example file and
edit it as follows:

Remove the existing header lines and put it this:
Code:

#include <16F1937.h>
#fuses INTRC_IO,WDT,BROWNOUT,PUT
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)


Remove the existing setup_wdt() line that's just above the while() line,
and put in this:
Code:
 setup_wdt(WDT_2S);



This is the output in the terminal window. If I hit the Enter key
within 2 seconds, then it doesn't give the "Restarted" message.
So it's working. This is with vs. 4.119.
Quote:

Restarted processor because of watchdog timeout!
Hit any key to avoid a watchdog timeout.

Restarted processor because of watchdog timeout!
Hit any key to avoid a watchdog timeout.
Hit any key to avoid a watchdog timeout.
Hit any key to avoid a watchdog timeout.
Hit any key to avoid a watchdog timeout.
Hit any key to avoid a watchdog timeout.
Hit any key to avoid a watchdog timeout.

Restarted processor because of watchdog timeout!
Hit any key to avoid a watchdog timeout.
curt2go



Joined: 21 Nov 2003
Posts: 200

View user's profile Send private message

PostPosted: Fri Mar 25, 2011 1:36 pm     Reply with quote

Thanx. I trimmed everything else I had in there out and it still didn't work. But then I had a #device ICD= True.. It was that statement that was screwing things up... TTY
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 25, 2011 1:39 pm     Reply with quote

That's right. WDT is not allowed in Debug mode. The compiler will turn it
off for you, if you accidently leave it enabled in the fuses. But it doesn't
warn you about this.
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