Can I use 2 IO pins to increase current to a load?
william chan
Posts: 1,326
Hi,
Let's say I need to drive a IR LED directly from a IO pin using Counter A.
Since the IO pin can only source about 30mA, which is a bit weak, can Counter A be configured to create the 38Khz carrier wave on 2 IO pins simultaneously, to drive the IRED?
Should I use IO pins that are not adjacent to each other?
Thanks.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
Let's say I need to drive a IR LED directly from a IO pin using Counter A.
Since the IO pin can only source about 30mA, which is a bit weak, can Counter A be configured to create the 38Khz carrier wave on 2 IO pins simultaneously, to drive the IRED?
Should I use IO pins that are not adjacent to each other?
Thanks.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
Comments
It's not a good a good idea or practice to parallel I/O pins... A much better solution is to use a transistor to buffer the signal and provide more current drive.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
As you know, I am always looking for ways to save costs.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
Willy,are you sure you're not a bean counter or is this an exercise in absolute frugality at the expense of good engineering?
*Peter*
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
(1)· Unequal current sharing.· Each pin sources current through a transistor when high, and sinks current through another transistor when low.· Unless these transistors are perfectly matched (nearly impossible), the one on one of the pins will have a slightly lower saturation voltage than the one on the other pin, and the result will be that one pin sources most of the current, or sinks most of the current.· You can avoid this by using separate resistors to each pin.· If, for example, your calculations show that using 100 ohms will give the desired 60 ma (this depends upon the drop at the LED and you must calculate it yourself) -- if, I say,·you calculate 100 ohms total, then use 200 ohms at each pin, both connected to the LED but separately connected to each pin.· Each pin will then supply half the needed total current.
(2) Unequal·transition timing.· If the pins are connected directly together, and one switches more slowly than the other, or later than the other (very possible, perhaps even certain), there will·a time·when one is high and the other is low, or when one is high or low and the other is transitioning.· This will cause an amazingly large current through both pins (into one and out of the other) for a brief time.· Don't be lulled by the brevity of this current·pulse.· Transistor structures on an IC are so small that local heating of this nature can cause damage within nanoseconds -- especially when it occurs repeatedly.
Bottom line:· don't connect the pins together, ever.· However, if you use separate resistors as suggested under (1) above, these resistors will not only assure against unequal current in the two pins, but·also protect against the problem described in (2).· You mustn't connect the two pins together, but you can feed a single load (your LED) from two pins simultaneously, as long as you use separate current-limiting resistors.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· -- Carl, nn5i@arrl.net
Post Edited (Carl Hayes) : 12/20/2008 8:02:29 AM GMT
I think your idea of using separate current-limiting resistors satisfies every objection to paralleling outputs mentioned here, including software errors. (The typical Propeller video DAC is a perfect example of this, although the outputs are "paralleled" for a different reason.) My only issue — and it's a small quibble — is with your assertion (1) as it applies to CMOS outputs. Since a MOS transistor's output characteristic is largely resistive in nature, load sharing among multiple outputs tends to be self-balancing. Hard-wired paralleling is a definite no-no with bipolar transistor outputs since, as you rightly point out, the saturation voltages can differ, resulting in wildly uneven load sharing.
William,
Pursuant to Chris's observation, you'd have to use (and synchronize) two counters to pull this off.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Just a few PropSTICK Kit bare PCBs left!
Post Edited (Phil Pilgrim (PhiPi)) : 12/20/2008 8:44:04 AM GMT
and also the 2 counter phases simultaneously?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
Pendapat saya.
Cheers
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Adequatio Rei Et Intellectus
You can set any combination of bits of DIRA (or OUTA or anything) simultaneously by using the bit logical operations on the whole value like:
DIRA |= (|< x) | (|< y)
or
DIRA |= %0000_0101_0000_1010
Similarly, you can reset any combination of bits with:
OUTA &= !((|< x) | (|< y))
or
OUTA &= ! %0000_0101_0000_1010
or the equivalent (but not as understandable)
OUTA &= %1111_1010_1111_0101
You can't set the two phase counters (or any two longs) simultaneously.
I agree with the others. If you need higher current, add a transistor.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"I have always wished that my computer would be as easy to use as my telephone.· My wish has come true.· I no longer know how to use my telephone."
- Bjarne Stroustrup
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· -- Carl, nn5i@arrl.net
If it were me, I'd use a transistor, too. The price adder for a single bipolar transistor isn't going to matter that much. Depending on what else your circuit uses, you might be able to combine functions (i.e. dual NPN) to save pick-and-place costs, at least. Plus, there'd be less stress on the Propeller.
On a theoretical level, this has been an interesting discussion and, with two resistors and the appropriate PASM code, you could probably get by without the transistor. But just to save a couple pennies, compared to the cost of the Propeller itself?
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Just a few PropSTICK Kit bare PCBs left!
The output transistors in the Propeller should be well-matched, since they're on the same substrate, use identical features, are are subject to the same environmental conditions during manufacture and (between adjacent pins) nearly identical thermal conditions during operation. Moreover, because the RDS(on) transfer characteristic of a MOSFET has a positive temperature coefficient, load imbalances tend to be self-limiting, rather than exacerbated. Nonetheless, it's still bad practice to parallel the outputs directly, for the other reasons cited.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Just a few PropSTICK Kit bare PCBs left!
Your asking for the type of weird trouble that shows up unexpectedly late one night after you've long forgotten about the paralleled ports.
Jim-
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Signature space for rent, only $1.
Send cash and signature to CannibalRobotics.
The output transistors should be well matched, but I never trust things like that.· I've been burned.· Still, like you, I would never parallel the outputs, but through separate resistors into a single load I would have no qualms at all.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· -- Carl, nn5i@arrl.net