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

Stuck in Sleep mode, WDT time out not waking up

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



Joined: 21 Oct 2011
Posts: 17

View user's profile Send private message

Stuck in Sleep mode, WDT time out not waking up
PostPosted: Mon Feb 27, 2012 8:37 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Feb 27, 2012 9:15 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Feb 27, 2012 10:39 pm     Reply with quote

In the first program that you posted, change the NOWDT fuse to this:
Code:

WDT_SW
Sam_63



Joined: 21 Oct 2011
Posts: 17

View user's profile Send private message

PostPosted: Mon Feb 27, 2012 11:02 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Feb 27, 2012 11:19 pm     Reply with quote

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: 19522

View user's profile Send private message

PostPosted: Tue Feb 28, 2012 7:50 am     Reply with quote

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. Smile

Best Wishes
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