Maker Pro
Maker Pro

Push-pull output

juantravel

May 14, 2010
41
Joined
May 14, 2010
Messages
41
I'm having trouble understanding push-pull on my micro-controller. Why not just have it like the 8 bit pic micro where the pin goes high when (1) and low when (0)? Also Output Open Drain. Why would they have so many outputs and where would each be used in?

thank you
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Look at the construction of a CMOS output. There are 2 transistors. One gets turned on to pull the output high (or 1) the other gets turned on to pull the output low (or 0).

An output like that can both sink and source current. Connecting more than one output together will cause problems if they are in opposite logic levels.

Open drain outputs (or open collector on bipolar logic) have a single transistor that pulls the output low. A resistor must be used to pull the output high. This sounds like an odd thing, however connecting several outputs together is possible, and the output will be low if any output is low. In addition, an open drain output can often be used to switch loads operating from a higher voltage than the logic.
 

juantravel

May 14, 2010
41
Joined
May 14, 2010
Messages
41
So if I enable the ports as output and set it to 0 for low, I will be able to sink current and 1 for high, and will be able to source? The chip I'm using can sink/source 8mA max. Why would we want to sink into the chip? So the open drain can be used as a OR gate correct? What are the benefits of connecting them together?
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Sinking and sourcing are just current flows in opposite directions.

A LED and a resistor connected between the output and ground has current sourced to it from the output of the uC when the output goes high (1).

A LED and a resistor connected between the output and +v has current sinked (sunk?) from it from the output of the uC when the output goes low (0). (better phrased as the output sinks current from the LED)

More practically, if you are using the output to drive a MOSFET, you may need to sink current to turn on an N channel device (the gate has a small capacitance that must be charged) and you need to sink current to turn it off (to discharge that small capacitance).

You might connect several outputs together to wire OR them (as you suggest) -- where the normal high = 1 convention applies. It can also be used to wire-AND if we use inverted logic (high = 0).

(inverted logic is used for PNP transistors (and P Channel MOSFETS) which are turned on by the base (gate) being pulled in the negative direction.

Open drain outputs can be used to switch high(er) voltage loads -- as mentioned before. They can also be used to connect to busses where multiple devices might wish to assert a signal (an interrupt line is an example)
 
Top