I'm trying to wake my PIC16F690 via a button push. I've gotten the button routine to work with sleeping the PIC, I'm just not quite sure how to go about waking it up. Would using timer1 be the best route? Can anyone show me some sample code to get me started? Here's a snippet of my button code:
Code: Select all
while(1) // Loop forever
{
//Button interrupt code
if(Button(&PORTC, 5, 1, 1)) // introduce debounce, RC5 100ms active high
{
btnpsh = 1; //Button is pressed down
}
if(btnpsh && Button(&PORTC, 5, 1, 0)) // If button was pressed and is now unpressed
{
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
asm SLEEP;
}
//End button interrupt code
Mike