-
--> In article <
[email protected]>,
-> -
-> -> -Snip
-> -> -[And snip even more]
-> -
-> -And snipped again
-> [The snipping continues]
->
-and yet more snipping
-
-> ->
-> -> A cheap power saving trick is use a PIC I/O pin as the power source to
-> -your
-> -> switches. Then tie the anode of a diode and a resistor for each switch.
-> -> Something like this (need a fixed width font to view)
->
-> +------------------- PIC I/O
-pin
-> |
-> PIC I/O pin --+---->|----/\/\/\/\/\---------+------/ -------GND
-> |
-> | +------------------- PIC I/O
-pin
-> | |
-> +---->|---/\/\/\/\/\----------+------/ -------GND
-> |
-> | +------------------- PIC I/O
-pin
-> | |
-> +---->|-----/\/\/\/\/\--------+------/ -------GND
->
-> -> Here's how it works: The I/O pin on the left supplies +5V to the
-circuit
-> -when
-> -> on. You can ground it or tri-state it to turn it off. When it's on the
-PIC
-> -> supplies a 4.4V (5V-diode drop) signal to the input inputs on the right
-> -via
-> -> the resistors. So if no switches are on, each will read a one.
-> -> Now if a switch is on then it will ground the I/O pin that it is
-connected
-> -to.
-> -> The diodes prevent one switch from affecting the others. So while it
-adds
-> -> 3 diodes to the circuit, you eliminate the constant power draw that
-using
-> -> a pullup resistor for each switch will create.
-> -
-> -OK.......but would I need to do that as the push buttons are of the
-> -momentary type and will only be 'active' for a split second?
->
-> Yes. Buttons are pushed by human beings. That means that even if they
-> are momentary, they will be 'on' for a significant amount of time, like
-> milliseconds relative to the operating frequency of the PIC. I can
-guarantee
-> you that if you only check the buttons once every 2mS, you'll never miss
-> a button press. But if in checking you only use one tenth of 1 percent of
-> the power, you'll enjoy significant savings.
->
-> > It is not as if
-> -they are going to be turned on for any length of time. Once the pin has
-gone
-> -high there is no need to continue holding the button.
->
-> I understand. But the amount of time that you hold the button is
-significant
-> relative to the amount of time required to check it. In short while it
-seems
-> like a short time to the user, it's an eternity for the PIC application.
-
-Ok.......I understand your thinking and I agree with you, even a few
-milliseconds are going to seem like an eon to the the chip. Now, in the
-example up there ^^^ somewhere you suggest running the switches from an
-output pin on the PIC.
Yes. That's the I/O pin on the left side of the circuit.
- Does this mean that I will now have to poll those
-inputs in the same way I was planning on polling the inputs anyway in the
-original plan?
Yes except that you turn the I/O pin high before you check and turn it low
afterwards.
-
-i.e. something along these lines.......
-
- Start Conditions
-
- 1. Load start up registers
1a. Turn Left I/O pin high.
1b. Read in all three button I/O values into a temp register
1c. Turn Left I/O pin either low or off (change to an input).
- 2. Check PB1 status if low call PB1 routine
- 3. Check PB2 status if low call PB2 routine
- 4. Check PB3 status if low call PB3 routine
- 5. Goto step 2
-
-or will the PIC 'know' that a pin has gone low when the input pin goes from
-high to low?
No you have to check it. Someone else suggested using the weak pullups and
possible the change interrupt on PORTB. But even a weak pullup will suck
down battery power.
- Unfortunately I am only just beginning with PICs and I am still
-not fully conversant with just what they are capable of (but that will come
-with time and experimentation.........hopefully!) Can I also use the same
-diodes and resistors (i.e. 1N4002 and 10k) that I had in the original (and
-now much changed diagram) or will I now have to recalculate for new values
-of each? My thinking here is that if I have to buy parts in 10's, 20's etc I
-may as well use them up....lol.
No the 10K and the 1N4002 are fine.
-
->
-> -> [SNIP SNIP]
->
-> -> -I had
-> -> -looked at AA 1.5V battery holders but could only find 2 or 4 cell
-options
-> -> -and that added to the weight of the project. Would 4.5V be enough to
-> -drive
-> -> -the circuit (I know the 16F818 is a low power chip) or would the
-> -batteries
-> -> -die too quickly?
-> ->
-> -> Yes 4.5V would be enough to drive it. However the voltage will drop
-off.
-> -6V
-> -> regulated down to 5 with a switching regulator would give you more
-overall
-> -> power.
-> ->
-> -
-> -Ok......so are we looking at something like a LM2576 here (see the
-following
-> -url for spec. sheet)
->
-> That's a possibility. I believe in my first post I pointed you to Roman
-> Black's 2 transistor SwitchMode Power Supply which performs the same type
-> of regulation as the LM2576 (BTW the LM2574 in a 8 pin DIP may be a better
-> choice as you clearly won't need more than 500ma current draw), but with
-> ubiquitous, inexpensive parts.
->
-
-I have looked at Roman Black's page and I really like that option, small
-neat and does the job, however, I noticed that all his examples have higher
-input voltages than my 4.5-6V that I am looking at now. I checked out all
-his site and could not find a contact link to ask him if his circuit would
-work on such a low input voltage. I am hoping that it will as that will keep
-the costs down and still conserve energy/battery life. I have also looked at
-switching out the LEDs in my original design to flashing ones to save yet
-more power!
not sure. Roman's dropped off the face of the earth. No one has heard from
him in a public online venue in almost a year.
-
-Thanks for your great help Bryon (and all the others), I really appreciate
-it as I struggle to get this rusty brain of mine back up to speed.
No problem.
BAJ