10

From the datasheet, I though the AT90S1200 had current-limited pins and when running at 5V would sink the proper amount of current through a green LED attached to + (0 turns on the LED, 1 turns it off) without any external resistors. Unfortunately when I attached 8 of them the IC burned out after a few minutes. I also have a dodgy solderless breadboard and may have otherwise shorted out the part.

What did I misunderstand about that datasheet?

joeforker
  • 5,596
  • 10
  • 38
  • 59
  • 1
    Where did you read that in the data sheet? I can't find it. – starblue Dec 30 '09 at 15:49
  • 1
    I found it, @starblue. Page 29, Port B: "All port pins have individually selectable pull-up resistors. The Port B output buffers can sink 20 mA and thus drive LED displays directly." @joeforker, are you sure you have your circuit wired correctly and the code properly set up for this use? Would you mind posting a schematic and your code for review? – Lou Dec 30 '09 at 16:10
  • 10
    The statement on Page 29 doesn't imply current regulating behavior. It states that there is sufficient sink current to drive an LED meaning an external buffer is not required for currents of 20mA or less. You still need to limit currents if your design is capable of sinking currents higher than 20mA. – jluciani Dec 30 '09 at 19:02
  • 3
    Can "drive LED displays directly" means there's enough juice available to drive a led without a switch/transistor/buffer/driver. Enough to burn most types, too. Also, I think all AVR's have push-pull outputs that you can switch to weak pullups or completely open drain by fiddling with a couple of port registers. It does indeed need some setup and isn't related to LEDs (think I2C). – XTL Jun 28 '10 at 00:19

4 Answers4

8

From the data sheet

DC Current per I/O Pin ............................................... 40.0 mA

DC Current VCC and GND Pins................................ 200.0 mA

Now each led will be over driven at 40mA (as there is no current limiting resistor) - enough to shorten the life of the led but otherwise not too bad. However running 8 leds will draw a total of 320mA from the microcontroller - together with any current it itself requires to run (depends on clock speed). This is enough to greatly exceed the 200mA total allowed, hence your burned out chip.

JohnC
  • 4,779
  • 3
  • 25
  • 20
  • 5
    I suppose it means "don't do that" rather than "the chip will make sure no more than 40 mA passes through an I/O pin". – joeforker Dec 30 '09 at 16:11
  • 6
    Those are Absolute Maximum Ratings, not current-limiting functions of the chip. From the datasheet, "Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent damage to the device." I'm pretty sure those pins will allow you to pull as much current as inherent resistances will allow and it will not stop at 40 mA. Actually, on review of the datasheet, I DID find a reference to current-regulating behavior (Page 29, Port B). Still, I don't think a pin not configured this way will stop at 40mA. Either way, though, I think I'd just use the resistor. – Lou Dec 30 '09 at 16:12
  • 1
    Further reading reveals a 100mA limit for a single port. – joeforker Dec 30 '09 at 16:16
  • 2
    As Lou mentioned there is no current limiting function. Also Note 3 on page 49 states that "Pins are not guaranteed to sink more than the listed test condition." The listed test conditions for IOL are 20mA for Vcc of 5V and 10mA for Vcc or 3V. – jluciani Dec 30 '09 at 18:37
6

It's fine to attach LEDs to your micro without current limiting resistors as long as you don't mind spending money on replacing the micro every once in a while. You will continue to break them if you just hook up LEDs.

Chip manufacturers put current limits on their output pins so you don't burn up the part or make it drift from all the heating that will result from pulling so much (relative) power through it. Resistors are very cheap and I can't think of a situation that would make sense not to put one in line with the LEDs.

Chris Gammell
  • 1,541
  • 1
  • 12
  • 25
  • 1
    yes, and note that these are current limits on their *specification*, not necessarily or usually current limits built into the part, so if you go outside the limits they make no claims as to the survival or function of the part. – Jason S Dec 31 '09 at 13:17
  • Once, I was using a PIC16F887 and 6 LEDs with no resistors. It acted so weird. Some of the LEDs were shiny some of them were dim some of them were normal. And the brightness of them were changing when I was driving the LCD. The problem was solved as soon as I added current limiting resistors. Well I had to solder them directly on the legs of the LEDs. That thought me something, though :) – abdullah kahraman Jan 17 '12 at 08:40
3

I have not looked in a while but you may be able to get LEDs with internal current limiting resistors.

Daniel Grillo
  • 7,659
  • 18
  • 51
  • 69
jluciani
  • 11,646
  • 1
  • 34
  • 54
3

They did not build a current limiting function into the chip, however they are CMOS drivers, and by their nature increase their resistance the warmer they get, so they will generally safely self-limit on a per-port basis (although you could end up driving more than 20mA through a given LED, which might exceed the LED's rating) as long as you keep the voltage low (ie, each port doesn't have to drop more than a volt or two above the diode).

But the supply lines internal to the chip cannot handle all 8 lines being maxed out.

It's not ideal to do this, as you are stressing the part, but if you really want to drive an LED without the resistor, as long as you don't exceed the aggregate current, you are ok.

However, you can get around this by running the LEDs in a PWM manner. Only drive one LED at a time, but sequence through them quickly enough that they appear constantly on to humans, even though you're actually blinking them at 30+ times per second individually.

Still, resistors are cheap, so unless you have a great reason to drive them directly with no current limiting, it's best to design the circuit so that both the microcontroller and the LEDs are operating within their design limits.

Adam Davis
  • 20,339
  • 7
  • 59
  • 95