>It should be fairly obvious why the circuit dosen't work as you >expect: With 5 volts applied to the base of the transistor, a current >will be flowing out of the emitter irrespective of the voltage on >the collector. A further potential problem is that with RB0 driven >low, the BC junction will be forward biased. This application >either wants a mosfet or a PNP bipolar configured as a common emitter >circuit rather than an emitter follower (which then inverts the switch >polarity). By putting an extra diode at point (D), you are reducing >the voltage by 0.6 volts which is obviously enough to fall below the >logic threshold of the PIC. You could also just lower the value of >R2 to acheive the same effect. Not sure that lowering the value of R2 will have the desired effect. However we are not told the ratio of R1:R2 which will have an effect, and I suspect is why the second example does not work as expected. Having the BC junction forward biased when RB0 is driven low is an inherent part of the circuit design IMHO, and if this did not happen then the circuit would never work at all, as then there is no way to pull the R1/base junction down to a low voltage to allow detection of the other switch's true state. The base-emitter junction does the same job as the diode in series with the switch. I suspect the reason the second example does not work is that R1 is a much lower resistance than in the first example. Personally I would prefer to see R2 a little higher in value (probably around 33k), and R1:R2 in the region of 1:10, so R1 is then around 3.3k to 4.7k. This will then allow the voltage to pull up to above the RA input threshold when RB0 is high, but allow RB0 to pull right down to ground without going into current saturation. I suspect the faulty unit has R1 around 100 ohms or so and is then causing RB0 to go into current saturation which means it will be pulling down to about 3 to 4 V, leaving the RA input above the high threshold. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.