Ok, so waking the CPU from sleep to resume execution seems a bit complex. And is it just me or does the PIC32 consume MORE power in sleep mode than using the LPRC (31 KHz) according to the datasheet? On Fri, Dec 5, 2008 at 4:45 PM, solarwind wrote: > On Fri, Dec 5, 2008 at 4:28 PM, Olin Lathrop wrote: >> solarwind wrote: >>> I've designed it to switch to a high clock frequency RIGHT BEFORE >>> computing a function (like sin, cos, tan, etc...). And right after it >>> finishes, the program switches to the low power oscillator (31 KHz). >> >> Why not always run at the fastest speed when there is something to do and >> then sleep when there isn't? In a calculator, everything is driven by >> keyboard events. Any keypress wakes up the processor, it figures out what >> needs to be done, does it, then goes back to sleep. >> >>> I'm curious about your 99.9% sleep method though. I'm not familiar >>> with the use of interrupts. Can you please explain this part of the >>> system a bit more? It seems very interesting. So would the processor >>> "sleep" as in fully turn off the clock while nothing is being done? >>> Would it wake up on key press? How is this possible? >> >> Read about sleep mode and how the processor wakes up from it. Basically any >> interrupt or anything that would be a interrupt if global interrupts were >> enabled can wake the processor. >> >> In the case of a a keyboard matrix it may be a bit more complicated. The >> hardware solution is to arrange a line to indicate that any key is pressed. >> Wake up on that and then do the de-multilplexing to figure out which keys >> are down. >> >> The sofware solution is to wake up periodically and scan the keys. The >> processor goes back to sleep quickly if no keyboard state changes are found. >> You could scan the keyboard every 10mS, for example. Even if that takes >> 100uS (that would be a lot), the processor is still sleeping 99% of the >> time. >> >> >> ******************************************************************** >> Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products >> (978) 742-9014. Gold level PIC consultants since 2000. >> -- >> http://www.piclist.com PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist >> > > Thanks. I'll look into sleep mode and how to wake the CPU. > > -- > ..::[ solarwind ]::.. > -- ..::[ solarwind ]::.. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist