Apologies, there is an error in the email below; the voltage regulator bein= g used is a LM2936Z-5.0 rather than an LM293. ----- Original Message -----=20 From: Richard Phillips=20 To: Microcontroller discussion list - Public.=20 Sent: Friday, December 09, 2011 10:08 AM Subject: [PIC] PIC16F690 not going to sleep/high current consumption Hi, I am using a PIC16F690 with the Microchip Low Pin Count Demo board and a = PICKit 2 for programming. I am using HF/LFINTOSC rather than an external c= lock xtal. =20 I am using MPLab v8.80 with Hi-Tech C Compiler for PIC10/12/16 (Lite) v9.= 83 for coding, compiling and programming the MCU via the PICKit 2. When no= t being powered directly by the PICKit 2, the circuit is being powered by a= 9V battery via a LM293 voltage regulator, giving Vdd at 5V. The PICKit 2 = is disconnected when the circuit is being powered by the battery. I have been using the PIC running on HFINTOSC at 8MHz to execute tasks su= ccessfully up until now. However, to finish off my job, I need to reduce t= he current consumption when the PIC is not actually working, to save on bat= tery life. Running off the 9V battery and regulator, the current consumption for the= circuit varies from 2.15mA with HFINTOSC at Fosc=3D8Mhz, to 0.75mA with LF= INTOSC at Fosc=3D31Khz. This is with no LEDs lit on the demo board. Obvio= usly this is considerably higher than the datasheet stated Idd for the PIC = itself (Idd at 31uA-65uA for 5V/LFINTOSC 31Khz, 1.3mA-1.65mA for 5V/HFINTOS= C 8Mhz). In another product, we have a PIC16F876 being used with the LM293= and an external xtal at 8Mhz - this draws around 50uA-60uA during sleep, w= hich is significantly better! I have attempted to issue the Sleep command, however it seems like the PI= C is not sleeping - e.g. it is executing commands directly after the Sleep = command (e.g. turn on an output port driving an LED). Additionally, after = going into sleep it is being woken up by a TMR1 counting interrupt which is= being driven by INTOSC.. I'm guessing, but haven't been able to confirm an= ywhere in writing, that LFINTOSC and HFINTOSC should be disabled when the P= IC goes to sleep? I have a few issues/questions that I haven't been able to answer via data= sheets/other resources, and was hoping that someone might be able to put me= in the right direction! 1) Any ideas why the PIC does not appear to be going to sleep when comman= ded? The only interrupt that should be waking the PIC up is on TMR1.. othe= r interrupts such as IOC should be disabled otherwise. 2) Aside from current consumption drop, is there any way of definitively = knowing if the PIC is correctly sleeping? 3) When the PIC is sleeping, should HFINTOSC and LFINTOSC be disabled? M= eaning that the only way I could wake up the PIC would be to use e.g. inter= rupt on change rather than TMR1 count. 4) Any thoughts on why the current consumption, even when running at Fosc= =3D31KHz on LFINTOSC, would be so much higher than the datasheet current? Apologies if i have missed out any critical information, I am fairly new = to microcontroller programming and would appreciate any data which might he= lp me along. Richard --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .