I am using WDT to wake up pic16lf1619 from sleep mode. I have all the unused pins configure as output and connected them with a 10 kohm to the ground. What is happening is that when in sleep, current is about 5mA. I read the data sheet seems to do what is needed, can someone please work me through to solve this?
If by any chance any examples to follow or any article to read to better understand this power consumption issue.
Below is the code that I am using
void main() {
// then, setup OPTION as a first thing to do after each reset
// OPTION_REG = 0b10001111;
OSCCON = 0b00000000 ; // Set the INTOSC= 31KHZ
FVRCON = 0x00;
// ANSELA = 0x00;
CM1CON0 = 0x00;
CM2CON1 = 0x00;
// WDTCON0 = 0b00011000; // Set the WDT time out to 4 second
WDTCON0bits.WDTPS1 = 1;
TRISA = 0x00;
TRISB = 0x00;
TRISC = 0x00;
ODCONA = 1;
// ODCONB = 1;
// ODCONC = 1;
//
// WPUA = 0x00;
// WPUB = 0x00;
// WPUC = 0x00;
// while(OSCSTATbits.LFIOFR==0){}; //wait until LPOSC is ready
while(1)
{
CLRWDT();
RA2 = 1;
// NOP();
__delay_ms(5000);
RA2 = 0;
// NOP();
__delay_ms(5000);
WDTCON0bits.SEN = 1;
SLEEP();
// SLEEP();
// SLEEP();
WDTCON0bits.SEN = 0;
}
}
work me through to solve this?
... solve what? ... you have not said what problem you are facing. \$\endgroup\$