The 887 datasheet says each pin can give an absolute maximum of 25 mA,
but it warns against drawing that much.

I'm doing display multiplexing and I want to pump as much current as
possible through my LED's, while at the same time having a stable
reliable product.

Do you reckon it's OK to pull a full 25 mA from a pin if you're doing
display multiplexing?

I know you can probably draw 30 mA and get it way with it, (PIC's being
bulletproof and all that), but I'm trying to think in terms of a
developing a rock-solid product that has minimal faulty units, something
that will sell in the millions all over the world.

> The 887 datasheet says each pin can give an absolute maximum of 25 mA,
> but it warns against drawing that much.
>
> I'm doing display multiplexing and I want to pump as much current as
> possible through my LED's, while at the same time having a stable
> reliable product.
>
> Do you reckon it's OK to pull a full 25 mA from a pin if you're doing
> display multiplexing?

No it is not OK. There is a maximum power dissipation rating for the chip. This sets a limit to the total current that can be drawn from ALL pins.

>
> I know you can probably draw 30 mA and get it way with it, (PIC's being
> bulletproof and all that), but I'm trying to think in terms of a
> developing a rock-solid product that has minimal faulty units, something
> that will sell in the millions all over the world.

Robert Young wrote:
>> Do you reckon it's OK to pull a full 25 mA from a pin if you're doing
>> display multiplexing?
>>
>
> No it is not OK. There is a maximum power dissipation rating for the chip. This sets a limit to the total current that can be drawn from ALL pins.
>

The total limit -- if we understand each other -- is 90 mA for all pins
combined. I've only got two pins sourcing current at a time, so I'm not
going over the limit for "ALL pins" as you call it.

>> I know you can probably draw 30 mA and get it way with it, (PIC's being
>> bulletproof and all that), but I'm trying to think in terms of a
>> developing a rock-solid product that has minimal faulty units, something
>> that will sell in the millions all over the world.
>>
>
> Then don't exceed ANY rating.

I don't think anyone can be that pedantic about it, because after all
the PIC datasheet itself doesn't give a maximum rating. It tells you "25
mA" but then it kind of shies away and says "yeah but you probably don't
wanna draw 25 mA from it". So then what's a safe current to draw? 24.9
mA? 23 mA? 20 mA? We're left in the dark.

Judging by the amount of abuse I've seen PIC chips being able to take, I
get the feeling I'd be A-OK to draw 25 mA when multiplexing my display.

The issue with pulling 25ma from each output most likely will be a
problem with the 887 heating up and failing catastrophically. If you
heat portions of the chip up quickly enough, the chip will fail
without the entire chip heating up. Localized heating will do it in.

A rock solid product will be defined differently by different engineers.
If it were me, I would stay away from max values by a factor of 2:1.
I would monitor the 887 for temperature rise at room temperature ( or
whatever environment it will be in ). I wouldn't want the chip to
have a temperature of more than the midpoint between 30C and the
maximum temperature. I would also test the design in a test chamber
where the ambient was 50C. Testing the design means testing more
than one board. The more boards you test, the better handle you have
on typical performance.

No doubt there are geniuses on this list who know how to
statistically analyze MTBF ( mean time between failure ) after a
number of boards have been tested. And they probably want to be
paid. ( I would )

> On Jul 13, 2008, at 5:42 PM, Tomás Ó hÉilidhe wrote:
>
>
> The 887 datasheet says each pin can give an absolute maximum of 25 mA,
> but it warns against drawing that much.
>
> I'm doing display multiplexing and I want to pump as much current as
> possible through my LED's, while at the same time having a stable
> reliable product.
>
> Do you reckon it's OK to pull a full 25 mA from a pin if you're doing
> display multiplexing?
>
> I know you can probably draw 30 mA and get it way with it, (PIC's
> being
> bulletproof and all that), but I'm trying to think in terms of a
> developing a rock-solid product that has minimal faulty units,
> something
> that will sell in the millions all over the world.
>

On Sun, Jul 13, 2008 at 6:42 PM, Tomás Ó hÉilidhe <spam_OUTtoeTakeThisOuTlavabit.com> wrote:
>
> The 887 datasheet says each pin can give an absolute maximum of 25 mA,
> but it warns against drawing that much.
>
> I'm doing display multiplexing and I want to pump as much current as
> possible through my LED's, while at the same time having a stable
> reliable product.
>
> Do you reckon it's OK to pull a full 25 mA from a pin if you're doing
> display multiplexing?
>

Did you read my reply that I sent you under "Pin current limits"?

What do you think the pin's output voltage will be when you source
25mA from it? What will the PIC's dissipation be?

You need to mentally integrate all the available information
in a data sheet to get a proper impression of true
capabilties.

In the above data sheet.

- Page 245.
ABSOLUTE maximum Vdd or Vss current is 95 mA.
So you could operate no more than 3 I/O pins at 25 mA
without exceeding this.

- Also page 245.
Absolute maximum readings are just that. As they note,
proper operation of the IC is not guaranteed at that level
AND the IC may be damaged if you run it above this level. ie
this is the outer limit at which damage to the IC probably
won't happen.

>
>
> Robert Young wrote:
>>> Do you reckon it's OK to pull a full 25 mA from a pin if you're doing
>>> display multiplexing?
>>>
>>
>> No it is not OK. There is a maximum power dissipation rating for the chip. This sets a limit to the total current that can be drawn from ALL pins.
>>
>
>
> The total limit -- if we understand each other -- is 90 mA for all pins
> combined. I've only got two pins sourcing current at a time, so I'm not
> going over the limit for "ALL pins" as you call it.
>
>
>>> I know you can probably draw 30 mA and get it way with it, (PIC's being
>>> bulletproof and all that), but I'm trying to think in terms of a
>>> developing a rock-solid product that has minimal faulty units, something
>>> that will sell in the millions all over the world.
>>>
>>
>> Then don't exceed ANY rating.
>
>
> I don't think anyone can be that pedantic about it, because after all
> the PIC datasheet itself doesn't give a maximum rating. It tells you "25
> mA" but then it kind of shies away and says "yeah but you probably don't
> wanna draw 25 mA from it". So then what's a safe current to draw? 24.9
> mA? 23 mA? 20 mA? We're left in the dark.
>
> Judging by the amount of abuse I've seen PIC chips being able to take, I
> get the feeling I'd be A-OK to draw 25 mA when multiplexing my display.
>

> The total limit -- if we understand each other -- is 90 mA
> for all pins
> combined.

Yes. 90 mA ABSOLUTE MAXIMUM. Beyond that damage may occur.
Also 25 mA drive per single pin, above which damage may
occur.
And, proper operation of the IC is not guaranteed at these
levels - these are just "stress ratings" (their words more
or less)

> I've only got two pins sourcing current at a time, so I'm
> not
> going over the limit for "ALL pins" as you call it.

I really is the limit for 2 pins.
And knowing that you are talking about only 2 pins is
helpful. If you give as much information as possible in the
original query (such as how many pins you want to use at
once) it helps people direct the answers appropriately and
avoid blind alleys.

>>> I know you can probably draw 30 mA and get it way with
>>> it, (PIC's being
>>> bulletproof and all that), but I'm trying to think in
>>> terms of a
>>> developing a rock-solid product that has minimal faulty
>>> units, something
>>> that will sell in the millions all over the world.
>>>
>>
>> Then don't exceed ANY rating.

This is crucial.
Exceeding the absolute maximum ratings MAY dstroy the IC.
Operating AT the maximum ratings may lead to improper
operation.
Both those points are explicitly stated in the data sheet.

> I don't think anyone can be that pedantic about it,
> because after all ...

The "ASBSOLUTE MAXIMUM section of any data sheet should be
read with an utterly pedantic mindset.
It means just what those two words say.

> the PIC datasheet itself doesn't give a maximum rating.

It does. As above. Absolute Maximum is the maximum rating
under ANY conditions to guarantee IC survival.
You can sometimes destrioy it with lower combinations but
the are saying that it may die if even any one of these
ratings is exceeded at one time.

> It tells you "25
> mA" but then it kind of shies away and says "yeah but you
> probably don't
> wanna draw 25 mA from it". So then what's a safe current
> to draw? 24.9
> mA? 23 mA? 20 mA? We're left in the dark.

The apparent "shieing away" is a result of the two sections
concerned dealing with different things.
Absolute maximum deals with IC death
Operating conditions deal with actually doing useful work.

As you draw more current from a pin (or sink it) the voltage
is pulled further from the supply rail due to internal
voltage drop. A point is reached where the logic level
becomes invalid. If your external devices have tighter logic
level requirements then you MAY not be able to draw full
rated current.

A made up example only.
IC has pin current of 25 mA abs max, 20 mA max operating.
Vout is 5V at 0 mA and say 3.5 V at 20 mA.
If your external device needs to see 4V or more to see a
logic high then a 20 mA load would pull the voltage below
the level where it was valid for your external device.

