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 support@ccsinfo.com

deep sleep problems with PIC18F46J11

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



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Apr 08, 2011 2:54 pm     Reply with quote

Here's a test program for RTCC alarm wake-up from Deep Sleep.
I don't have your exact PIC, but I have the 18F24J11 which is in
the same family.

I have a 32.768 KHz watch crystal installed on the Timer1 oscillator pins
on the PIC. I didn't have the 12 pf capacitors recommended by the PIC
data sheet for use with that crystal, so I used 22 pf caps and it still worked.

Here's the output from the program shown below. The PIC wakes up
every 5 seconds, which is correct. I timed it with a stop-watch.
It's working. I tested this with compiler versions 4.100 and 4.119.
Quote:

Start-up by some other method.
Going to sleep.
Wake-up by RTCC alarm from Deep Sleep.
Going to sleep.
Wake-up by RTCC alarm from Deep Sleep.
Going to sleep.
Wake-up by RTCC alarm from Deep Sleep.
Going to sleep.


I didn't try to test the "Context save" feature for Deep Sleep mode.
(And I don't really want to work on it). I just wanted to show how to use
the RTCC alarm to wake-up from Deep Sleep. Here is the test program:
Code:

#include <18F24J11.h>           
#fuses HS,NOWDT,RTCOSC_T1  // RTCC uses Timer1 osc with 32.768 KHz xtal
#use delay(crystal=20M)    // PIC uses 20 MHz crystal
#use rs232(baud=9600, UART1, ERRORS)

#byte WDTCON = 0xFC0
#byte DSCONH = 0xF4D
#byte DSCONL = 0xF4C
#byte RTCCFG = 0xF3F
#byte DSWAKEH= 0xF4b
#byte DSWAKEL= 0xF4a
#byte OSCCON = 0xFD3

#bit IDLEN =OSCCON.7      // Used to set IDLE low-power mode
#bit DSEN = DSCONH.7      // Used to set deep sleep
#bit REGSLP =WDTCON.7
#bit RELEASE = DSCONL.0
#bit RTCSYNC = RTCCFG.4
#bit DS_WAKEUP_BIT = WDTCON.3   // Bit that detects wake up from DS
#bit DSRTC = DSWAKEL.3


//==============================================
void main(void)
{
rtc_time_t SetTime;
rtc_time_t AlarmTime;
rtc_time_t read_clock;

// Release the PIC's i/o pins for normal operation
// after waking up from Deep Sleep.  Important !
RELEASE = 0;   

// Tell what caused us to start-up.
if((DS_WAKEUP_BIT == 1) && (DSRTC == 1))
   printf("\n\rWake-up by RTCC alarm from Deep Sleep.\n\r");
else
   printf("\n\rStart-up by some other method.\n\r");


setup_rtc(RTC_ENABLE,0);

// Set initial RTC date/time values in structure.
SetTime.tm_year = 0x11;
SetTime.tm_mon  = 3;
SetTime.tm_mday = 9;
SetTime.tm_wday = 3;
SetTime.tm_hour = 0x11;
SetTime.tm_min  = 0x47;
SetTime.tm_sec  = 0;

// Write that structure into the RTC hardware registers
// inside the 18F26J11.
rtc_write(&SetTime); 


// Set RTC alarm date/time.
AlarmTime.tm_year = 0x11;
AlarmTime.tm_mon  = 3;
AlarmTime.tm_mday = 9;
AlarmTime.tm_wday = 3;
AlarmTime.tm_hour = 0x11;
AlarmTime.tm_min  = 0x47;
AlarmTime.tm_sec  = 5;

/*
   while(1)
   {
      rtc_read(&read_clock);        //reads clock value from RTCC
      printf("\n\r%02u/%02u/20%02u %02u:%02u:%02u",read_clock.tm_mon,read_clock.tm_mday,read_clock.tm_year,read_clock.tm_hour,read_clock.tm_min,read_clock.tm_sec);
      delay_ms(1000);
   }
*/

rtc_alarm_write(&AlarmTime);

setup_rtc_alarm(RTC_ALARM_ENABLE, RTC_ALARM_10_SECONDS, 0xFF);
     
printf("Going to sleep.\n\r");

// Enable Deep Sleep mode.
REGSLP = 1;    // enable low-power operation in sleep mode
IDLEN = 0;
while(RTCSYNC);
#asm       // Time-critical section must be in ASM 
BSF DSEN
SLEEP
#endasm

// We should never reach the following line after a
// Deep Sleep RTCC wake-up, because it does a reset
// intentionally. It re-starts code execution at main().
printf("Woke-up from sleep ! \r\n");

while(1);
}


----
Edit:
Removed the line for 'enable_interrupts(INT_RTCC);' that was placed
after the printf for "going to sleep". It's not necessary.


Last edited by PCM programmer on Sun Apr 10, 2011 2:39 pm; edited 1 time in total
magic_mauve



Joined: 05 Apr 2011
Posts: 12

View user's profile Send private message

PostPosted: Sun Apr 10, 2011 2:30 pm     Reply with quote

Thank you PCM programmer! I am delighted to say thanks to you I have got it working now. Much appreciated. Very Happy
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Apr 10, 2011 2:40 pm     Reply with quote

After you posted, I reviewed the code and noticed that I had left in a line
from your program, where you enabled INT_RTCC interrupts. That's not
needed for my demo program so I edited the code and removed it.
I tested it just now, and the program runs fine without it.
magic_mauve



Joined: 05 Apr 2011
Posts: 12

View user's profile Send private message

PostPosted: Sun Apr 10, 2011 2:57 pm     Reply with quote

Great. Thanks again.
heUAcyp



Joined: 16 Mar 2011
Posts: 33

View user's profile Send private message

RTCC issue
PostPosted: Thu Jun 09, 2011 9:10 am     Reply with quote

Hi all,

Since it has been discussed here, I have a question on RTCC.

I set hour = 23 , min= 59 and sec=50 , just to make sure that it will automatically increment the day after 23:59:59. But apparently PIC re-starts counting from 20:00:00 and doesn't increment the day, I am posting the output on the hyperterminal:

Quote:
03/09/2011 23:59:50
03/09/2011 23:59:52
03/09/2011 23:59:53
03/09/2011 23:59:54
03/09/2011 23:59:55
03/09/2011 23:59:56
03/09/2011 23:59:57
03/09/2011 23:59:58
03/09/2011 23:59:59
03/09/2011 20:00:00
03/09/2011 20:00:01
03/09/2011 20:00:02
03/09/2011 20:00:03


and the code I used:

Code:
#include <18F25J11.h>
#device ADC=10
#include <STDIO.H>
#include <stdlib.h>
#include <math.h>
#include <STRING.H>
#include <2408.c>

#fuses HS,NOWDT,NOPROTECT,RTCOSC_T1 
#use delay(clock=4000000)
#use rs232 (baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)


#byte WDTCON = 0xFC0
#byte DSCONH = 0xF4D
#byte DSCONL = 0xF4C
#byte RTCCFG = 0xF3F
#byte DSWAKEH= 0xF4b
#byte DSWAKEL= 0xF4a
#byte OSCCON = 0xFD3
#byte INTCON = 0xFF2
#byte INTCON2 = 0xFF1
//
#bit IDLEN=OSCCON.7      // used to set IDLE low-power mode ( will be set to zero for both deep-sleep and sleep modes)
#bit DSEN = DSCONH.7     // used to set deep sleep (1 for deep-sleep)
#bit REGSLP =WDTCON.7
#bit RELEASE = DSCONL.0
#bit RTCSYNC = RTCCFG.4
#bit DSINT0 = DSWAKEH.0 // bit for INT0 interrupt - change detection
#bit DS_WAKEUP_BIT = WDTCON.3     // bit that detects wake up from deep sleep
#bit INT0IE = INTCON.4
#bit INT0IF = INTCON.1
#bit INTEDG0 = INTCON2.6

int8 i ;

void EnterDeepSleep()
{
// Enable Deep Sleep mode.
REGSLP = 1;    // enable low-power operation in sleep mode
IDLEN = 0;
while(RTCSYNC);
#asm         // Time-critical section must be in ASM 
BSF DSEN
SLEEP
NOP
#endasm
}

void main()
{
//disable_interrupts(GLOBAL);
rtc_time_t SetTime;
rtc_time_t read_clock;

setup_rtc(RTC_ENABLE,0);

// Set initial RTC date/time values in structure.
SetTime.tm_year = 11;
SetTime.tm_mon  = 3;
SetTime.tm_mday = 9;
SetTime.tm_wday = 3;
SetTime.tm_hour = 23;
SetTime.tm_min  = 59;
SetTime.tm_sec  = 49;

// Write that structure into the RTC hardware registers
// inside the 18F26J11.
rtc_write(&SetTime); 


while(1)
   {
      rtc_read(&read_clock);        //reads clock value from RTCC
      printf("\n\r%02u/%02u/20%02u %02u:%02u:%02u",read_clock.tm_mon,read_clock.tm_mday,read_clock.tm_year,read_clock.tm_hour,read_clock.tm_min,read_clock.tm_sec);
      delay_ms(1000);
   }


RELEASE = 0;   // Activate i/o pins
delay_ms(10);


printf("\n\r\n\r");
printf("DS_WAKEUP_BIT:  %x \n\r", DS_WAKEUP_BIT);
delay_ms(10);
printf("DS_WAKEUP_BIT:  %x \n\r", DSINT0);
delay_ms(10);
printf("DSWAKEH:  %x \n\r", DSWAKEH);
delay_ms(10);
printf("DSWAKEL:  %x \n\r", DSWAKEL);
delay_ms(10);

// Clear the wake-up source registers, regardless
// of what the PIC data sheet says.
DSWAKEL = 0;
DSWAKEH = 0;

// Look at the current state of the push-button switch.
// Based on that, set the edge that we expect to see next.
if(input(PIN_B0) == 1)   // If switch is high
ext_int_edge(H_TO_L); // Then expect a falling edge next
else                     // If switch is low
ext_int_edge(L_TO_H); // Then expect a rising edge next

clear_interrupt(INT_EXT);
enable_interrupts(INT_EXT);
delay_ms(10);

EnterDeepSleep() ;

printf("Should never get here\n\r");

while(true)
{


}

}


how this can be fixed? I have tried with different PIC's and same problem exists.
My compiler version is V4.095, I have tested with V4.085 and its not working.

Regards
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 09, 2011 11:56 am     Reply with quote

It works OK with vs. 4.121:
Quote:

03/09/2011 23:59:49
03/09/2011 23:59:49
03/09/2011 23:59:50
03/09/2011 23:59:51
03/09/2011 23:59:52
03/09/2011 23:59:53
03/09/2011 23:59:54
03/09/2011 23:59:55
03/09/2011 23:59:56
03/09/2011 23:59:57
03/09/2011 23:59:58
03/09/2011 23:59:59
03/10/2011 00:00:00
03/10/2011 00:00:01
03/10/2011 00:00:02


There's a bug in your compiler version, 4.095. I don't have time to look it
at it right now.
heUAcyp



Joined: 16 Mar 2011
Posts: 33

View user's profile Send private message

PostPosted: Thu Jun 09, 2011 12:37 pm     Reply with quote

Thanks sir , easiest solution would be to get V 4.121

Regards
heUAcyp



Joined: 16 Mar 2011
Posts: 33

View user's profile Send private message

Still not working
PostPosted: Fri Jun 17, 2011 10:49 am     Reply with quote

Sir, I have tried many times but RTCC is NOT incrementing while in deep sleep mode:

I am constantly checking registers, and I have fixed all the problems associated with that. RTCC is just not incrementing

With code given below. Initial output on hyperterminal is :

Quote:
check hyperterminal
before the if loop DS_WAKEUP_BIT: 00
before the if loop DSWAKEH: 00
before the if loop DSWAKEL: 00
after the if loop DSWAKEH: 00
after the if loop DSWAKEL: 00
check if the registers are set DSWAKEH: 00
check if the registers set DSWAKEL: 00


When I close the switch(PIN B0 == 0 )

Quote:
before the if loop DS_WAKEUP_BIT: 01
before the if loop DSWAKEH: 01
before the if loop DSWAKEL: 00
DS_WAKEUP_BIT: 01
Interrupt detected
DSWAKEH: 01
DSWAKEL: 00
Patch is on - DATE:9: 3: 11
TIME:12: 59: 49
sleeping now
DS_WAKEUP_BIT: 01
after the if loop DSWAKEH: 01
after the if loop DSWAKEL: 00
check if the registers are set DSWAKEH: 00
check if the registers set DSWAKEL: 00



Quote:
before the if loop DS_WAKEUP_BIT: 01
before the if loop DSWAKEH: 01
before the if loop DSWAKEL: 00
DS_WAKEUP_BIT: 01
Interrupt detected
DSWAKEH: 01
DSWAKEL: 00
Patch is off -- DATE:9. 3. 11
TIME:12: 59: 49
sleeping now
DS_WAKEUP_BIT: 01
after the if loop DSWAKEH: 01
after the if loop DSWAKEL: 00
check if the registers are set DSWAKEH: 00
check if the registers set DSWAKEL: 00


The code I am using:

Code:
#include <18F25J11.h>
#device ADC=10
#include <STDIO.H>
#include <stdlib.h>
#include <math.h>
#include <STRING.H>
#include <2408.c>

#fuses HS,NOWDT,NOPROTECT, RTCOSC_T1
#use delay(clock=4000000)
#use rs232 (baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)



#byte WDTCON = 0xFC0
#byte DSCONH = 0xF4D
#byte DSCONL = 0xF4C
#byte RTCCFG = 0xF3F
#byte DSWAKEH= 0xF4b
#byte DSWAKEL= 0xF4a
#byte OSCCON = 0xFD3
#byte INTCON = 0xFF2
#byte INTCON2 = 0xFF1
//
#bit IDLEN=OSCCON.7      // used to set IDLE low-power mode ( will be set to zero for both deep-sleep and sleep modes)
#bit DSEN = DSCONH.7     // used to set deep sleep (1 for deep-sleep)
#bit REGSLP =WDTCON.7
#bit RELEASE = DSCONL.0
#bit RTCSYNC = RTCCFG.4
#bit DSINT0 = DSWAKEH.0 // bit for INT0 interrupt - change detection
#bit DS_WAKEUP_BIT = WDTCON.3     // bit that detects wake up from deep sleep
#bit INT0IE = INTCON.4
#bit INT0IF = INTCON.1
#bit INTEDG0 = INTCON2.6

char buffer[160];
rtc_time_t SetTime;
int8 status ;


void InitTime()
{
/* !!!!! I cannot define it here as
it gives error in dateandtimeon() function)*/   
//rtc_time_t SetTime;

setup_rtc(RTC_ENABLE,0);

//set_rtcc(RTCC_INTERNAL);

// Set initial RTC date/time values in structure.
SetTime.tm_year = 11;
SetTime.tm_mon  = 3;
SetTime.tm_mday = 9;
SetTime.tm_wday = 3;
SetTime.tm_hour = 12;
SetTime.tm_min  = 59;
SetTime.tm_sec  = 49;
}

void EnterDeepSleep()
{
// Enable Deep Sleep mode.
REGSLP = 1;    // enable low-power operation in sleep mode
IDLEN = 0;

while(RTCSYNC);

#asm         // Time-critical section must be in ASM 
BSF DSEN
SLEEP
NOP
#endasm
}

void dateandtimeon()
{
rtc_read(&SetTime);
buffer="";
sprintf(buffer, "Patch is on - DATE:%d: %d: %d", SetTime.tm_mday, SetTime.tm_mon,SetTime.tm_year); printf("%s\n\r",buffer);
buffer="";
sprintf(buffer, "TIME:%d: %d: %d ",  SetTime.tm_hour, SetTime.tm_min, SetTime.tm_sec); printf("%s\n\r",buffer);

}

void dateandtimeoff()
{
rtc_read(&SetTime);
buffer="";
sprintf(buffer, "Patch is off -- DATE:%d. %d. %d", SetTime.tm_mday, SetTime.tm_mon,SetTime.tm_year); printf("%s\n\r",buffer);
buffer="";
sprintf(buffer, "TIME:%d: %d: %d ",  SetTime.tm_hour,SetTime.tm_min, SetTime.tm_sec); printf("%s\n\r",buffer);

}


void storetoMemory() {


if(status == 1)   // If switch is high
dateandtimeoff(); // Then expect a falling edge next
else                    // If switch is low
dateandtimeon();


delay_ms(10);
printf("sleeping now \n\r ") ;
delay_ms(10);


}
void main()
{
output_high(PIN_A2) ;

InitTime() ;

rtc_write(&SetTime);

printf("check hyperterminal \n\r ") ;

RELEASE = 0;   // Activate i/o pins
delay_ms(10);

 
printf("before the if loop DS_WAKEUP_BIT:  %x \n\r", DSINT0);
delay_ms(10);
printf("before the if loop DSWAKEH:  %x \n\r", DSWAKEH);
delay_ms(10);
printf("before the if loop DSWAKEL:  %x \n\r", DSWAKEL);
delay_ms(10);

/*if loop to perform main task*/
 
if((DS_WAKEUP_BIT == 1) && (DSWAKEH == 1))
{
delay_ms(10);
printf("DS_WAKEUP_BIT:  %x \n\r", DS_WAKEUP_BIT);
delay_ms(10);
printf("Interrupt detected \n\r");
delay_ms(10);
printf("DSWAKEH:  %x \n\r", DSWAKEH);
delay_ms(10);
printf("DSWAKEL:  %x \n\r", DSWAKEL);
delay_ms(10);

storetoMemory() ;
delay_ms(200);
printf("DS_WAKEUP_BIT:  %x \n\r", DS_WAKEUP_BIT);
delay_ms(10);

clear_interrupt(INT_EXT);
enable_interrupts(INT_EXT);
}


printf("after the if loop DSWAKEH:  %x \n\r", DSWAKEH);
delay_ms(10);
printf("after the if loop DSWAKEL:  %x \n\r", DSWAKEL);
delay_ms(10);


DSWAKEL = 0;
DSWAKEH = 0;


printf("check if the registers are set DSWAKEH:  %x \n\r", DSWAKEH);
delay_ms(10);
printf("check if the registers set DSWAKEL:  %x \n\r", DSWAKEL);
delay_ms(10);


if(input(PIN_B0) == 1)
{  // If switch is high
ext_int_edge(H_TO_L); // Then expect a falling edge next
status = 0 ;
}
else                    // If switch is low
{
ext_int_edge(L_TO_H); // Then expect a rising edge next
status = 1 ;
}

clear_interrupt(INT_EXT);
enable_interrupts(INT_EXT);
delay_ms(10);
enable_interrupts(INT_RTCC);

EnterDeepSleep() ;

printf("Should never get here\n\r");

while(true)
{

}

}


Compiler version is still V4.095 but I have ordered the V4.121 .

As you see in the lines:

Quote:
Patch is on - DATE:9: 3: 11
TIME:12: 59: 49


and

Quote:
Patch is off -- DATE:9. 3. 11
TIME:12: 59: 49


RTCC is not working.

Please help.

Regards
heUAcyp



Joined: 16 Mar 2011
Posts: 33

View user's profile Send private message

PostPosted: Fri Jun 17, 2011 1:45 pm     Reply with quote

Here is the simplified code,

Basically problem is the RTCC does not increment. Initially set values keeps repeating.

Code:
#include <18F25J11.h>
#device ADC=10
#include <STDIO.H>
#include <stdlib.h>
#include <math.h>
#include <STRING.H>
#include <2408.c>

#fuses HS,NOWDT,NOPROTECT, RTCOSC_T1
#use delay(clock=4000000)
#use rs232 (baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)



#byte WDTCON = 0xFC0
#byte DSCONH = 0xF4D
#byte DSCONL = 0xF4C
#byte RTCCFG = 0xF3F
#byte DSWAKEH= 0xF4b
#byte DSWAKEL= 0xF4a
#byte OSCCON = 0xFD3
#byte INTCON = 0xFF2
#byte INTCON2 = 0xFF1
//
#bit IDLEN=OSCCON.7      // used to set IDLE low-power mode ( will be set to zero for both deep-sleep and sleep modes)
#bit DSEN = DSCONH.7     // used to set deep sleep (1 for deep-sleep)
#bit REGSLP =WDTCON.7
#bit RELEASE = DSCONL.0
#bit RTCSYNC = RTCCFG.4
#bit DSINT0 = DSWAKEH.0 // bit for INT0 interrupt - change detection
#bit DS_WAKEUP_BIT = WDTCON.3     // bit that detects wake up from deep sleep
#bit INT0IE = INTCON.4
#bit INT0IF = INTCON.1
#bit INTEDG0 = INTCON2.6

char buffer[160];
rtc_time_t SetTime;
int8 status ;

void InitTime()
{

setup_rtc(RTC_ENABLE,0);
SetTime.tm_year = 11;
SetTime.tm_mon  = 3;
SetTime.tm_mday = 9;
SetTime.tm_wday = 3;
SetTime.tm_hour = 12;
SetTime.tm_min  = 59;
SetTime.tm_sec  = 49;
}

void EnterDeepSleep()
{
// Enable Deep Sleep mode.
REGSLP = 1;    // enable low-power operation in sleep mode
IDLEN = 0;

while(RTCSYNC);

#asm         // Time-critical section must be in ASM 
BSF DSEN
SLEEP
NOP
#endasm
}

void dateandtimeon()
{
rtc_read(&SetTime);
buffer="";
sprintf(buffer, "ON_TIME:%d: %d: %d ",  SetTime.tm_hour, SetTime.tm_min, SetTime.tm_sec); printf("%s\n\r",buffer);

}

void dateandtimeoff()
{
rtc_read(&SetTime);
buffer="";
sprintf(buffer, "OFF_TIME:%d: %d: %d ",  SetTime.tm_hour,SetTime.tm_min, SetTime.tm_sec); printf("%s\n\r",buffer);

}

void main()
{

InitTime() ;

rtc_write(&SetTime);


RELEASE = 0;   // Activate i/o pins
delay_ms(10);

 
printf("DS_WAKEUP_BIT:  %x \n\r", DSINT0);
delay_ms(10);
printf("DSWAKEH:  %x \n\r", DSWAKEH);
delay_ms(10);
printf("DSWAKEL:  %x \n\r", DSWAKEL);
delay_ms(10);

/*if loop to perform main task*/
 
if((DS_WAKEUP_BIT == 1) && (DSWAKEH == 1))
{
if(status == 1)   // If switch is high
dateandtimeoff(); // Then expect a falling edge next
else                    // If switch is low
dateandtimeon();

}


DSWAKEL = 0;
DSWAKEH = 0;

if(input(PIN_B0) == 1)
{  // If switch is high
ext_int_edge(H_TO_L); // Then expect a falling edge next
status = 0 ;
}
else                    // If switch is low
{
ext_int_edge(L_TO_H); // Then expect a rising edge next
status = 1 ;
}

clear_interrupt(INT_EXT);
enable_interrupts(INT_EXT);
delay_ms(10);
enable_interrupts(INT_RTCC);

EnterDeepSleep() ;

printf("Should never get here\n\r");

while(true)
{

}

}


And the output on hyperterminal when using switch at pin 21 (INT0) :

Quote:
DS_WAKEUP_BIT: 01
DSWAKEH: 01
DSWAKEL: 00
ON_TIME:12: 59: 49
DS_WAKEUP_BIT: 01
DSWAKEH: 01
DSWAKEL: 00
OFF_TIME:12: 59: 49
dap20



Joined: 11 Aug 2011
Posts: 5

View user's profile Send private message

PostPosted: Fri Jan 27, 2012 4:42 pm     Reply with quote

PCM programmer wrote:

while(RTCSYNC);
#asm // Time-critical section must be in ASM
BSF DSEN
SLEEP
#endasm

// We should never reach the following line after a
// Deep Sleep RTCC wake-up, because it does a reset
// intentionally. It re-starts code execution at main().


You say you make it re-start code execution at main intentionally. How can I make it continue just after the sleep instruction and not go back to the main ?

thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 30, 2012 9:00 pm     Reply with quote

Read the 18F46J11 data sheet:
Quote:

3.6.3 DEEP SLEEP WAKE-UP SOURCES
While in Deep Sleep mode, the device can be awakened
by a MCLR, POR, RTCC, INT0 I/O pin interrupt,
DSWDT or ULPWU event. After waking, the device performs
a POR
. When the device is released from Reset,
code execution will begin at the device’s Reset vector.

There is no option to resume running at the line in the program
after the Deep Sleep. It always does a Power-on-Reset.
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