At 05:20 PM 3/13/2004 +0000, you wrote: >Hi, > >I'm new to PIC (and electronics really) and I've been reading >through John Morton's book 'PIC Your Personal Introductory Course'. >It's really helping me to learn PIC programming, but I do have a >question from one of the example circuits in the book. > >The circuit in question (fig. 2.22 page 62 for anyone with the book >following along) has four 7-segment LED displays. The seven led >anode pins of each display are connected to RB1-RB7 via a resistor, >and then the common cathode pin of each display is connected via a >transistor to RA0-RA3, again by a resistor. All fine so far. So I >set a cathode pin high to select which display I want to light up, >and then set the RB pins for that display. The book then suggests >that I cycle round all the displays very quickly in order to keep >them lit up, again fine. > >OK, so the book suggests that I need to give each of the LEDs 10mA >to light it up properly and given that I am cycling through each >display in turn, each one is only going to get a quarter of the >time and therefore I should quadruple that amount to 40mA for the >short burst. Therefore the book calculates an 82R resistor to be >used on each of the LEDs. Now, my question is that whilst none of >the LEDs will get a sustained 40mA current, surely if I'm cycling >through all the displays and they all have the same number on them, >then some of the pins on the PIC will be having 40mA drawn through >them? (cycling through the four displays, lighting up the same >segment, drawing 40mA each time and thus sustained pretty much) And >isn't that too much for the PIC? Yes, you're quite correct. Hobby books often contain circuits that should not see the light of day. Check out the limit per port as well. Either way, you're limited to 25mA. Note that these are absolute maximum numbers, not recommended operating conditions. Still doesn't mean that they are guaranteed to damage the PIC, of course, and PIC pins get shorted all the time and nothing much bad happens (usually). But shipping a product like that, which is expected to l ast a long time and might see high ambient temperatures would not be prudent. The answer is either to use a lower average current (perhaps upgrading the display to something that give more mcd/ma) or add some drivers. In the case of the CC displays, you could add an octal source driver to drive the segments. Source drivers are generally more expensive and drop more voltage than sink drivers, however. A compromise is to switch to efficient common-anode displays, and drive the segments directly by sinking current (the PIC outputs are better at sinking than sourcing, though it's not reflected in the ratings in an obvious way). Here's the ones we use: http://www.trexon.com/leds/trexon_led_display.pdf They are decently bright at 1-2 mA average per segment, which is well within the ratings of the PIC (6mA/segment average abs. max). If you need super brightness, then a cheap ULN2803 will switch the segments and you can go up to much higher currents per segment (maybe 20-25mA average- daylight visible with the right filter). Best regards, Spehro Pefhany --"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics