At 05:52 PM 10/31/00 -0800, David Covick wrote: >Evan, > >With 5 I/O's you can turn on and off 20 LED's with a PIC. >With out getting into specifics, 5 I/O's will do 10 LED's back to back. >With some fancy wiring the other 10 can be added in. >One resistor "can" set the current an all LED's in a simple arrangement. Umm... I mostly agree with you - but it takes *5* resistors, not just 1 to control the current in all the LEDs. The other problem is that LED current is fairly low because you have to multiplex them - no more than 4 or 5 mA average if you don't want to exceed the current rating on the pin. But that particular problem is easily fixed with the addition of 5 driver transistors as follows: You have several (4 or more) driver circuits driving a LED matrix. The resistor is the current limit when the PIC output is LO. The transistor provides current gain so that multiple LEDs can be turned on when its PIC output is HI. Unlit LEDs have the PIC output tristated during that portion of the scan cycle. Yes, the resistor also serves to keep the transistor turned off when it is supposed to be off. But you size the resistor according to the desired LED current. 4 drivers will control 12 LEDs. Up to 3 LEDs can be lit during each step of the scan. 5 drivers will control 20 LEDs, with up to 4 LEDs being lit during each part of the scan. The transistors allow the number of scan steps to be held to the number of driver stages without compromising LED brightness. O +Vdd (can be unregulated supply so long as it is >= Vdd) | / |/ PIC o--+---| NPN driver (2n4401 or similar) | |V | \ | | +-VVV--+-----o Matrix point R So how about it, Evan. David's suggestion is a good one. Do you have 5 available i/o pins? That will give you your 16 (up to 20) LEDs - cost is 5 resistors if you can live with only 4-5 mA LED current; add the 5 transistors and you can get the LED current up to 15 or 20 mA. dwayne Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax Celebrating 16 years of Engineering Innovation (1984 - 2000) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Do NOT send unsolicited commercial email to this email address. This message neither grants consent to receive unsolicited commercial email nor is intended to solicit commercial email. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.