LED and Resister arrengement

Discussion in 'Embedded Systems and Microcontrollers' started by Vagish, Apr 1, 2013.

  1. Vagish

    Thread Starter New Member

    Apr 1, 2013
    1
    0
    Where should I connect the current limiting resister--At the cathode or at the anode of LED,when
    1)LED is connected in pulled up fashion and uC is sinking current.
    2)LED is connected in pulled down fashion and uC is sourcing current.
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    The series resistor can go on either side of the LED.
     
    Vagish likes this.
  3. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    Actually, this is one of the infrequent times that the answer is yes.
     
    Vagish likes this.
  4. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    "Yes" to which question?
     
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    All of them.
     
  6. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,804
    Hmmmm.

    If the answer is "yes" to all of them, then what are all the possible circuits that could be formed and would any of them actually work? :p

    My guess is that it would become one them them, "depends on what the definition of 'is' is" situations.
     
  7. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,016
    If the mcu is sourcing current and can't source more than what the LED is rated then there is no real need for a current limiting resistor.
     
  8. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,804
    I wouldn't recommend that approach unless there was a compelling reason.

    First, the maximum current rating for the port is a merely a guarantee that it can supply at least that much. There is no spec on how much more it might be able to source.

    Second, the actual amount it can source is going to vary with lots of things, including temperature, supply voltage, total supply current for the chip, how old the part is, exactly which pin is being used, how many other pins are also in a current-limiting mode, and on, and on.
     
  9. JohnInTX

    Moderator

    Jun 26, 2012
    2,348
    1,029
    It will also make r-m-w I/O operations (bsf, bcf etc) on midrange/baseline PICs problematic.
     
  10. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,804
    Because the actual pad voltage is being read and not a buffered copy of the output port contents?

    Good point.
     
  11. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    Here it depends on what "can't" means.

    One meaning is the pin has a maximum current it can safely deliver. In this case a resistor is required to limit current below this value.

    Another possible meaning is the pin has a maximum current limit to the amount of current it can supply. If that limit is below what the LED is rated then no resistor is required.

    Every device I have ever worked with has been spec'ed with the first definition. I am unaware of any device with a current limited output pin.
     
  12. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,804
    The usual definition is that it is the maximum current that the device is guaranteed to be able to deliver and that it can do so and still be guaranteed to operate within spec. For instance, when a digital output says it can source a maximum of 20mA when outputing a HI, that means that as long as you don't pull more than 20mA from it that the voltage at the output will remain above V_OHL over the entire range of operating conditions that is spec'ed. Any given part will usually supply noticeably more than that while maintaining the spec'ed voltage and quite a bit more still before it truly maxes out.
     
Loading...