View previous topic :: View next topic |
Author |
Message |
curt2go
Joined: 21 Nov 2003 Posts: 200
|
16F1937 WDT and Sleep |
Posted: Fri Mar 25, 2011 8:53 am |
|
|
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
|
|
Posted: Fri Mar 25, 2011 10:56 am |
|
|
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
|
|
Posted: Fri Mar 25, 2011 1:15 pm |
|
|
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:
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
|
|
Posted: Fri Mar 25, 2011 1:36 pm |
|
|
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
|
|
Posted: Fri Mar 25, 2011 1:39 pm |
|
|
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. |
|
|
|