chipKIT® Development Platform

Inspired by Arduino™

Sleep mode

Created Wed, 21 Mar 2012 16:51:01 +0000 by jpehs


jpehs

Wed, 21 Mar 2012 16:51:01 +0000

Hi,

I'm trying to use this example code [url]http://arduino.cc/playground/Learning/ArduinoSleepCode?action=sourceblock&num=1[/url] on my chipKit UNO32 to put it to sleep, but it gives me an error, because the compiler doesn't find the sleep.h library.

I want to put it in sleep mode for a certain time and awake when the timer expires or awakes when receives an input.

Anyone know how to do this? Or how to use arduino's sleep.h library?

Thanks

P.S. Sorry for my english


Ryan K

Wed, 21 Mar 2012 19:01:23 +0000

Hello,

I do not believe that sleep.h was ported over to the chipkit line. But the PIC32 does have a sleep functionality in the microcontroller which you can use.

using OSCCONSET = (1 << 4); will enable sleep mode when a wait instruction or asm("wait"); is executed. More details can be found in the document posted below on page 522 of the document below in 23.5 SLEEP Mode

http://ww1.microchip.com/downloads/en/devicedoc/pic32mx_datasheet_v2_61143b.pdf

Best Regards, Ryan K


jpehs

Thu, 22 Mar 2012 14:32:13 +0000

Thanks Ryan ;)

I'm going to try that