> Judging by the amount of abuse I've seen PIC chips being
> able to take, I
> get the feeling I'd be A-OK to draw 25 mA when
> multiplexing my display.

Depends on what you mean by A-OK.
The data sheet says that 25.001 mA MAY destroy the IC.
It also says that the IC MAY NOT work properly at 24.999 mA
but will survive.
The max allowable OPERATING current is elsewhere in the data
sheet (usually) and may be 20 mA.

While many PICs may well sink 25 or 30 mA per I/O pin and
work OK, if you design for 25 mA, and build a million
products and some source 26 mA you may find you have
thousands of customers with games of "Connect 0".

What I think is a little strange about this is that you can power the
PIC at different voltages; I mean if the PIC's powered by 5 V, then 25
mA equates to a power dissipation of 125 mW. However if you run the PIC
at 3 V, then 25 mA means a power dissipation of only 75 mW.

If you're allowed source 25 mA when running at 5 V, then should you not
be allowed to source 41 mA when running at 3 V? (41 = 25 * 5 / 3)

The power dissipated by the PIC in this case is NOT (Vdd-Vss)*Current.
It is (Vdd-Vpin)*Current. So, if you are supplying the PIC with 5V,
and the voltage under a 25mA load on the pin is 3V, then the
contribution to the total PIC power dissipation from this pin is
(5-3)*0.025=50mW. This is all being dissipated by a tiny FET driver
inside the IC.

At 3V supply, the situation would be something like the following: 1V
on the pin at a 25mA load, giving (3-1)*.025=50mW still. The voltage
drop between the PIC's Vdd pin and the output pin comes from the
current (25mA) times the on resistance of the FET driver for that pin.

Another problem which Mark alluded to is that the voltage on the
output pin may drop considerably (as in the above example, 2V drop) at
such high currents. This is because you are beginning to take the FET
driver out of the ohmic region into the constant current region.

I suspect that if you shorted one of the output pins to ground and
drove it high, it would probably source about 100mA. This is the
reason why some people don't feel the need to use current limiting
resistors with LEDs on PIC pins - it will often work out that you will
get something like 20mA out of the pin when you force it to the Vf of
a typical LED. The problem with this is that PIC output pin resistance
varies from IC to IC, and with temperature, and the same is true of
the Vf of an LED, so that perhaps 10% of the products produced this
way will have out of spec currents which will damage either the LED or
the PIC output driver.

You are extremely ambitious, which is good to a point. You remind me
of myself at about 16 years old. That's about the time when I joined
the PICLIST (I'm 28 now) and I have learned a LOT. Please try to be
patient and learn from the good people here - even those who can be
gruff at times. If you really do take your product to production in
the millions, you will learn many things along the way, one of them
being that you WILL see almost every failure mode imaginable. Stuff
that you would never see doing hobby pic projects (because it has a
probability of 0.01%) will show up in some of your production units.
You therefore must rely on a good deal of planning and testing, and
re-design using info from failed units, to perfect your design.
Anything which is slopped together and just "works" will probably work
in 80% of production units, but there WILL also be that extra 20%
fallout or more due to something you didn't see in your single
prototype.

>
> Take the following simple circuit:
>
> PIC pin set high --> resistor --> LED --> ground
>
> Now here's what I'm curious about:
>
> The datasheet cites the maximum current for an I/O pin as 25 mA.
>
> What I think is a little strange about this is that you can power the
> PIC at different voltages; I mean if the PIC's powered by 5 V, then 25
> mA equates to a power dissipation of 125 mW. However if you run the PIC
> at 3 V, then 25 mA means a power dissipation of only 75 mW.
>
> If you're allowed source 25 mA when running at 5 V, then should you not
> be allowed to source 41 mA when running at 3 V? (41 = 25 * 5 / 3)
>
> Just a thought.
>

On Sun, Jul 13, 2008 at 7:56 PM, Tomás Ó hÉilidhe <EraseMEtoespam_OUTTakeThisOuTlavabit.com> wrote:
>
>
> Mark Rages wrote:
>> What do you think the pin's output voltage will be when you source
>> 25mA from it? What will the PIC's dissipation be?
>>
>
>
> I'm powering the 887 off 3 volts.
>
> When a pin is set to high, I guess it will be between 2.8 volts and 3
> volts maybe.
>

No need to guess, see figure 18-28 in the datasheet. (well, you may
need to extrapolate a little. The graph only goes to 4 mA output
current.)

> When a pin is set to high, I guess it will be between 2.8
> volts and 3
> volts maybe.

Only at VERY low current.

>
No need to guess, see figure 18-28 in the datasheet. (well,
you may
need to extrapolate a little. The graph only goes to 4 mA
output
current.)
/>

Page 287.
IF the internal resistance stays the same then that graph
can be VERY roughly translated to

Vout = 2.9 - 0.125V/mA

ie 1 V drop at 8 mA or about 24 MA out with pin grounded.

If you drove a 2.1V load directly with no resistor you might
hope for about 6 mA.

As the IC warms up this is liable to decrease.

*** An LED driver is looking to be essential ***

BUT this is exceedingly cheap and easy to achieve. An
emitter follower consisting of a single transistor will
suffice. NPN. Collector to V+. Emitter = output. Base to
output pin.
Vout ~= Vdd - 0.7V.
Given the closeness of your desired load voltage to Vdd a 2
transistor driver would be preferred if cathode to ground
connected LED is required. Done properly this takes 4
resistors and 2 transistors. One less resistor if one FET
used. 2 less resistors if 2 FETs used.

One transistor plus two resistor driver if anode to Vdd LED
connection OK

Apptech wrote:
> *** An LED driver is looking to be essential ***
>
> BUT this is exceedingly cheap and easy to achieve. An
> emitter follower consisting of a single transistor will
> suffice. NPN. Collector to V+. Emitter = output. Base to
> output pin.
> Vout ~= Vdd - 0.7V.
> Given the closeness of your desired load voltage to Vdd a 2
> transistor driver would be preferred if cathode to ground
> connected LED is required. Done properly this takes 4
> resistors and 2 transistors. One less resistor if one FET
> used. 2 less resistors if 2 FETs used.

Ah, so it wouldn't invert the logic? Why not simply invert the logic of the
PIC pin? I wasn't following this thread too closely, perhaps I don't
understand the design intent?

> The one transistor common emitter driver mentioned at the
> end uses a little more but requires common anode led
> connection which may be an issue in a multiplexed scheme.
>
> The 2 transistor driver preserves both drive sense and
> common cathode connection but uses (a few) more parts.

I found Tomas's reference to millions of units sold around the world to be
quite amusing. :) Reminded me of the time in the not-so-distant past when I
was his age, had crazy ambitions, and was perhaps even more naive.
Fortunately, I kept my ambitions secret, because I was afraid people would
make fun of me. ;-P

Get the prototype done in the most straightforward way, as quickly as
possible -- don't get bogged down in the details. Optimize the design when
you get to the point where saving 5 cents per unit makes a difference.

It says in section 17.0, 25mA each I/O pin, or 90mA total. It also has
a maximum power dissipation figure of 800mW, and gives a formula on how
to calculate it including the (Vdd-Voh)*Ioh and Vol*Iol which was
discussed earlier.

Section 17.6 gives the thermal dissipation figures... I notice that a 40
pin PDIP package has a thermal resistance of 47.2C/W J-A which means
that at 800mw, it will be 37.76C above ambient. Looks like this is fine
since the specs say 150*C. The case itself will be something like 18*C
over ambient.

But, I can't see anywhere it provides a warning about drawing close to 25mA.

-forrest

Wouter van Ooijen wrote:
>> The 887 datasheet says each pin can give an absolute maximum of 25 mA,
>> but it warns against drawing that much.
>>
>
> I'd be surprised. Where (on what page) does it say so?
>
>

Forrest W. Christian wrote:
> I was curious too, since I use the '886 I figured I'd take a look...
> It says in section 17.0, 25mA each I/O pin, or 90mA total.

I know that figure is in that section, but where does it say that you
can draw that amount of current and expect the chip to work?

Section 17.0 is the absolute maximum ratings section. Nobody knows what
that section is for (the standard that describes what "absolute maxima"
is supposed to mean is not freely available), but it is certainly *not*
for designing the operational state of a circuit.

(Ok, I have some idea what that section it might be for: there are
(short) circumstances, like a nearby lightning strike or a nuclear
event, where you want to know what currents or voltages your chip can
survive and be expected to work lateron.)

Wouter van Ooijen wrote:
> I know that figure is in that section, but where does it say that you
> can draw that amount of current and expect the chip to work?
>
It doesn't that I can see... That was kinda the point I was trying to
second in regard to your last post...

I did find one spot additionally where it refers to current in/out of a
pin... That is, that the Voh and Vol are rated at 3mA and 8.5mA
respectively.

