Sorry, I missed the GPIO setting.
Sorry, I missed the GPIO setting.
Dave
Always wear safety glasses while programming.
Hi,
Three things ...
1) you use the IOC interrupt ... so that rings the " Mismatch condition " bell in my head ... see Sleep datasheet chapter.
2) Microchip recommends to place a NOP instruction just past the Sleep one, when using the feature this way.
3) when you push a button ... you obviously release it one day ! makes two input changes ...
Alain
Last edited by Acetronics2; - 27th November 2011 at 09:57.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
try to add2) Microchip recommends to place a NOP instruction just past the Sleep one, when using the feature this way
@ sleep
@ nop
If the GIE
bit is clear (disabled), the device continues execution at
the instruction after the
SLEEP instruction. If the GIE bit
is set (enabled), the device executes the instruction
after the
SLEEP instruction, then branches to the interrupt
address (0004h). In cases where the execution of
the instruction following
SLEEP is not desirable, the
user should have a
NOP after the SLEEP instruction.
Hi All, and thanks for your answers!!!
No problem Dave!!!
Alain; I read the datasheet but couldn't get anywhere, believe me, I tried.
bogdan, tried also that, but its not the solution for my problem.
Ok, the only conclusion that i came up, is this:
If i disable the WPU on the button pin, put a pull-down resistor in this pin and connecting the VCC to the button, i don't get the issue. I only get the issue, if i take of the pull down resistor, enable the WPU and connect the GND to the button.
So the conclusion that i came up, not knowing it it is the correct one, is that, on power up the GPIO state is LOW. So because i have the WPU enable on this pin, i think a interrupt is triggered, because i have a mistmach condition on this pin. If i disable the WPU, put a pull-down resistor in this pin and connecting the VCC to the button, i don't have the mistmatch condition, so the PIC goes to sleep.
If this conclusion is not the correct one, i don't know, why the micro is not going to sleep on power up!!!
Thanks and Regards;
Gadelhas
Bookmarks