brew
Member level 3
hi, i am trying to put PIC16F88 to sleep but it just won't sleep. i am using a ccx5 compiler by bknd. the controller should sleep when there's an external interrupt on RB0/INT.
#define light PORTA.0
interrupt intHandler(void) //ISR, functions that handle interrupts
{
TMR1ON = 0;
INTCON = 0x00;
GIE = 0;
PEIE = 0;
INT0IE = 0;
TMR1IE = 0;
TMR1IF = 0;
TRISA = 0x11;
TRISB = 0x11;
PR1 = 0x00;
sleep();
nop();
light = 0;
}
void main()
{
initPic(); //initializes PIC TRISA,PORTA,TRISB,PORTB,OSCCON, etc.
light = 1;
}
i tried to turn off all of the possible interrupts and clear their flag bits, but still my controller doesn't want to sleep? i need your help! thanks!
regards, brew.
#define light PORTA.0
interrupt intHandler(void) //ISR, functions that handle interrupts
{
TMR1ON = 0;
INTCON = 0x00;
GIE = 0;
PEIE = 0;
INT0IE = 0;
TMR1IE = 0;
TMR1IF = 0;
TRISA = 0x11;
TRISB = 0x11;
PR1 = 0x00;
sleep();
nop();
light = 0;
}
void main()
{
initPic(); //initializes PIC TRISA,PORTA,TRISB,PORTB,OSCCON, etc.
light = 1;
}
i tried to turn off all of the possible interrupts and clear their flag bits, but still my controller doesn't want to sleep? i need your help! thanks!
regards, brew.