> Can any of you figure this one out? I have a PIC16F628-based circuit using 2 > multiplexed switches like this... > .__________. > | 16F628 | > | | > | RB0 |---------o-------------| MOSFET 1 gate > | | | > | RB1 |---------|-------o-----| MOSFET 2 gate > | | | | > | RA5 | | | > '----------' | | > | |/ o | > | A>--'\/\/\,--| NPN |] Pushbutton N.O. > | R1 |\> o | > | | | > | | | > | (D) | > | | | > | | | > `-----------------o--|<|--' > | 1N4148 > ,--'\/\/\,--' > | R2 > GNDb > Port B is all outputs, and RA5 is an input. The point at (D) is just a direct > connection for now. R2 is a 10K pull-down resistor. Only one output on port > B will be High at any time, with the rest Low. When either RB0 or RB1 is > high, the input value at RA5 is read to determine the state of the > corresponding switch. Well, it works properly. > Oddly, I have another circuit, which is identical with respect to this portion > of the circuit, but it does NOT work properly. When point A is connected to > +5V, the transistor switches on, and is properly detected, but the pushbutton > cannot be detected until the transistor is switched off. However, the > circuit will function properly with another diode added at point D (banded > end away from the transistor). > In the second circuit, I would think that the emitter serves/acts as a diode > when the transistor is on, so that another diode at the emitter is not > required. I do realize that the proper diode behaviour is achieved in the > B-E junction of the transistor, but thought that the C-E junction is somewhat > unidirectional as well. > I've re-checked the initialization and usage code, but cannot see any > difference in this portion of the circuit. Any idea why this additional > diode is required in the second circuit? > Thanks, > -Neil. Whenever I have driven the emitter of a transistor, I have always had to watch out for breakdown of the base-emitter junction. This can happen with a reverse BE voltage as low as 3 volts in some transistors. The actual voltage varies from one transistor to another, which may be why one of your circuits works and the other doesn't. Putting a diode in series with the emitter blocks the reverse voltage causing the breakdown. /\/\/\--||--/\/\/\--||--/\/\/\--||--/\/\/\--||--/\/\/\--||--/\/\/\--||-- POWER TECHNOLOGIES John N. Power PMB 387 ELECTRICAL ENGINEER 9613C Harford Road (410) 882-7654 Baltimore, Maryland 21234 EMAIL: jpower@bcpl.net WWW: http://www.bcpl.net/~jpower/powertech.html -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.