pic output port

hi all,

i want to turn on an npn switching transistor from an output port of a pic

16F84. my question is do i need a resistor between the npns' base and the port of the pic or can i turn it on directly?

thanks in advance for help

tony

Reply to
Tony
Loading thread data ...

You need a resistor to limit the current into the base.

Leon

Reply to
Leon Heller

And you ought also to have one between its base and ground to make sure it turns off cleanly.

Ian

Reply to
Ian Bell

Hi, you need a base resistor, 470R will do.

Reply to
CBarn24050

sure it

I don't think this should be necessary with a PIC. When an output pin is driven low, it's really low. ;-)

Reply to
Anthony Fremont

Unless it is not yet initialized as output.

Rene

--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com
& commercial newsgroups - http://www.talkto.net
Reply to
Rene Tschaggelar

In addition to what the other posters said, you _can_ omit the base resistor if (and only if) you configure the port as having "weak pullups" and switch the port with the TRIS bit.

TRIS bit set means input = pullup to Vcc = NPN will be on TRIS bit clear AND PORT bit clear means "output low", NPN will be off.

But take care you always have a 0 in the corresponding PORT output latch!

HTH Wolfgang

Reply to
Wolfgang Mahringer

Tony, if you place the load between the emitter and ground you may be able to eliminate the current limiting resistor between the output pin on the pic and the emitter on the transistor. -- Mike

Reply to
Mike Turco

Not when it is in Hi-Z state. Like during a "reset" and any other time when your program isn't fully initialized.

Reply to
Guillaume

Rather than use rule-of-thumb values, why not do the eng>..you _can_ omit the base

That is a neat trick, but only if the load current is small enough so that the weak pullup current times the hFE of the transistor is more than that load current.

-Robert Scott Ypsilanti, Michigan (Reply through newsgroups, not by direct e-mail, as automatic reply address is fake.)

Reply to
Robert Scott

I guess that depends on the beta of the transistor and the resistance/impedance of the load, no? I would think that a transistor with a beta of fifty, for example, couldn't drive much of a load with a 22k resistor.

How does one calculate the base current required to saturate an NPN transistor, such as in the subject circuit?

Before or after?

Mike

Reply to
Mike Turco

The datasheet will usually have graphs of emitter current versus base current for various voltages. You can then size the resistor to get the base current appropriate for the capability of the driver or the amount of current you want to run through the device. I have found mosfets to be better for most applications controlled by a microcontroller. The cost difference is less than it used to be. The switching current is less and the holding current is almost nil. However, I still use bipolars in applications where I want to block current in both directions or linmit the maximum current in the controlled circuit.

Reply to
Gary Reichlinger

output

When he put 1k in parallel with the 4k7, it didn't work anymore. The transistor was a BC547B, driving a low power relay. After removing the 1k, it worked perfectly.

Meindert

Reply to
Meindert Sprang

But doesn't a port pin's weak pullup get disconnected whenever that pin is made OUTput? Seems to me I read it in the spec. sheet. Not positive though. If true, the pin ... and the xstr's base ... will float.

Reply to
Michael

pic

the

latch!

Output pins never float! It will only float if you make it an INput without a pullup. One warning about using this trick is that the pullup may be too weak to switch fast. But if you're not worried about the speed then this will save you a resistor.

Peter

Reply to
moocowmoo

There isn't much current from the weak pullups (50uA minimum, but not even 100% tested). If you're using a forced beta of 10-20, that means

1mA drive at most. Also, if the output gets changed to high (by electrical noise, for example) there will be a lot of current flowing out of the output pin into the base. I'd put the $0.001 resistor and get ~5% control over base current rather than 10:1..

Best regards, Spehro Pefhany

--
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

You are correct, of course, that an output does not float. The point I was trying to make is that setting a pin OUTput disables weak pullup on that pin, and that the pin would float the next time it is made INput.

I use the 16F84A and 16F628 to talk to DalSemi 1-wire devices, and the uC pins constantly switch between INput and OUTput. I therefore don't depend on weak pullups for other INput pins on the same port; I connect a real 4K7 resistors (usually) to those pins.

Reply to
Michael

Hi, nothing floats if it's connected to a transistor base.

Reply to
CBarn24050

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.