In regards to the Absolute maximum, it specifically states that
operation is *not* guaranteed at this level....

"† NOTICE: Stresses above those listed under “Absolute Maximum Ratings”
may cause permanent damage to the
device. This is a stress rating only and functional operation of the
device at those or any other conditions above those
indicated in the operation listings of this specification is not
implied. Exposure above maximum rating conditions for
extended periods may affect device reliability."

When I design (as I'm sure you do), I try to stay quite a bit away from
the absolute maximum ratings of a device. Like at least 10 or 20%. That
would mean something like 20mA max, in my book. In no cases (high Vcc,
low Vcc, etc) should there be a condition where you exceed that rating.

Personally I'd just throw a fet or a high-efficiency led in there and be
done with it - typically I drive leds at around 10 mA or less so I've
got plenty of margin with most outputs, as long as I'm only driving a
couple of leds at any one time.

Actually it is interesting that the PicKit2 design exploits the behaviour of
the output fet, so that only a 10 ohm resistor is used for a current limiter
for the ICSPDAT and ICSPCLK lines. So that the current is too huge to be
able to drive the output therefore the voltage level will be dropped (as
described in the datasheet). Personally I do not like such exploitations, it
is just interesting to see that at Microchip they design circuits like this.

> Forrest W. Christian wrote:
> > I was curious too, since I use the '886 I figured I'd take a look...
> > It says in section 17.0, 25mA each I/O pin, or 90mA total.
>
> I know that figure is in that section, but where does it say that you
> can draw that amount of current and expect the chip to work?
>
> Section 17.0 is the absolute maximum ratings section. Nobody knows what
> that section is for (the standard that describes what "absolute maxima"
> is supposed to mean is not freely available), but it is certainly *not*
> for designing the operational state of a circuit.
>
> (Ok, I have some idea what that section it might be for: there are
> (short) circumstances, like a nearby lightning strike or a nuclear
> event, where you want to know what currents or voltages your chip can
> survive and be expected to work lateron.)
>
> --
>
> Wouter van Ooijen
>
> -- -------------------------------------------
> Van Ooijen Technische Informatica: http://www.voti.nl
> consultancy, development, PICmicro products
> docent Hogeschool van Utrecht: http://www.voti.nl/hvu
>

> Get the prototype done in the most straightforward way, as
> quickly as
> possible -- don't get bogged down in the details. Optimize
> the design when
> you get to the point where saving 5 cents per unit makes a
> difference.

I'm there :-).
Took a "few" decades.
Not my products.
I do rather regret some of the savings I made along the way,
not because they weren't worthwhile but because in the early
stages there are enough other costs and problems that they
swallow up the small savings and you may have been better
off doing things a little more expensively and making things
easier for yourself.

In the early stages of production it may be useful to not
aim at every possible saving and then roll them in
incrementally as volume ramps up. eg a 5 cent per unit
saving on a 10,000 run is only $500. In a million run it's
$50,000. The percentage of the cost also increases on the
larger volume as other costs will (should) drop with volume.
So 5 cents on a $5 product is 1% but this may rise to 2% as
volume climbs making it more worthwhile in both absolute and
relative terms.

Getting ANYTHING working as a prototype is a good first
step. In this application it will eg show you what you can
REALLY draw from a PIC pin and much more.

On Mon, Jul 14, 2008 at 5:21 PM, Tamas Rudnai <KILLspamtamas.rudnaiKILLspamgmail.com> wrote:
> Actually it is interesting that the PicKit2 design exploits the behaviour of
> the output fet, so that only a 10 ohm resistor is used for a current limiter
> for the ICSPDAT and ICSPCLK lines. So that the current is too huge to be
> able to drive the output therefore the voltage level will be dropped (as
> described in the datasheet). Personally I do not like such exploitations, it
> is just interesting to see that at Microchip they design circuits like this.

I would not use this "feature" in a production ready design.
As for Microchip's hardware/software design, quite some of
them are of "demonstration purpose only" type of quality.
So reliability is not of the top priority.

Vitaliy wrote:
> Get the prototype done in the most straightforward way, as quickly as
> possible -- don't get bogged down in the details. Optimize the design when
> you get to the point where saving 5 cents per unit makes a difference.

I have the prototype already and it works great. I'm improving on the
prototype now, using a better microcontroller, less components, and a
better power source.

Tomás Ó hÉilidhe wrote:
> I'm powering the 887 off 3 volts.
>
> When a pin is set to high, I guess it will be between 2.8 volts and 3
> volts maybe.
>
> This pin will go to an LED whose voltage drop is 2.1, and thence to a
> 33 ohm resistor to ground.
>
> Current will be about 25 mA or so.

Are you still intending to have only a single LED out of 50 or so
multiplexed on at a time? If so, the average current for a LED that is
supposed to be on will be 500uA.

Have you done your LED voltage/current/brightness homework yet? How would
you describe the brightness at 500uA? What is the appropriate spot on the
voltage/current diagram for where you will be operating these LEDs?

Tomás Ó hÉilidhe wrote:
> What I think is a little strange about this is that you can power the
> PIC at different voltages; I mean if the PIC's powered by 5 V, then 25
> mA equates to a power dissipation of 125 mW. However if you run the
> PIC at 3 V, then 25 mA means a power dissipation of only 75 mW.

But that is power into the load, which is irrelevant to the PIC. To
determine what the PIC can handle, you have to look at dissipation in the
PIC.

Wouter van Ooijen wrote:
>> When I design (as I'm sure you do), I try to stay quite a bit away from
>> the absolute maximum ratings of a device.
>>
>
> I don't. I simply don't read the "absolute maximum ratings" at all. For
> any normal design work (except for disaster survival considerations)
> that section is irrelevant.

So how do you know how much current you can source/sink to a pin? Do you
use a driver chip for everything?

>Vitaliy wrote:
> > Get the prototype done in the most straightforward way, as quickly as
> > possible -- don't get bogged down in the details. Optimize the design when
> > you get to the point where saving 5 cents per unit makes a difference.
>
>
>I have the prototype already and it works great. I'm improving on the
>prototype now, using a better microcontroller, less components, and a
>better power source.

If you had actually made any kind of a representative prototype you could NOT
(honestly, anyway) be making the kinds of comments you are making.

Tamas Rudnai wrote:
> Actually it is interesting that the PicKit2 design exploits the
> behaviour of the output fet, so that only a 10 ohm resistor is used
> for a current limiter for the ICSPDAT and ICSPCLK lines. So that the
> current is too huge to be able to drive the output therefore the
> voltage level will be dropped (as described in the datasheet).
> Personally I do not like such exploitations, it is just interesting
> to see that at Microchip they design circuits like this.

The PICKit2 has a few other design flaws. For example, it doesn't supply
the minimum bulk erase voltage to the target over the full range of legal
USB power voltages. It even uses the USB power voltage as its reference
voltage.

The PICKit2 is a OK design for what it was intended to be, which is a very
low cost "quick and dirty" programmer. It has succeeded in that very well.
However, users need to keep this in mind. It is certainly not something you
want to use in a production situation, for example.

Spehro Pefhany wrote:
> If you had actually made any kind of a representative prototype you could NOT
> (honestly, anyway) be making the kinds of comments you are making.

Way to blanket-bomb my entire project with a generic, ambiguous
accusation. If you want to be more specific I'll be more than happy to
answer the accusations.

My prototype works, and it works great. Sure, the PIC chip burns out in
it after about a week, but other than that it's OK. So this time around
I'm keeping an eye on the current limits so that it will run forever.

>> ... I simply don't read the "absolute maximum ratings"
>> at all. For
>> any normal design work (except for disaster survival
>> considerations)
>> that section is irrelevant.

Essentially agree. Knowing what abs max ratings are and
ensuring that they cannot be exceeded is required only for
survival design aspects. For operation you look elsewhere.

> So how do you know how much current you can source/sink to
> a pin? Do you
> use a driver chip for everything?

In many datasheets actual typical currents for Voh and Vol
are provided and ther voltage loading which occurs is
specified.

*** Note that the following is all based on extrapolating a
graph that stops at 4 mA. ***

In the 877 datasheet they have instead, as has been noted,
provided a graph of Vo with Io. Also as noted this graph
only goes up to 4 mA !!! They do not say you cannot draw
more - but the graph suggests that they do not consider this
normal.

I provided a guesstimated formula for Vout with Iout for the
877 based on extrapolating this graph.
I suggested that Voh ~~~= 2.9 - mA/8
eg for 4 mA Voh = 2.9 - 4/8 = 2.4V.
Max drop possible = 2.9V which occurs at 2.9 * 8 = 23.2 mA.
ie VERY roughly this is saying that if you ground the pin
when it is at Voh you can expect ABOUT 23 mA to flow at 25C
ambient. As IC temperature rises this current will drop (see
graph).

Driving your LED at 2.1 V the above formual gives a maximum
current of ABOUT (2.9-2.1) * 8 mA = 6.4 mA.

*** Note that the above is all based on extrapolating a
graph that stops at 4 mA. ***

SO a driver is not needed if the IC can provide enough
drive.
A driver is needed if the IC cannot provide enough current.
In this case if 25 mA or more is needed then, as per one of
my previous posts, a low cost transistor will provide all
the drive you need.

> So how do you know how much current you can source/sink to a pin? Do you
> use a driver chip for everything?

Tomas, this is well explained in the datasheet, but look at this way: Let's
say you weight exactly 80kg, and you need a bridge over a cliff. The
architect designs a bridge that is rated for 80kg only, and according to the
structure and the used material if 80.1 kg is on the bridge it will be more
than likely to collapse. Would you use that bridge?

Engineering is not using the absolute maximum, but to make sure that the
absolute maximum is well over the expected range you ever likely to use. You
may save 5 cents on the circuit to save on the led driver but you may spend
much more with the customer care - as you calculates with this too on the
other thread. If your circuit is only for hobby it is your choice what you
are doing but for a one off piece of circuit it would not be problem to put
extra components anyway.

Search foe LED driver on Microchip site, and read all the articles so you
will have a nice picture - and also make those experiences everyone
suggesting you to do so.

>
>
> Wouter van Ooijen wrote:
> >> When I design (as I'm sure you do), I try to stay quite a bit away from
> >> the absolute maximum ratings of a device.
> >>
> >
> > I don't. I simply don't read the "absolute maximum ratings" at all. For
> > any normal design work (except for disaster survival considerations)
> > that section is irrelevant.
>
>
> So how do you know how much current you can source/sink to a pin? Do you
> use a driver chip for everything?
>

> So how do you know how much current you can source/sink to a pin? Do you
> use a driver chip for everything?

Taking the 16F887 there is D080 and D090 (p251): sink 8.5 mA, source 3
mA. The (guaranteed maximum) voltage drops are mentioned, so you can
(and must) also check to stay within the maximum allowed dissipation (p253).

>>Vitaliy wrote:
>> > Get the prototype done in the most straightforward way,
>> > as quickly as
>> > possible -- don't get bogged down in the details.
>> > Optimize the design when
>> > you get to the point where saving 5 cents per unit
>> > makes a difference.

>>I have the prototype already and it works great. I'm
>>improving on the
>>prototype now, using a better microcontroller, less
>>components, and a
>>better power source.

SP said

> If you had actually made any kind of a representative
> prototype you could NOT
> (honestly, anyway) be making the kinds of comments you are
> making.

SP - I KNOW that you are not a stirrer, waver of wet fish
or general abuser of newbies and that you provide valued and
useful advice. So I understand that that statement is made
in good faith and that there is liable to be things to learn
from it. But I'd like to suggest most gently that a
statement like that may quite unintentionally cause some
unintended grief. If in fact a prototype has been built as
stated but eg power and longevity issues have not been well
addressed then it may meet his claims while failing to meet
proper design standards. If he is now trying to "bring it
formally into the fold" then the comment may be
unintentionally rather discouraging.

So, if the comment got a just very slightly rough response
then a gentle subsequent reply may be appropriate. [[Who me?
Prescient? - no such luck, alas]].

> My prototype works, and it works great. Sure, the PIC chip burns out in
> it after about a week, but other than that it's OK. So this time around
> I'm keeping an eye on the current limits so that it will run forever.

Oh sorry I missed that you already breadboarded it. So what is the current
do you measure in the Vdd pin when you switch on all the LEDs and when all
of them are turned off? And current and voltage do you measure in different
scenarios? (one LED is turned on, all of them, and if you experience on
current or voltage drop at how many LEDs can you use together without this
drop?)

Also if you apply different current limiters how does it change the
viability of the LEDs? Now you can play a lot to get answers to may of your
questions as you have your prototype.

>
>
> Spehro Pefhany wrote:
> > If you had actually made any kind of a representative prototype you could
> NOT
> > (honestly, anyway) be making the kinds of comments you are making.
>
>
> Way to blanket-bomb my entire project with a generic, ambiguous
> accusation. If you want to be more specific I'll be more than happy to
> answer the accusations.
>
> My prototype works, and it works great. Sure, the PIC chip burns out in
> it after about a week, but other than that it's OK. So this time around
> I'm keeping an eye on the current limits so that it will run forever.
>

>My prototype works, and it works great. Sure, the PIC chip burns out in
>it after about a week, but other than that it's OK. So this time around
>I'm keeping an eye on the current limits so that it will run forever.

>> My prototype works, and it works great. Sure, the PIC
>> chip burns out in
>> it after about a week, but other than that it's OK.

> That reminds me of job interviews where the boss says "The
> project is
> 99% ready, just a few bugs left, that's where you are
> needed." In most
> cases this is that's the moment to run.

Indeed.
But in this case the chip dying is most liable (but not
certain) to be due to enthusiastic driving. This can be
established quite easily. Adding a simple driver to the
prototype 'just to see' should work well.

> But in this case the chip dying is most liable (but not
> certain) to be due to enthusiastic driving. This can be
> established quite easily. Adding a simple driver to the
> prototype 'just to see' should work well.

If the design allows for the simple addition of a driver. I did not
follow the discussion closely, but if the I/O ports are used
bi-directional (charlieplexing) adding a driver is not easy. That is the
case that most closely corresponds with the software job comparison.

Tamas Rudnai wrote:
> Tomas, this is well explained in the datasheet, but look at this way: Let's
> say you weight exactly 80kg, and you need a bridge over a cliff. The
> architect designs a bridge that is rated for 80kg only, and according to the
> structure and the used material if 80.1 kg is on the bridge it will be more
> than likely to collapse. Would you use that bridge?
>

Just for clarity let me add that this bridge is on Earth where gravity
is 9.81 m s-2 :-P

So the bridge is rated for 80 kg, and it's more than likely to collapse
if you apply 80.1 kg

Things that need to be taken into account:

1) Whether failure is a "brick wall drop" or whether it's "linear". For
instance, this bridge we're talking about, just like the PIC
microcontroller, will have a gradual failure as the current is
increased. To compare this to how the bridge works, let's say the bridge
starts to flex at about 80.02 kg, and begins to sheer at 80.08 kg.

2) The disposition of the manufacturer that gave you those limits. If
the manufacturer is reputable, then the bridge probably won't start to
flex until about 790 N.

If Microchip says 25 mA is the upper limit then we're probably grand up
to about 30 mA or so. On the prototype board for my Connect4, I went
straight from a PIC pin to an LED to ground, without a current-limiting
resistor. I left the device on overnight for three nights in a row and
it didn't fail! For the craic I might cut one of the LED legs out to
definitively measure the current flow. Also note that I had 7 LED's on
at once, so not only was I flouting the "per pin" rule, I also flouted
the "all pins" rule! And it still managed to stay working for 3 nights
in a row!

> If Microchip says 25 mA is the upper limit then we're probably grand up
> to about 30 mA or so. On the prototype board for my Connect4, I went
> straight from a PIC pin to an LED to ground, without a current-limiting
> resistor. I left the device on overnight for three nights in a row and
> it didn't fail! For the craic I might cut one of the LED legs out to
> definitively measure the current flow. Also note that I had 7 LED's on
> at once, so not only was I flouting the "per pin" rule, I also flouted
> the "all pins" rule! And it still managed to stay working for 3 nights
> in a row!

Yes, Tomas, you can run it at whatever current level you feel
comfortable with. That's just fine with all of us. However, if we were
designing it, we apply our own special rules which tend to keep things
below the absolute maximum ratings and probably closer to 8.5mA sink,
3mA source per pin.

But since this is an "eXtreme" product, we suggest you use eXtreme
values!

In other words, I get the feeling you just want everyone to say "go
ahead, great design" and won't give up until you hear that.

Tomás Ó hÉilidhe wrote:
>
> If Microchip says 25 mA is the upper limit then we're probably grand up
> to about 30 mA or so. On the prototype board for my Connect4, I went
> straight from a PIC pin to an LED to ground, without a current-limiting
> resistor. I left the device on overnight for three nights in a row and
> it didn't fail! For the craic I might cut one of the LED legs out to
> definitively measure the current flow. Also note that I had 7 LED's on
> at once, so not only was I flouting the "per pin" rule, I also flouted
> the "all pins" rule!

Wouter van Ooijen wrote:
> That reminds me of job interviews where the boss says "The project is
> 99% ready, just a few bugs left, that's where you are needed." In most
> cases this is that's the moment to run.

The worst consulting scenario is when a unsophisticated customer wants a
gizmo finished that is "80% done", and then expects to pay 20% of what Vinny
(the guy that bailed out on the project) originally thought it would take.
Of course what's really going on is that Vinny was in over his head from the
start. He was picked for the project because his estimate was 1/3 that of
others because he had no clue what he was getting into, and the boss was too
greedy and incompetent to think about why Vinny's estimate was so unusually
low.

Vinny could make is bad design limp along for a while but when he got to 80%
of the boss-visible features, at least one thing broke for every thing he
tried to add. So basically there is no value at all in the existing design
and to proceed a new design must be done, hopefully right this time. But
the boss doesn't want to let go of something he paid for. Unless you're
really desperate, you run a way screaming from a job like this as fast as
you can. Unfortunately these kind of people tend to pop up in bad economic
times.

> > If Microchip says 25 mA is the upper limit
>
> note that they don't guarantee that it's the upper limit
>
> > then we're probably grand up to about 30 mA or so.
>
> for some value of probably
>
> > I left the device on overnight for three nights in a row and
> > it didn't fail!
>
> I don't see what that proves? Except maybe that PICs I/O pins don't
> function particularly well as fuseable links.
>
> > And it still managed to stay working for 3 nights in a row!
>
> so?

Case in point... My Light Recorder artwork uses an unusual "electronic
paper" screen from Kent Displays. One item of note in it's datasheet is
that above 100C (or something similar and low-ish) the screen
self-erases. That datasheet also has instructions for what type of
acrylic to cover it with for UV/thermal protection in outdoor
applications.

"Ahh! Works fine indoors I'm sure! I'll just ignore that bit." says
me... Unfortunately, this weekend was the Toronto *Outdoor* Art show,
and sure enough I have to now convince the guy I sold the artwork too,
and borrowed from for the show, that yes it really will look normal
again in about a week... :)

