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

Auto-wake-up from sleep

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



Joined: 17 Feb 2015
Posts: 134

View user's profile Send private message

Auto-wake-up from sleep
PostPosted: Sun Sep 23, 2018 10:41 am     Reply with quote

Hi, I read the manual from 18LF26K22 and this pic has "auto wake up" how I do in CCS?
Code:

void main()   {

   while(TRUE)
   {
   printf(" To slepp....);
   printf("\n\n");
   delay_ms(1000);       
   sleep();                  // make processor sleep
     
   }

}
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Sep 23, 2018 10:58 am     Reply with quote

it'll wake up if an interrupt occours, wdt times out or a 'reset' happens. These are programmable events... YOU have to code for them. How and what 'wakes up' the PIC is up to you....

Jay
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Sep 23, 2018 11:00 am     Reply with quote

Is this what you want to do ?
Quote:
16.4.3 AUTO-WAKE-UP ON BREAK
During Sleep mode, all clocks to the EUSART are
suspended. Because of this, the Baud Rate Generator
is inactive and a proper character reception cannot be
performed. The Auto-Wake-up feature allows the
controller to wake-up due to activity on the RXx/DTx
line. This feature is available only in Asynchronous
mode.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Sun Sep 23, 2018 11:31 am     Reply with quote

Hopefully you understand that this requires a serial break character to wake the chip?. It's not a generic wake up. Hence PCM_Programmers question.

setup_uart(UART_WAKEUP_ON_RDA);

enables this feature.
cvargcal



Joined: 17 Feb 2015
Posts: 134

View user's profile Send private message

PostPosted: Sun Sep 23, 2018 1:24 pm     Reply with quote

Ttelmah wrote:
Hopefully you understand that this requires a serial break .......


Thanks...

mmm I saw one device with the micro STM32.. the device is only the micro and chip radio Lora... this device wakeup every X time and send a data short.
Really has not many circuit and not has other IC.... maybe the micro has a task RTC for counter the time while sleep and not consume many energy?
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Sun Sep 23, 2018 1:53 pm     Reply with quote

Your chip doesn't have an RTC. It does though have the watchdog. This can be set to give a timeout in binary multiples from 4.1mSec to 131seconds, and can wake from sleep. Select the fuse WDT_SW, which allows it to be controlled in software, and you can then enable this before sleep. Depending on your supply voltage, this adds a couple of uA to the sleep current.
cvargcal



Joined: 17 Feb 2015
Posts: 134

View user's profile Send private message

PostPosted: Sun Sep 23, 2018 2:01 pm     Reply with quote

Ttelmah wrote:
Your chip doesn't have an RTC....

Thanks I will check the WDT_SW....
Here is one code example with timer1...
http://www.ccsinfo.com/forum/viewtopic.php?t=54935
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon Sep 24, 2018 12:49 am     Reply with quote

Yes, you can use Timer1, but this requires you to add a 32768Hz crystal for this. It is down to what accuracy you need for the time, and what hardware you are prepared to add.
Understand that the chip draws significantly more when any of the oscillators are run while asleep. The WDT requires the LFINTOSC. Timer1 requires the secondary oscillator. The secondary oscillator can draw up to 10uA (worst case), and the LFINTOSC 5uA worst case. In many cases it draws much less power to use an external clock chip. So (for instance), add a MCP79410 or similar RTC, and you have time being maintained for you at all times, at a cost of just 1.2uA consumption (some other types even lower). You can program this to give a trigger pulse every second, or every minute, and wake when this triggers. With 1/min, this allows you to stay asleep much more of the time. Hence even lower overall power usage.
cvargcal



Joined: 17 Feb 2015
Posts: 134

View user's profile Send private message

PostPosted: Mon Sep 24, 2018 8:36 pm     Reply with quote

Ttelmah wrote:
Yes, you can use Timer1, but this requires you to add a 32768Hz crystal for this. It is down to what accuracy you need for the time, and what hardware you are prepared to add.
Understand that the chip draws significantly more when any of the oscillators are run while asleep. The WDT requires the LFINTOSC. Timer1 requires the secondary oscillator. The secondary oscillator can draw up to 10uA (worst case), and the LFINTOSC 5uA worst case. In many cases it draws much less power to use an external clock chip. So (for instance), add a MCP79410 or similar RTC, and you have time being maintained for you at all times, at a cost of just 1.2uA consumption (some other types even lower). You can program this to give a trigger pulse every second, or every minute, and wake when this triggers. With 1/min, this allows you to stay asleep much more of the time. Hence even lower overall power usage.



Thanks you.. so the better way is one RTC ... these one pic with this function? or the best case is one ic external?
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon Sep 24, 2018 11:50 pm     Reply with quote

The PIC's are not as efficient as RTC's, as chips designed to do this. The dedicated chips use internal structures that are designed for low power.

It is all down to parameters you are not telling us.
How accurate does your sleep time need to be?.
How low do you need the power consumption to be?.
How frequently do you need to wake up?.
How accurately does the system need to actually keep 'time'?.
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