| ??? 02/09/04 15:27 Read: times |
#64300 - RE: Michel Responding to: ???'s previous message |
I don't like to use PNP transistors because you can't guarantee that the high of the port pin is 5v, so if it was 3.0 volts you get voltage drop which causes leakage current to go into the base of PNP transistor through the 10k resistor causing a disaster.
Dear Mahmood, first, Michael is total right in what he said. Ok, let's construct a situation where this transistor is erroneously turned-on: To turn-on PNP transistor a current must flow from emitter to base. And this current must flow INTO microcontroller, right? Because the internal pull-ups pFET1, pFET2 and pFET3 are current sources, it's impossible for the base current to flow through them. The only way is to flow across nFET, which is switched-on, when emitting low state. But this FET is turned-off in discussed situation. Leakage current flowing through this FET is less than about 10µA. I we now assume, that this leakage current is not already delivered by internal pull-up FETs (pFET3 or at least pFET2), but must totally flow through driver stage (as it is the case, when connecting the circuitry to a Port 0 pin), then nevertheless this current cannot turn-on the PNP transistor if there is a suited resistance across base and emitter. If this resistor has 10kOhm e.g., and if we again assume that leakage current is totally flowing through this resistor (not mentioning, that then there is no current for the base emitter junction any more!) then 10µA would only cause a voltage drop of 10µA x 10kOhm = 0.1V. But with base emitter voltage of only 0.1V you never get this transistor turned-on, not even partially! But even if this base emitter resistor is not present, it's hard to turn-on the PNP a bit. If 10µA are flowing through base emitter junction, and this PNP transistor is assumed to have a very high current gain of 500, then only 10µA x 500 = 5mA could flow through collector load. But in our case with 12V relay, showing DC resistance of 330Ohm, 5mA would only cause a voltage drop across relay coil of 5mA x 330Ohm = 1.65V. Much to small to turn-on the relay. With Port 1,2,3 situation is much less critical: Because always at least pFET2 is turned-on, nearly all the leakage current through nFET is delivered by him and finally there's no way for any erroneous base current. I use always this base emitter resistor, even if it is not explicitely needed, and choose a value of <=10kOhm, exactly like Michael showed in his schematics. If there's no need for high base currents I choose again 10kOhm for the resistor which is connected from base to port pin. Bye, Kai |