Tomás Ó hÉilidhe wrote:
> so not only was I flouting the "per pin" rule, I also flouted
> the "all pins" rule! And it still managed to stay working for
> 3 nights in a row!

So you have proven that one PIC at that temperature at that voltage with a
particular mix of dead fish in proximity lasted at least 3 nights. What you
don't seem to get is that this is totally irrelevant information for
designing a high volume product.

> On the prototype board for my Connect4, I went
> straight from a PIC pin to an LED to ground, without a current-limiting
> resistor. I left the device on overnight for three nights in a row and
> it didn't fail! For the craic I might cut one of the LED legs out to
> definitively measure the current flow. Also note that I had 7 LED's on
> at once, so not only was I flouting the "per pin" rule, I also flouted
> the "all pins" rule! And it still managed to stay working for 3 nights
> in a row!

Ah, so obviously this "prototype" was not REMOTELY representative of dozens of
Charlieplexed bipolar LEDs driven directly from port pins, one at a
time, with a 3V Vdd.

> Wouter van Ooijen wrote:
>> That reminds me of job interviews where the boss says "The project is
>> 99% ready, just a few bugs left, that's where you are needed." In most
>> cases this is that's the moment to run.
>
> The worst consulting scenario is when a unsophisticated customer wants a
> gizmo finished that is "80% done", and then expects to pay 20% of what Vinny
> (the guy that bailed out on the project) originally thought it would take.
> Of course what's really going on is that Vinny was in over his head from the
> start. He was picked for the project because his estimate was 1/3 that of
> others because he had no clue what he was getting into, and the boss was too
> greedy and incompetent to think about why Vinny's estimate was so unusually
> low.
>
> Vinny could make is bad design limp along for a while but when he got to 80%
> of the boss-visible features, at least one thing broke for every thing he
> tried to add. So basically there is no value at all in the existing design
> and to proceed a new design must be done, hopefully right this time. But
> the boss doesn't want to let go of something he paid for. Unless you're
> really desperate, you run a way screaming from a job like this as fast as
> you can. Unfortunately these kind of people tend to pop up in bad economic
> times.
>
> Sorry, this is just a long winded way of agreeing with you.

