RE: [PIC] High Power Consumption for a Battery operated application - Electronic Safe
| Newsgroups | gmane.comp.hardware.microcontrollers.pic |
|---|---|
| Organization | alicit.com |
| Message-ID | <[email protected]> |
Francois - Getting a PIC microcontroller to minimum standby current can be complicated. Do you have the whole schematic? Try these steps: 1) Make sure that EVERY pin is at HIGH or LOW level when the device is in standby mode. Any CMOS pin in a mid-level mode will eat power. 2) Make sure the pins that are driving external things are in a low power situation. By that I mean that no pulled-up pins are pulled-down during standby, and vice versa. 3) Make sure the clock oscillator has stopped in standby mode. I make a lot of PIC-based battery operated products and my final check is always to put the device is low power standby mode and then probe every pin in turn with the 'scope to make sure they are all in the mode for zero power use. Chris Fox ************************ Christopher W. Fox Consultant/Engineer/Programmer (210) 823-5671 eMail: [email protected] Please consider the environment before printing this e-mail, or it's attachments. -----Original Message----- From: Piclist <[email protected]> On Behalf Of Francois Robbertze Sent: Tuesday, January 7, 2025 1:15 PM To: [email protected] Subject: [PIC] High Power Consumption for a Battery operated application - Electronic Safe Hi, I need help with the power consumption on a battery operated project (Keypad safe) I have a lot of safes and the controllers is damaged. I want to create new controllers for these safes and try to use what is available Details: Current Power is supplied by 4xAA Batteries. Power is dropped to 4.8 volt through 2 diodes. I used PICBASIC Pro and the software works perfect except the current draw is about 1.56mA. The datasheet show on page 167 a current draw of 1uA in sleep mode. I use the PIC16F88. That is with the programmer disconnected.( I measure about 156,8mV volt drop over a 100Ohm resistor ) What am I missing or doing wrong? The Software in short: Config: __config _CONFIG1, _INTRC_CLKOUT & _WDT_OFF & _LVP_OFF & _CP_OFF & _BOREN_OFF & _MCLRE_ON & _DEBUG_OFF __config _CONFIG2, _FCMEN_OFF & _IESO_OFF Pin Setup: Row1 VAR PORTA.0 '4x3 Keypad Row2 VAR PORTA.1 Row3 VAR PORTA.2 Row4 VAR PORTA.3 Col1 VAR PORTB.0 Col2 VAR PORTB.4 Col3 VAR PORTB.5 ' Other pins Solenoid VAR PORTA.4 ' Solenoid control pin Beeper VAR PORTB.3 ' Beeper control pin ResetButton VAR PORTB.6 ' Reset button Led var PORTB.2 ' heartbeat Initialize: OSCCON = %01101110 'set int rc osc to 4mhz CMCON = 7 ' Disable comparators, PORTA as digital I/O ANSEL = 0 ' Set all pins as digital I/O ADCON0 = 0 ' a to d off ADCON1 = 0 '?? T1CON = 0 T2CON = 0 ' timer 2 off CCP1CON = 0 ' capture compare off TXSTA = %00000000 '?? RCSTA = %00000000 '?? PORTA = 0 ' Initialize PORTA to 0 PORTB = 0 ' Initialize PORTB to 0 TRISA = %00000000 ' Set PORTA direction (input/output as needed) ' RA0 - RA3 keypad row - outputs ' RA4 - stryker - output ' RA5 - reset mclr - set as input ' RA6 - RA7 osc TRISB = %01110001 ' Set PORTB direction ' RB0 - col1 ' RB1 - nc ' RB2 - LED ' RB3 - Buzzer ' RB4 - Col2 ' RB5 - Col3 ' RB6 - nc Programmer ' RB7 - nc Programmer OPTION_REG.7 = 0 ' Enable weak pull-ups on PORTB OPTION_REG.6 = 0 ' TRIGGER INT ON FALLING EDGE I then enable interrupt : INTCON = %10011000 ' enable change on port[B4-B7] and ext int on port b ON INTERRUPT GOTO Handleinterrupt ' Interrupt Service Routine Main Routine: Check for KeypressedFlag Check for ResetPressedFlag Flash LED Goto Sleep: OSCCON = %00000010 '32KHz asm sleep endasm OSCCON = %01101110 '4MHz .and goto Main Here is my Interrupt Handler. Disable HandleInterrupt: if resetbutton = 1 then ResetPressedFlag = 1 resume endif IF INTCON.1 = 1 THEN ' Check external INT (RB0) KeyPressedFlag = 1 ' Set flag for RB0 INTCON.1 = 0 ' Clear external INT flag ENDIF IF INTCON.0 = 1 THEN ' Check IOC interrupt 'IF (PORTB & %00110000) <> %00110000 THEN KeyPressedFlag = 1 ' Set flag if RB4 or RB5 changes 'ENDIF INTCON.0 = 0 ' Clear IOC flag ENDIF RESUME enable I am currently using the PIC16F88. I tried to drop the voltage below 4Volt with disastrous effects. Should I get another PIC? . I don't want to replace the batteries every month. Regards Francois -- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at https://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at https://mailman.mit.edu/mailman/listinfo/piclist