*Hibernate and the correct way to drive LEDs.

Mikler

Member
Hi!

Some beginners help please.

My project basically lights LEDS. I want to have a switch that when pressed, it hibernates. When pressed again, it 'wakes up'.

In the manual (P57) for 'Hibernate', regarding best low power consumption, it advises:
"ensure that no outputs are being actively driven..."

I don't understand what this means?
Does it mean that if I am currently driving LEDS, I must switch them off before calling the 'hibernate' routine?

Also, from the point of view of low power consumption (and general practice), does it make a difference if one 'side' of my LEDs are going direct to '+' and the other side of the LEDS go (via resistors) to 28X1 outputs which go low to switch on the LEDs (this is what I am doing). Or should one side of the LEDs go to '0v' and I should be using the 28X1 outputs to go high (via resistors) to power the LEDs?

Help/comments appreciated

Thanks

Mik
 

westaust55

Moderator
"ensure that no outputs are being actively driven..."

I believe this means that OUtputs should be changed to inputs so that the output side of each pin is tri-stated to non operating high impedance.

This could be possible using the Special Function Registers (SFR's) to modify the TRISx register. You will need to look at the PIC data sheet or my memory map and SRF register tables (search for them on this forum yourself ) unless you are lucky and I get time to point you to them later . . .

Don't believe it will make any differnce to power consumption whether the LED's are switched by a HIGH or a LOW output. Again the relevant PIC datasheet from Microchip will help confirm. Get the PIC type from PICAXE manual 1 bottom of page 12 then go to www.microchip,com and search for the corresponding PIC datasheet.
 

Mikler

Member
Thanks for your reply....

>>I believe this means that OUtputs should be changed to inputs so that the output side of each pin is tri-stated to non operating high impedance.

I understand that for lowest power consumption, inputs should have a tied-down resistor of 10K - does that mean that I would do this to what are normally my led outputs....?

Mik
 

Andrew Cowan

Senior Member
I understand that for lowest power consumption, inputs should have a tied-down resistor of 10K - does that mean that I would do this to what are normally my led outputs....?
Mik
No.

When you want to use a pin as an input, it needs to be tied up or down. Otherwise it will float when the switch is not connected.

10K is the norm, as it lets little current flow, while making a firm pull up/down.
10M can be used - it will have a miniscule current draw, but not a very strong pulldown. This means flux etc on the board could corrupt it.

If you are not using the pin as an input, and you are just saving power, you can do with no resistor - this will have the lowest current draw possible.

However, your LEDs will probably act like a resistor (couple of hundred K ohms), so the pin won't float - it will be pulled to whichever rail the LEDs lead to.

A
 

Dippy

Moderator
"Not actively driven". e.g. an LED switched ON.

As you know, an 'output' pin can sink or source current.
They retain that state during Sleep.
If you are using it to 'source' (e.g. O/P---res+LED---Gnd) just set it LOW before Hibernate/Sleep.
If you are using it to 'sink' (e.g. +V---res+LED---O/P) then set it high.
This means that the Outputs are NOT actively driven.

Making them inputs can be a solution but not necessarily.
It depends on the circuit attached.
If it were directly driving and FET (for example) it may float and allow the FET to come on.
(In that example this is where a pull-up / pull-down res would be used).
And sometimes making them an 'input' can require, as mentioned, knowledge of TRIS.
(If you're not PIC savvy, the TRIS register on a PIC determines the 'direction' of the port/pin and specifies whether it is Input or Output - adjustments require a little care).
 
Top