PDA

View Full Version : trying to reduce current consumption on a 12HV615



Max Power
- 29th November 2011, 04:56
I have this project at work (can't really post the complete code)where I'm using the ECCP on a 12HV615 to output a PWM signal that changes the duty cycle with a button press. I had the chip blazing at 8MHz with no regard to current consumption. now I'm trying to cut the current. I changed to 4MHz, and I added a nap command while I wait for the button press. The nap command shuts down the PWM, so I can only nap when the duty cycle is zero. the thing is, it had no effect on the current consumption. Can anyone enlighten me?

here is (sort of )the code ...thanks PicmultiCalc!



@ __CONFIG _CP_ON & _WDT_ON & _BOR_OFF & _MCLRE_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT & _IOSCFS_4MHZ
CLEARWDT
DEFINE OSC 4
ANSEL....
GPIO....
TRISIO....

array of pwm values..
set CPP duty cycle to zero..

'SETUP and turn on PWM module for 20KHz, using a 4MHz clock
CCP1CON = 001100 ' CCP1, PWM mode, single output
PR2 = 49 ' 49 = 20KHz pwm frequency @4MHz and 1:1 prescaler
T2CON = 000100 ' 1:1 postscaler, TMR2 on, prescaler is 1




Main:


WHILE SWITCH_INPUT = 1 ; Wait here for the dim input to go low
IF PWMvalue[state] = 0 THEN ; if the light is off, then
TRISIO = 111111 ; set pins to high impedance
CCP1CON = 000000 ; turn PWM off (resets ECCP module)
T2CON = 000000 ; TMR2 off
NAP 0 ; go into low power mode for about 18 milliseconds
@ NOP
ELSE
TRISIO = 111000 ;turn outputs back on
CCP1CON = 001100 ; CCP1 is on, PWM mode, single output
T2CON = 000100 ; 1:1 postscaler, TMR2 on, prescaler is 1
ENDIF


WEND

blah blah blah
debounce
increment the state variable
pull the new pwm value out of the array
update the pwm
wait for the switch to be released
loop back to main

Max Power
- 29th November 2011, 05:03
wierd..I AM loading 8 bits into those registers..I swear. it's just not coming through

Max Power
- 29th November 2011, 05:46
I verified that I'm am indeed running at 4MHz. and I set the nap period to 7, and the chip becomes unresponsive for long periods of time...
then I set the nap period back to 0 and commented out the CLEARWDT line, thinking that the chip would stop responding all together. but the program runs just the same.hmmm... off to bed. my head hurts. :-)

Heckler
- 29th November 2011, 14:55
wierd..I AM loading 8 bits into those registers..I swear. it's just not coming through



If you are refering to the fact that your code displayed in the forum does not show the %00000000 (part in red)...

Yes, I have noticed that myself and it is surprising that the forum administrators have not addressed this problem.
===================================

As far as your question regarding current consumption...

how much change are you seeing and more importantly... what is the value you are measuring. If you are just putting the PIC to sleep, the change in current consumption will be much less than 1 milliamp unless you have external circutry that is also being shutdown. The PIC itself consumes very little power.


• Operating current:- 100μA @ 2V, 1 MHz, typical• Standby current:- 1 nA @ 2V, typical

Heckler
- 29th November 2011, 15:08
Well I tried to go back and correct the text I copied from the datasheet showing current consumption, but this forum would not let me...

the data sheet shows current consumption of
100 microamps nominal at 1MHz
and it drops to 1nanoamp in standby.

Is your current measuring equipment able to measure these small value current changes?? or are you expecting to see a bigger change?

Max Power
- 29th November 2011, 15:49
hmm... I'm nowhere near microamps, I'd love to be in the uA range. I'm powering the board at 12V, and using the pic's internal 5V shunt regulator. I've got a 510 ohm resistor between the power input and the pic. I have a diode on the 12V in, so it goes 12V in --> diode---> 510 ohm res ---> Pic. I also have two strings of LEDs picking up power after that diode, and the strings are switched to GND through a FET (BSH114). I'm PWMing the 2 fets. I also have a TVS to gnd (smaj24) on the 12V coming in. I figure that the LEDs aren't drawing any current when the FET is off, The TVS shouldn't be, the shunt regulator has got to draw some current, I'm thinking 4 or 5 mA. and then whats left is the pic, which is only driving the fets. I have a 10K pull down on the PWM line, and a 10K pullup to vcc on the switch input.

I'm measuring a current draw of about 12mA on the 12V line when the lights are off and the switch is open circuit. Chip running at 8Mhz with no napping = 12.6mA on my fluke DMM (300mA) setting. chip running at 4MHz with napping = 12.6mA.

Darrel Taylor
- 29th November 2011, 22:02
The shunt regulator will always draw the same amount of current whether the PIC is asleep or awake.
That current is always MORE than the most that will ever be used by the PIC, including output pins.

As the PIC draws more current, the regulator "Shunts" less to maintain the same voltage.
When asleep, the regulator draws the full amount, since the PIC is drawing ~nothing.

If you want low current, use an external LDO regulator, and a different PIC.

HankMcSpank
- 29th November 2011, 22:39
+1


I use an MCP1703 (available in many variants with differing voltage outputs), it's very low quiescent currrent.

In sleep, I'm getting about 6uA draw for my whole circuit (though there's a lot of trial & error changing pin IOs TRISs Analogue on/off shutting down peripheral etc to get it down to that!).

Max Power
- 30th November 2011, 14:57
Thanks everybody. I was slowly realizing the same thing on my own, but it's nice to hear from you guys.

I'll look into the MCP1703, or other low Q LDOs