View previous topic :: View next topic |
Author |
Message |
Sam_63
Joined: 21 Oct 2011 Posts: 17
|
Stuck in Sleep mode, WDT time out not waking up |
Posted: Mon Feb 27, 2012 8:37 pm |
|
|
Any Idea's? Data sheet states the 31 kHz (LFINTOSC) clock keeps WDT alive during sleep but, it gets stuck in sleep as if the clock is shutting off at sleep(). I've used the "WDT__SW" fuse, that doesn't work either. I've read through many post here regarding this, all seem quite confusing. Like most others, I to want to save power during a rough wait period.
CCS Compiler Ver 4.129
Code: | #include <16LF1503.h>
#fuses INTRC_IO, NOWDT, NOPROTECT, NOBROWNOUT, NOPUT, NODEBUG
#use delay(clock=8000000)
#include <STDLIB.h>
void main(void)
{
output_high(PIN_C1);//red led on_test for global reset
delay_ms(1000);//on for 1 sec.
output_low(PIN_C1);//red led off
setup_oscillator(OSC_31KHZ);
#use delay(clock=31000)
while(1)
{
output_high(PIN_C2);//grn led on
delay_ms(2000);//on for 2 sec.
output_low(PIN_C2);//grn led off
setup_wdt(WDT_8S);
sleep();//sleep/led off for 8 sec. until timed out
delay_cycles(1);
}
}
|
|
|
|
Sam_63
Joined: 21 Oct 2011 Posts: 17
|
|
Posted: Mon Feb 27, 2012 9:15 pm |
|
|
I also have tried
Code: | #include <16LF1503.h>
#fuses INTRC_IO, NOWDT, NOPROTECT, NOBROWNOUT, NOPUT, NODEBUG
#use delay(clock=8000000)
#include <STDLIB.h>
void main(void)
{
output_high(PIN_C1);//red led on_test for global reset
delay_ms(1000);//on for 1 sec.
output_low(PIN_C1);//red led off
setup_oscillator(OSC_31KHZ);
#use delay(clock=31000)
while(1)
{
output_high(PIN_C2);//grn led on
delay_ms(2000);//on for 2 sec.
output_low(PIN_C2);//grn led off
setup_wdt(WDT_8S);
setup_wdt(WDT_ON);
sleep();//sleep/led off for 8 sec. until timed out
delay_cycles(1);
}
} |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Feb 27, 2012 10:39 pm |
|
|
In the first program that you posted, change the NOWDT fuse to this:
|
|
|
Sam_63
Joined: 21 Oct 2011 Posts: 17
|
|
Posted: Mon Feb 27, 2012 11:02 pm |
|
|
Thx PCM,
Yes, I tried WDT_SW in that first program. I indicated that I did in the title write up.
I'm quite perplexed on this on, it's so simple, but it refuses to wake up, there has to be a switch somewhere that I'm missing. The sequence of led's runs correctly, red-on, red-off to grn-on then sleep (current drop way down) bt hangs forever there. |
|
|
Sam_63
Joined: 21 Oct 2011 Posts: 17
|
|
Posted: Mon Feb 27, 2012 11:19 pm |
|
|
BTW *PIC16lf1503
* Indicates this part has not yet been tested at CCS
Ugh
Think I'm done guinea pigging with this one....... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19520
|
|
Posted: Tue Feb 28, 2012 7:50 am |
|
|
PCM_programmer has pointed to the core of the problem.
Look at section 9.2 in the data sheet.
Note how many of the modes have the watchdog disabled in sleep mode. Just setting SWDTEN, does not ensure the watchdog stays on. I'd just manually set the bits to 11, which should make it work.
Best Wishes |
|
|
|