Agree. If you're lucky you can salvage the needs assessment
and few intangibles like that, or maybe they've taken it far enough to
find flaws in the original assessment.

> -----Original Message-----
> From: RemoveMEpiclist-bouncesTakeThisOuTspammit.edu [EraseMEpiclist-bouncesspamspamBeGonemit.edu] On Behalf
> Of Tomás Ó hÉilidhe
> Sent: 14 July 2008 18:44
> To: Microcontroller discussion list - Public.
> Subject: Re: [PIC] OK to operate at the absolute max rating?
>
>
>
>
> Things that need to be taken into account:
>
> 1) Whether failure is a "brick wall drop" or whether it's "linear". For
> instance, this bridge we're talking about, just like the PIC
> microcontroller, will have a gradual failure as the current is
> increased. To compare this to how the bridge works, let's say the bridge
> starts to flex at about 80.02 kg, and begins to sheer at 80.08 kg.

Gradual failure? Either it fails (partially or wholly) or it does not. If you start getting numerous products failing within the warranty period then you get a bad rep and the company selling them get a bad rep, not to mention costing the company money. The more you sell, the worse it gets.

Either design it properly and test it thoroughly, or don't bother. Arguing against the opinions and advice of dozens of engineers that have vastly more experience than you is not going to help you when you are sitting in a pile of burnt out products and an empty bank account because no-one else will touch a design you have made.

Regards

Mike

=======================================================================
This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
person. Please contact us immediately to tell us that you have
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
services.
=======================================================================

> Just for clarity let me add that this bridge is on Earth where gravity
> is 9.81 m s-2 :-P

Does not matter, I was talking about kg not weight ;-)

Anyway, if that bridge doe snot collapse for 3 nights with 80kg of sandbag
on top of it, would you use it?

What everyone trying to tell you is that these things are not matter of
theoretical calculations. As components are physical devices you have to
know that there are far more things have to take into account than you would
probably like to calculate with. If an ant will go on that bridge with the
self resonation of it then it will collapse. Does not matter if it was
designed for 80kg. If one of the labor just made a slight mistake during the
building process then it may take only 70kg. If you continuously use that
bridge for the maximum 80kg then all the bricks and cement and everything
will be overused and the lifetime of that bridge will be degraded to a very
short time. Maybe this example is not perfect but I hope it shows that you
have to thinking in a different way.

>
>
> Tamas Rudnai wrote:
> > Tomas, this is well explained in the datasheet, but look at this way:
> Let's
> > say you weight exactly 80kg, and you need a bridge over a cliff. The
> > architect designs a bridge that is rated for 80kg only, and according to
> the
> > structure and the used material if 80.1 kg is on the bridge it will be
> more
> > than likely to collapse. Would you use that bridge?
> >
>
>
> Just for clarity let me add that this bridge is on Earth where gravity
> is 9.81 m s-2 :-P
>
> So the bridge is rated for 80 kg, and it's more than likely to collapse
> if you apply 80.1 kg
>
> Things that need to be taken into account:
>
> 1) Whether failure is a "brick wall drop" or whether it's "linear". For
> instance, this bridge we're talking about, just like the PIC
> microcontroller, will have a gradual failure as the current is
> increased. To compare this to how the bridge works, let's say the bridge
> starts to flex at about 80.02 kg, and begins to sheer at 80.08 kg.
>
> 2) The disposition of the manufacturer that gave you those limits. If
> the manufacturer is reputable, then the bridge probably won't start to
> flex until about 790 N.
>
> If Microchip says 25 mA is the upper limit then we're probably grand up
> to about 30 mA or so. On the prototype board for my Connect4, I went
> straight from a PIC pin to an LED to ground, without a current-limiting
> resistor. I left the device on overnight for three nights in a row and
> it didn't fail! For the craic I might cut one of the LED legs out to
> definitively measure the current flow. Also note that I had 7 LED's on
> at once, so not only was I flouting the "per pin" rule, I also flouted
> the "all pins" rule! And it still managed to stay working for 3 nights
> in a row!
>

Tomás Ó hÉilidhe wrote:
> so not only was I flouting the "per pin" rule, I also flouted
> the "all pins" rule! And it still managed to stay working for
> 3 nights in a row!

I think (hope) Tomas has by now got the idea that running at or near
'absolute maximums' is *NOT* a good idea. I'm thinking (hoping) that was he
is saying here is "wow - them thar PICs sure are pretty robust, even when
you badly abuse them...

Bob Ammerman wrote:
> I think (hope) Tomas has by now got the idea that running at or near
> 'absolute maximums' is *NOT* a good idea. I'm thinking (hoping) that was he
> is saying here is "wow - them thar PICs sure are pretty robust, even when
> you badly abuse them...

Yes, I've acknowledged that the PIC chip dies after about a week... but
I want it to last forever (or at least until 2020) so I've decided to
shell out on current-limiting resistors.

> Optimize the design when you get to the point where saving 5
> cents per unit makes a difference

Exactly

If sales is the goal, what's needed at this stage is a reasonably (!!!)
well-designed proof-of-concept prototype. In some respects, the
actual circuit is a very minor part of the overall process of getting
a product to market

