On Fri, Apr 23, 2004 at 09:48:21AM -0400, Spehro Pefhany wrote: > At 01:49 PM 4/23/2004 +0100, you wrote: > > > >But note the limitations of this method which were explained in the [EE:] > >tagged thread. This will draw extra current all the time, and your LED > >must > >have a forward voltage of less thasn 2.5volts (immediately ruling out > >blue/white/purple LED's). > > It's pretty marginal with the typical red/green LED as well. As the sum > of the two Vf's approaches the power supply voltage, the "extra current" > approaches infinity as does the sensitivity to small changes in the power > supply voltage (and on resistance of the PIC port). > > Example, the sum of Vf's at 10mA for HE red and GaP green is 4.1V > typical at 10mA, 5.1V maximum at 20mA. > > If the OP wants to try it out for a hobby application, try around 200/240 > ohms in series or 100/110 ohms in series. > > Best regards, OK so let's rethink the problem. I think my posting on using an opamp made it to the list. It should be possible to configure an opamp as a inverting comparator that's close to rail to rail. Let's start with the opamp mantra: The output tries it very best to equalize the voltages on the + and - inputs. OK. Since we want to invert the output we need a situation where the output will drive low when an input is high and vice-versa. We use the game plan of putting one input at 2.5V using 47-100k voltage divider and using the PIC output to swing the other terminal. In fact if we wanted to we could use a dual opamp like a 1458 and drive the two LED terminals, one positive and one negative. But back to the issue. To drive the opamp output low the + terminal needs to negative in reference to the - terminal. So that means we can either ground the + terminal and have the - @ 2.5V or have the + terminal @ 2.5V and make the - terminal high (+5V). To drive the opamp output high the + terminal needs to positive in reference to the - terminal. So that means we can either ground the - terminal and have the + @ 2.5V or have the - terminal @ 2.5V and make the + terminal high (+5V). One last thing is that the PIC output needs to be the opposite polarity of the opamp output. So in the first instance the PIC output is high and in the second the PIC output is low. So we have a winner. The + terminal needs to be 2.5V with the divider and the PIC output connected to the - terminal. That way the opamp drives low when the PIC output is high and vice-versa. A inverting comparator. Hope this helps, 2 resistors and a 8 pin package opamp/comparator will do the trick. BAJ -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.