GreenBeret
New Member
Hi All,
I am facing problem in waking up from sleep mode in PIC 16F72. I have connected main power voltage to RB7 pin. Whenever main power goes down, i am putting PIC to sleep mode. Just before putting to sleep mode, i am enabling the RBIE enabling bit to 1. And i have interrupt service routine code which checks for the status of RBIF. Whenever main power comes, there will be a voltage in RB7 and hence the port change should happen and my interrupt service routine should work.. But it seems like the interrupt service routine is not working.. What could be the reason... ?
Below is the code snipet.
/*
Interrupt routine.
*/
void interrupt
isr( void )
{
// Checking for whether timer1 interrupt.
if ( TMR1IF )
{
timerTick = 1; // Setting flag used by main function.
TMR1H |= 0b11000000; // Making Timer1 a 14bit counter.
TMR1IF = 0; //Clearing the interrupt flag.
}
if ( RBIF )
{
sleep = 0;
RBIF = 0;
RA0 = 1;
showNumber ( &count );
temp = PORTB;
RBIE = 0;
}
}
Below is the control register values i am setting in my program:
TMR1H |= 0b11000000; // Making Timer1 a 14bit counter.
T1CON = 0B001111;
OPTION = 0B10000000;
TMR1IE = 1;
GIE = 1; // enable global interrupts
PEIE = 1; // peripheral interrupt enabled.
Any help is greatly appreciated.
I am facing problem in waking up from sleep mode in PIC 16F72. I have connected main power voltage to RB7 pin. Whenever main power goes down, i am putting PIC to sleep mode. Just before putting to sleep mode, i am enabling the RBIE enabling bit to 1. And i have interrupt service routine code which checks for the status of RBIF. Whenever main power comes, there will be a voltage in RB7 and hence the port change should happen and my interrupt service routine should work.. But it seems like the interrupt service routine is not working.. What could be the reason... ?
Below is the code snipet.
/*
Interrupt routine.
*/
void interrupt
isr( void )
{
// Checking for whether timer1 interrupt.
if ( TMR1IF )
{
timerTick = 1; // Setting flag used by main function.
TMR1H |= 0b11000000; // Making Timer1 a 14bit counter.
TMR1IF = 0; //Clearing the interrupt flag.
}
if ( RBIF )
{
sleep = 0;
RBIF = 0;
RA0 = 1;
showNumber ( &count );
temp = PORTB;
RBIE = 0;
}
}
Below is the control register values i am setting in my program:
TMR1H |= 0b11000000; // Making Timer1 a 14bit counter.
T1CON = 0B001111;
OPTION = 0B10000000;
TMR1IE = 1;
GIE = 1; // enable global interrupts
PEIE = 1; // peripheral interrupt enabled.
Any help is greatly appreciated.