Yes, I was always amazed how cheap these stuff can be. Once I bought a
Sudoku game with touch screen backlit LCD for 6 euros at Lidl. Chinese stuff
and the LCD was not properly driven from the battery so it was gray instead
of nice and black, but it worked at least. Nice plastic case, pen, even the
package was fairly good.

> > Optimize the design when you get to the point where saving 5
> > cents per unit makes a difference
>
> Exactly
>
> If sales is the goal, what's needed at this stage is a reasonably (!!!)
> well-designed proof-of-concept prototype. In some respects, the
> actual circuit is a very minor part of the overall process of getting
> a product to market
>
> Hasbro already has an electronic Connect 4, which they probably
> pay $5 for. That's the competition product
>

> Bob Ammerman wrote:
>> I think (hope) Tomas has by now got the idea that running
>> at or near
>> 'absolute maximums' is *NOT* a good idea. I'm thinking
>> (hoping) that was he
>> is saying here is "wow - them thar PICs sure are pretty
>> robust, even when
>> you badly abuse them...

> Yes, I've acknowledged that the PIC chip dies after about
> a week... but
> I want it to last forever (or at least until 2020) so I've
> decided to
> shell out on current-limiting resistors.

Current limiting resistors will reduce your currents below
the levels that you sounded like you needed. (You mentioned
25 to 30 mA).

Adding a single driver transistor per line at about $US0.01
each in volume would overcome the problem. Add a few
resistors and you have good design flexibility. Cost and
size are minimal compared to other circuit requirements.

FWIW, for very large volumes COB (chip on board) design will
probably be needed and a very low cost low functionality PIC
(as low as will meet the functionality) would probably be
the end target. What you start with and what you end up with
are liable to be very different.

Apptech wrote:
> Adding a single driver transistor per line at about $US0.01
> each in volume would overcome the problem. Add a few
> resistors and you have good design flexibility. Cost and
> size are minimal compared to other circuit requirements.

Can you suggest a good driver chip? Initially I used a ULN2003, but it
turned out to have too great a voltage drop inside it. Same situation
with the UDN2981.

>
>
> Apptech wrote:
>> Adding a single driver transistor per line at about $US0.01
>> each in volume would overcome the problem. Add a few
>> resistors and you have good design flexibility. Cost and
>> size are minimal compared to other circuit requirements.
>
>
> Can you suggest a good driver chip? Initially I used a ULN2003, but it
> turned out to have too great a voltage drop inside it. Same situation
> with the UDN2981.
>

> Apptech wrote:
>> Adding a single driver transistor per line at about
>> $US0.01
>> each in volume would overcome the problem. Add a few
>> resistors and you have good design flexibility. Cost and
>> size are minimal compared to other circuit requirements.

> Can you suggest a good driver chip? Initially I used a
> ULN2003, but it
> turned out to have too great a voltage drop inside it.
> Same situation
> with the UDN2981.

Not without more information.
An answer with enough detail requires a question with enough
detail.
While I could try to assess from all the prior threads what
is required I could easily fall short.

The spec, based on the recent discussions, seems to be, but
may not be.

30 mA or more.
LED load.
Common cathode connection to ground with anode / + / hi side
drive.
Only 2 channels on at once.
Software high = on drive.
3 V supply.

