Page 1 of 1
EB006 with PIC16F88 - won't wake up from sleep
Posted: Sun Apr 15, 2012 2:52 am
by Phaenix
Code: Select all
void go_sleep(void)
{
unsigned char oldTRISB, dummy;
portb = 0;
porta = 0;
oldTRISB = trisb;
trisb = 0xff;
clear_bit(intcon, GIE);
set_bit(intcon, RBIE);
dummy = portb;
clear_bit(intcon, RBIF);
sleep();
nop();
clear_bit(intcon, RBIF);
clear_bit(intcon, RBIE);
set_bit(intcon, GIE);
trisb = oldTRISB;
}
It'll sleep, but it won't wake up again. What am I doing wrong?
Re: EB006 with PIC16F88 - won't wake up from sleep
Posted: Sun Apr 15, 2012 3:23 pm
by Phaenix
Problem fixed as far as I can tell:
Code: Select all
void pic_lullaby(void)
{
portb = 0xFF;
clear_bit(intcon, GIE);
set_bit(intcon, RBIE);
clear_bit(intcon, RBIF);
sleep();
nop();
clear_bit(intcon, RBIF);
clear_bit(intcon, RBIE);
set_bit(intcon, GIE);
}
If anyone is able to verify that I'm still doing it right, that would be great.