View previous topic :: View next topic |
Author |
Message |
andrewg
Joined: 17 Aug 2005 Posts: 316 Location: Perth, Western Australia
|
ADC in sleep locking up |
Posted: Mon Nov 23, 2009 12:46 am |
|
|
I've already solved this, but thought I'd write about it in case it affected anyone else.
I implemented an ADC conversion during sleep, but the device (12F675) never woke up. Same thing with a 16F877A. It seemed the analog interrupt was not going off.
After several hours, I finally figured out the problem was that the Peripheral Interrupt Enable (PEIE) was not set. In fact, it wasn't being set anywhere.
It's probably a bug in the compiler (v4.095). I would have expected the peripheral interrupts to be enabled as a matter of course, or at least as part of enabling interrupts for a peripheral. In any case, once I manually enabled the PEIE myself, the analog conversion worked perfectly. _________________ Andrew |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
andrewg
Joined: 17 Aug 2005 Posts: 316 Location: Perth, Western Australia
|
|
Posted: Mon Nov 23, 2009 3:16 am |
|
|
Thanks. I like your idea of a new #define for enable/disable_interrupts(). _________________ Andrew |
|
|
|