BUT.
There may be more channels at this or other loads.
Hi or lo drive may be optional (usually so if software is
involved.
LED connections MAY be more flexible.
etc.
IF you can give a really good description of the total
requirement people can avoid the trap of incrementally
answering only parts of what is needed and missing the
synergy of doing it all at once.

FWIW, faced with a 2 channel, 35mA+ 3V, LED cathode grounded
requirement I'd first look at a single high side PNP
transistor with a single base drive resistor from the PIC
pin and a series resistor from collector to LED anode. Or I
may consider a P channel FET and no drive resistor. The cost
approaches zero, the size approaches zero, the LED current
is reasonably definable. Seems like a very good solution at
first glance. Knowing more detail may change my approach.

Note also that there are "digital transistors" available in
SMD that have base resistor inbuilt with variants that also
have abase pulldown to emitter. (A base pulldown (to sink
leakage current) is not needed when the base is actively
driven high or low at all times BUT is needed in good
designs when the base is open circuited when not being
driven on. In such cases, lack of a resistor base to ground
can lead to partial transistor turn on due to base leakage
current.

If I was to use a driver I'd probably first look at
transistor arrays of single transistors (perhaps with base
resistors inbuilt). These are lowish cost do not have the
saturation problems of the eg ULN2803 which uses a two
transistor darlington driver so must have a Von of > 0.6V.
Whether an NPN array would work would depend on whether LED
could be low side driven, which depends on the circuit used.

> Can you suggest a good driver chip? Initially I used a ULN2003, but it
> turned out to have too great a voltage drop inside it. Same situation
> with the UDN2981.

As has been said several time: no driver 'chip' needed. Individual
transistors are far cheaper and probably better than just about any other
alternative.

Also, trying to do a 1:30 multiplex is probably excessive, even with a
transistor drive. You are going to have to punch a ridiculously high current
through for a short period.

For what it is worth, here is how I would design the project....

You have a 6 (row) by 7 (column) by 2 (colors) array of LEDs, but presumably
you never need to light both colors in the same cell.

So I would probably set it up as an array of 12 x 7 or 14 x 6 where, at
most, 6 or 7 LEDs would be powered at the same time.

I also would *not* use bicolor LEDs, they are just _too_ expensive compared
to single color. Instead, I would design some kind of plastic overlay that
would direct the light from one color LED into a X shape, and from the other
color into an O shape around it. This helps get around the color-blind issue
very nicely.

> Also, trying to do a 1:30 multiplex is probably excessive,
> even with a
> transistor drive. You are going to have to punch a
> ridiculously high current
> through for a short period.

Some LEDs allow a very peak : max_continuous current ratio
if suitably low duty cycles are used

BUT

Some LEDs (and, it seems fwiw most phosphor based ones) have
a low peak : max_continuous ratio.

eg a 20 mA continuous rated LED may have a 30 mA absolute
maximum current rating. Trying to multiplex these at 10%
duty cycle AND maintain an average 20 mA current is liable
to result in rapid or even instant LED destruction.

One way out of this MAY be to use multiplexing to store
energy to a drive capacitor associated with the LED but this
may create other multiplexing issues, and energy losses may
be high due to high peak currents. [[ With I^2 R losses,
multiplexing at 1/N duty cycle and increasing peak currents
by N will increase losses N times as energy loss scales as
N^2 for 1/Nth of the time.]]

>>> ... I simply don't read the "absolute maximum ratings" at all. For any
>>> normal design work (except for disaster survival considerations) that
>>> section is irrelevant.
>
> Essentially agree. Knowing what abs max ratings are and ensuring that
> they cannot be exceeded is required only for survival design aspects.
> For operation you look elsewhere.

Right... but aren't "disaster survival considerations" part of "normal
design work"? At least for me, they usually are...

Tomás Ó hÉilidhe wrote:
> Can you suggest a good driver chip? Initially I used a ULN2003, but it
> turned out to have too great a voltage drop inside it. Same situation
> with the UDN2981.

Why does it have to be a chip? Why not a bunch of MMBT4401/4003 or whatever
your favorite jellybean NPN/PNP transistors are?

You also keep ignoring two problems that make this discussion of whether you
can draw 20mA from a PIC pin irrelevant. First 20mA isn't even remotely
close to what you need. Second without some voltage or current regulation
somewhere, the LED brightness will vary hugely over the battery voltage
range.

>> Essentially agree. Knowing what abs max ratings are and
>> ensuring that
>> they cannot be exceeded is required only for survival
>> design aspects.
>> For operation you look elsewhere.

> Right... but aren't "disaster survival considerations"
> part of "normal
> design work"? At least for me, they usually are...
> Gerhard

I can't see how any of us are really disagreeing.

Summary directly from above:

abs max = survival
Operation = elsewhere

And

normal design except for (ie unrelated to) survival <>
abs max.

I think all represented here fully understand the issues and
that any variations are solely semantic.

Yep. All experience engineers design for survival (or
controlled descent into death in very special cases*).
But, operational figurings for loading, slew rates, etc are
usually done inside the doesn't-die umbrella once it is
established.

* eg a telemetry unit is to be used WITHIN a kiln which
reaches a temperature of 300 degrees C within 5 minutes.
Survival of the telemetry unit is unimportant as long as it
correctly telemeters whatever over the 5 minute period.
Special conditions make it necessary for the electronics to
be located within the hot space. Design it ... .
Back of my mind suggests that somebody here had a design
requirement something like that a while ago.

> Tomás Ó hÉilidhe wrote:
>
>> Can you suggest a good driver chip? Initially I used a ULN2003, but it
>> turned out to have too great a voltage drop inside it. Same situation
>> with the UDN2981.
>>
>
> Why does it have to be a chip? Why not a bunch of MMBT4401/4003 or whatever
> your favorite jellybean NPN/PNP transistors are?
>
> You also keep ignoring two problems that make this discussion of whether you
> can draw 20mA from a PIC pin irrelevant. First 20mA isn't even remotely
> close to what you need. Second without some voltage or current regulation
> somewhere, the LED brightness will vary hugely over the battery voltage
> range.
>
>
> ********************************************************************
> Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
> (978) 742-9014. Gold level PIC consultants since 2000.
>

On Tue, Jul 15, 2008 at 09:56:52AM -0400, Olin Lathrop wrote:
> > A GPS unit installed in an artillery shell ...
>
> The Signetics 25120 used to be a great little part for post-mortem data
> logging applications for such weapons systems. I'm pretty sure they are not
> currently in production though.

They are actually, I bought up all the old tooling for them and can
produce them in small quantities along with a wide range of products for
timekeeping applications.

>
> > A GPS unit installed in an artillery shell ...
>
> The Signetics 25120 used to be a great little part for post-mortem data
> logging applications for such weapons systems. I'm pretty sure they are not
> currently in production though.
>
Hardy-har-har...

> Is there any way I can use transistors to both source and sink
> current? Here's what I mean:
>
> Connect D0 to a resistor, then to a "bipolar bicolour LED", then to D1.
>
> When D0 is high and D1 is low, it lights green.
> When D0 is low and D1 is high, it lights red.
>
> How can I do this with transistors?

Sorry I should have been more specific. Of course I can achieve what I
describe above by just getting two FET's, one NPN and one PNP, and
connecting their gates and drains together, but I also need a third state:
If the either D0 or D1 is set as an input, i.e. high resistance,
then neither LED should light.

What I'm afraid of is what will happen if I set the pin that goes to the
gates as high resistance? Will there still be enough current flow to
turn one of the FET's on? As far as I know, I can't use BJT's to do this
because there'll be a current flow between their emitter through their bases.

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Tue, Jul 15, 2008 at 09:56:52AM -0400, Olin Lathrop wrote:
> > > A GPS unit installed in an artillery shell ...
> >
> > The Signetics 25120 used to be a great little part for post-mortem data
> > logging applications for such weapons systems. I'm pretty sure they are not
> > currently in production though.
>
> They are actually, I bought up all the old tooling for them and can
> produce them in small quantities along with a wide range of products for
> timekeeping applications.

Didn't we go through this with another previous thread just a month or
so ago? If I remember correctly you received many suggestions on how
to use transisters and other switching devices to drive high, low, and
high-z (high impedance, or high resistance).

Also found in your email under the tag [EE] with the subject
"Tri-state pin with three functions"

Some apply only to driving a 2 pin bipolar LED, but some describe how
to accomplish what you're asking in this post. You should re-read the
entire thread carefully, there's enough design information in there
that afterwards you should be able to think through this and design
one yourself.

> Tomás Ó hÉilidhe wrote:
>
> > Is there any way I can use transistors to both source and sink
> > current? Here's what I mean:
> >
> > Connect D0 to a resistor, then to a "bipolar bicolour LED", then to D1.
> >
> > When D0 is high and D1 is low, it lights green.
> > When D0 is low and D1 is high, it lights red.
> >
> > How can I do this with transistors?
>
>
> Sorry I should have been more specific. Of course I can achieve what I
> describe above by just getting two FET's, one NPN and one PNP, and
> connecting their gates and drains together, but I also need a third state:
> If the either D0 or D1 is set as an input, i.e. high resistance,
> then neither LED should light.
>
> What I'm afraid of is what will happen if I set the pin that goes to the
> gates as high resistance? Will there still be enough current flow to
> turn one of the FET's on? As far as I know, I can't use BJT's to do this
> because there'll be a current flow between their emitter through their bases.

> Tomás Ó hÉilidhe wrote:
>
> > Is there any way I can use transistors to both source and sink
> > current? Here's what I mean:
> >
> > Connect D0 to a resistor, then to a "bipolar bicolour LED", then to D1.
> >
> > When D0 is high and D1 is low, it lights green.
> > When D0 is low and D1 is high, it lights red.
> >
> > How can I do this with transistors?
>
>
> Sorry I should have been more specific. Of course I can achieve what I
> describe above by just getting two FET's, one NPN and one PNP, and
> connecting their gates and drains together, but I also need a third state:
> If the either D0 or D1 is set as an input, i.e. high resistance,
> then neither LED should light.
>
> What I'm afraid of is what will happen if I set the pin that goes to the
> gates as high resistance? Will there still be enough current flow to
> turn one of the FET's on? As far as I know, I can't use BJT's to do this
> because there'll be a current flow between their emitter through their
> bases.
>
>

Sorry I should have been more specific. Of course I can achieve what I
describe above by just getting two FET's, one NPN and one PNP, and
connecting their gates and drains together, but I also need a third state:
If the either D0 or D1 is set as an input, i.e. high resistance,
then neither LED should light.

What I'm afraid of is what will happen if I set the pin that goes to the
gates as high resistance? Will there still be enough current flow to
turn one of the FET's on? As far as I know, I can't use BJT's to do this
because there'll be a current flow between their emitter through their
bases.

Actually, if you set both the row and the column drivers to the same state
the LED won't be on.

Bob Ammerman wrote:
> Actually, if you set both the row and the column drivers to the same state
> the LED won't be on.

Unfortunately that's a no-goer for my project because some LED's will
have their right-hand-side pin connected together, so there'd be a
current path from the high PIC pin, forward through one of the LED's,
backward through another one of the LED's, to a low PIC pin.

I need to be able to break the circuit by setting a PIC pin as an input.

> and
> connecting their gates and drains together, but I also need a third
> state: If the either D0 or D1 is set as an input, i.e. high
> resistance,
> then neither LED should light.
>
> What I'm afraid of is what will happen if I set the pin that goes to
> the gates as high resistance? Will there still be enough current flow
> to
> turn one of the FET's on? As far as I know, I can't use BJT's to do
> this because there'll be a current flow between their emitter through
> their bases.

So forget about trying to drive two-lead bicolor LEDs with apposing diodes
of the two colors. Common anode or common cathode is easier to drive and
fits nicely with a column and row arrangement multiplexing arrangement. The
other advantage is the duty cycle can be much higher, thereby requiring
lower on current for the same apparent brightness. For N total LEDs, the
duty cycle can approach 1/SQRT(N), whereas with a single LED drive at a time
it can't exceed 1/N.

So have you done your homework yet to see how bright a LED looks at 20mA for
1/50 of the time?

> Bob Ammerman wrote:
>> Actually, if you set both the row and the column drivers to the same
>> state
>> the LED won't be on.
>
> Unfortunately that's a no-goer for my project because some LED's will
> have their right-hand-side pin connected together, so there'd be a
> current path from the high PIC pin, forward through one of the LED's,
> backward through another one of the LED's, to a low PIC pin.
>
> I need to be able to break the circuit by setting a PIC pin as an input.

Actually, 3 LEDs in series would have a Vf probably significantly higher
than your supply. Thus little current would flow.

Tomás Ó hÉilidhe wrote:
> Bob Ammerman wrote:
>> Actually, if you set both the row and the column drivers to the same
>> state the LED won't be on.
>
> Unfortunately that's a no-goer for my project because some LED's will
> have their right-hand-side pin connected together,

So don't do that. You are fixated beyond any reason on the idea of using
two-pin bicolor LEDs.

Tomás Ó hÉilidhe wrote:
> Is there any way I can use transistors to both source and sink
> current?

First, you've asked this before and gotten a lot an answers, then ignored
them and started a bunch of new threads when you didn't hear what you wanted
to hear. Why should anyone believe answering you this time wouldn't be a
waste of time too?

Second, this is the wrong question in the first place because it is built on
faulty assumptions, as has been pointed out a number of times now.

Third, you won't do a few simple things asked of you so that you can learn
some of this for yourself. For example, have you done the LED
current/voltage/brightness homework yet? I didn't think so. So why should
anyone take time to give you free advice if you won't listen and won't do
anything requested of you?

>
>
> Bob Ammerman wrote:
> > Actually, if you set both the row and the column drivers to the same state
> > the LED won't be on.
>
> Unfortunately that's a no-goer for my project because some LED's will
> have their right-hand-side pin connected together, so there'd be a
> current path from the high PIC pin, forward through one of the LED's,
> backward through another one of the LED's, to a low PIC pin.
>
> I need to be able to break the circuit by setting a PIC pin as an input.

> What's the matrix like and how's it connected to the PIC at present?
> I've forgotten if you ever posted a schematic but it would be useful as
> a reminder to see what you're working with.

You don't remember of the L shaped PIC? There were far too many topics
opened by Tomas of this very same subject, and that's why it is f...f...full
hard to follow up. Anyway, as far as I concern there is no matrix or
watsoever, 1pin->1LED (actually 2 LEDs with the bipolar bicolour ones).

> What's the matrix like and how's it connected to the PIC at present?
> I've forgotten if you ever posted a schematic but it would be useful as
> a reminder to see what you're working with.
>
> -Bob
>
>
> On Tue, 15 Jul 2008 19:41:24 +0100, "Tomás Ó hÉilidhe" <spamBeGonetoe@spam@spam_OUTlavabit.com>
> said:
> >
> >
> > Bob Ammerman wrote:
> > > Actually, if you set both the row and the column drivers to the same
> state
> > > the LED won't be on.
> >
> > Unfortunately that's a no-goer for my project because some LED's will
> > have their right-hand-side pin connected together, so there'd be a
> > current path from the high PIC pin, forward through one of the LED's,
> > backward through another one of the LED's, to a low PIC pin.
> >
> > I need to be able to break the circuit by setting a PIC pin as an input.
>
> --
> http://www.fastmail.fm - mmm... Fastmail...
>
>

On Thu, Jul 17, 2008 at 04:29:51PM +0100, TomÃ¡s Ã“ hÃ‰ilidhe wrote:
> Tamas Rudnai wrote:
> > FET does not need current, it needs only voltage. That's the beauty of it.
> >
> > Tamas
>
> That's impossible, is it not? For something to "do something", energy
> must be expended. There's no energy expenditure in just having a
> voltage "sit there" -- there must be current.

The "something" that is done is to *change* the *state* of the FET, IE
to turn it from non-conducting to conducting.

Take the example of a switch, is there energy expenditure in leaving the
switch in one state or another? No, the expenditure is in changing that
switches position.

At the physical level a FET has a small parasitic capacitance associated
with it, and a corresponding gate charge that needs to be either applied
or removed from the junction. That's why CMOS logic, which exclusively
uses FET gates in it, has a power consumption that increases as the
switching rate increases.

> FET's might draw very little current, but I don't see how they could
> possibly get away with drawing no current whatsoever.
>
> Let's say you take 5 volts, put it through a 15 megaohm resistor and
> then into the gate of a FET. Will it turn on? Emm... I don't know I
> haven't got any FET's to try it out on.

It will, it might take a bit for that gate charge to flow through the
resistor, but it will.

EEPROM memory is essentially a big bank of FET's with floating gates.
That charge I mentioned before is present on the gate, or not present,
and will take hundreds of years to dissipate, an *extremely* high
resistance.

Tomás Ó hÉilidhe wrote:
> Tamas Rudnai wrote:
>
>> FET does not need current, it needs only voltage. That's the beauty of it.
>>
>> Tamas
>>
>
> That's impossible, is it not? For something to "do something", energy
> must be expended. There's no energy expenditure in just having a
> voltage "sit there" -- there must be current.
>
> FET's might draw very little current, but I don't see how they could
> possibly get away with drawing no current whatsoever.
>
> Let's say you take 5 volts, put it through a 15 megaohm resistor and
> then into the gate of a FET. Will it turn on? Emm... I don't know I
> haven't got any FET's to try it out on.
>
>
Uhm.... there is a current, but it is very small, and very brief. The
gate on a FET behaves like a (very small) capacitor.... you 'charge' and
'discharge' it to toggle the FET.

But, for the most part, unless you are doing high-frequency switching
(more than some MHz), then there is no effective current in a MOSFET gate.

>
>
> Tamas Rudnai wrote:
> > FET does not need current, it needs only voltage. That's the beauty of
> it.
> >
> > Tamas
>
> That's impossible, is it not? For something to "do something", energy
> must be expended. There's no energy expenditure in just having a
> voltage "sit there" -- there must be current.
>
> FET's might draw very little current, but I don't see how they could
> possibly get away with drawing no current whatsoever.
>
> Let's say you take 5 volts, put it through a 15 megaohm resistor and
> then into the gate of a FET. Will it turn on? Emm... I don't know I
> haven't got any FET's to try it out on.
>

>Tamas Rudnai wrote:
>> FET does not need current, it needs only voltage. That's the beauty of
>> it.
>>
>> Tamas
>
>That's impossible, is it not? For something to "do something",
>energy must be expended. There's no energy expenditure in just
>having a voltage "sit there" -- there must be current.
>
>FET's might draw very little current, but I don't see how they
>could possibly get away with drawing no current whatsoever.

Well, it depends on how you look at it. The gate connection draws
essentially zero current while it is held at a fixed voltage relative to the
source (assuming it is being operated within the operating conditions on the
datasheet. If used at the maximum rating then significant current draw may
occur because the protection diodes will conduct.). The only current draw
will be the leakage current of the gate.

It is the level of voltage on the gate that determines how 'turned on' the
gate-drain connection is. Check a datasheet for a FET device for further
details.

This is different to a bipolar transistor where the current through the
base-emitter junction determines the current through the emitter-collector
junction. Again check a suitable datasheet to see how this is specified.

>Let's say you take 5 volts, put it through a 15 megaohm resistor and
>then into the gate of a FET. Will it turn on? Emm... I don't know I
>haven't got any FET's to try it out on.

Yes it will. However - and here is BUT portion - if the FET is turned off
before you start, so both ends of the 15 Mohm resistor are at 0V, then you
apply a step voltage change to the input end of the resistor, the FET will
not instantly turn on because of the time constant of the resistor and the
gate-source capacitance of the FET. So for a time determined by this time
constant current will flow through the resistor into the capacitor, but once
that capacitor is charged there will be no more current flow - apart from
the leakage current, and with a resistor of that value even a small leakage
current may be enough to drop a significant voltage across the resistor.

This effect does create problems with power FET devices. You will often see
in the datasheet a spec for driving the gate capacitance, which gives a
value in coulombs. To deal with the large gate capacitance these devices
have the drive circuit can be required to source or sink significant current
(in the order of several amps) to make the transistor switch fast enough
that it does not spend significant time in the linear region - where it gets
hot. But dealing with this type of transistor is very different to what you
require for your LED drive.

Tomás Ó hÉilidhe wrote:
> FET's might draw very little current, but I don't see how they could
> possibly get away with drawing no current whatsoever.

Think of it this way: It takes energy to turn the valve on your water
spigot, but once you have it at the desired setting no further energy is
required to keep it there, and it continues to regulate the water flow
whether that is on, off, or someplace in between.

A FET gate mostly looks like a capacitor, so there is a little energy
required to change its voltage. But once the desired gate voltage has been
reached, it requires no additional inherent energy. There is a little
capacitive coupling from other places, like the drain in particular, that
you have to overcome, and there is a little leakage mostly thru the dirt
between the FET leads, but other than that a FET gate doesn't require any
energy input to maintain its setting. Flash memory works on this principle.

I have seen MUCH worse designs than the PICKIT2 from Microchip. There
are some appalling
appnotes still in Microchip's inventory.

Personally, I always use some form of spike protection on open,
exposed conductors like this, to prevent damage. I use higher-voltage
devices on sensitive circuits like PGD and PGC, because the
low-voltage ones add a lot of capacitance to the pin.

You need to always assume that Microchip is primarily in the business
to sell CHIPS, not test equipment, or prototype circuits.

REMEMBER: YOU are the engineer, and if you design in a hazard, YOU
will be sued, not Microchip (or anybody else, for that matter).

> Actually it is interesting that the PicKit2 design exploits the behaviour
> of
> the output fet, so that only a 10 ohm resistor is used for a current
> limiter
> for the ICSPDAT and ICSPCLK lines. So that the current is too huge to be
> able to drive the output therefore the voltage level will be dropped (as
> described in the datasheet). Personally I do not like such exploitations,
> it
> is just interesting to see that at Microchip they design circuits like
> this.
>
> Tamas
>
>
> On Mon, Jul 14, 2008 at 8:13 AM, Wouter van Ooijen <@spam@wouterRemoveMEEraseMEvoti.nl> wrote:
>
>> Forrest W. Christian wrote:
>> > I was curious too, since I use the '886 I figured I'd take a look...
>> > It says in section 17.0, 25mA each I/O pin, or 90mA total.
>>
>> I know that figure is in that section, but where does it say that you
>> can draw that amount of current and expect the chip to work?
>>
>> Section 17.0 is the absolute maximum ratings section. Nobody knows what
>> that section is for (the standard that describes what "absolute maxima"
>> is supposed to mean is not freely available), but it is certainly *not*
>> for designing the operational state of a circuit.
>>
>> (Ok, I have some idea what that section it might be for: there are
>> (short) circumstances, like a nearby lightning strike or a nuclear
>> event, where you want to know what currents or voltages your chip can
>> survive and be expected to work lateron.)
>>
>> --
>>
>> Wouter van Ooijen
>>
>> -- -------------------------------------------
>> Van Ooijen Technische Informatica: http://www.voti.nl
>> consultancy, development, PICmicro products
>> docent Hogeschool van Utrecht: http://www.voti.nl/hvu
>>