speedEC
Full Member level 6
Dear All,
I need some help on saving current consumption while the PIC MCU in SLEEP mode. I used three interrupts that is INT0, RBIF and Comparator Interrupts. I have used 6v, 4.2Ah sealed lead acid battery. I have used WDT to wake up the device every 24 Hrs. Until then I put the device in SLEEP mode. After 24 Hrs expires I have to enable comparator to check the Battery Voltage and If Battery Voltage is not low again I put PIC into SLEEP mode.
I have not drawn any current from pins of PIC MCU except drive transistors (RB0 and RB4) as follows:
But, I found so much current consumed by the PIC MCU even though it is in Sleep mode.
Setting Comparator Interrupts as follows.
WDT Settings - 1:128 prescale
Disable Comparators before go in to SLEEP mode
Put PIC into SLEEP Mode:
I wake up the PIC MCU only if 24 hrs expires:
Once if battery voltage is not low again disabled the comparators and put PIC in to SLEEP.
I have to drive one transistor thro' RB4 pin (Vdd) and RB0 (Vdd) to capture IOC and INT0 interrupt respectively.
Any Help pl?
Thanks
I need some help on saving current consumption while the PIC MCU in SLEEP mode. I used three interrupts that is INT0, RBIF and Comparator Interrupts. I have used 6v, 4.2Ah sealed lead acid battery. I have used WDT to wake up the device every 24 Hrs. Until then I put the device in SLEEP mode. After 24 Hrs expires I have to enable comparator to check the Battery Voltage and If Battery Voltage is not low again I put PIC into SLEEP mode.
I have not drawn any current from pins of PIC MCU except drive transistors (RB0 and RB4) as follows:
Code C - [expand] 1 2 3 4 5 6 TRISA = 0b11111111; // All PORTA pins as input TRISB = 0b00010001; // All PORTB pins as output // except RB0 and RB3 (inputs) PORTA = 0b00000000; // Intialize PORTA PORTB = 0b00010001; // Intialize PORTB
But, I found so much current consumed by the PIC MCU even though it is in Sleep mode.
Setting Comparator Interrupts as follows.
Code C - [expand] 1 2 3 4 CMCON = 0b00100101; //select mode 7 (101) VRCON = 0b11101010; // setting Voltage refernce for 1.93v // to select 10 delay_ms(100); // 100 msec delay
WDT Settings - 1:128 prescale
Code C - [expand] 1 2 3 4 5 PSA = 1; // setting prescale to WDT PS0 = 1; // PS0, PS1, PS2 = 111 = 1:128 ratio PS1 = 1; // (2.3 seconds delay) PS2 = 1; CLRWDT();
Disable Comparators before go in to SLEEP mode
Code C - [expand] 1 2 3 4 5 mismatch_Clr = CMCON; // read CMCON to clear Comp.. Flag CMIF = 0; // clear Comparator Flag CMIE = 0; // disable Comparator Interrupt VREN = 0; // off Vref delay_ms(100); // 100 msec delay
Put PIC into SLEEP Mode:
Code C - [expand] 1 2 3 4 5 while(1){ CLRWDT(); SLEEP(); Hrs_delay(); }
I wake up the PIC MCU only if 24 hrs expires:
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 void Hrs_delay(void){ //mSecDelay already set as follows //#define mSecDelay 37565 //FOR 24 Hrs = (24hrs x 60min x 60sec / 2.3sec) count--; if (count == 0){ //check for 24 hrs lapsed count = mSecDelay; // Reset Counter mismatch_Clr = CMCON; // read CMCON to clear Comp.. Flag CMIF = 0; // clear Comparator Flag CMIE = 1; // Enable Comparator Interrupt VREN = 1; // On Vref delay_ms(100); // 100 msec delay } }
Once if battery voltage is not low again disabled the comparators and put PIC in to SLEEP.
I have to drive one transistor thro' RB4 pin (Vdd) and RB0 (Vdd) to capture IOC and INT0 interrupt respectively.
Any Help pl?
Thanks