# How does an open-collector gate work by using resistors?

I understand that that the purpose is to drive multiple signals to a wire bi-directionally. The two logic states are either 0 or flow (high-impedance). However, how do resistors come into play for the logic states?

• You would usually use a pull-up resistor on your bi-directional line to avoid a floating/high-impedance state. The open-collector (or open-drain) transistor pulls the line low and the pull-up resistor pulls it high. – brhans Jun 24 '15 at 17:55

Open-drain (or open-collector, in the case of BJT's) inputs allow the connecting of more than one output to the same line. This is called a wired-OR. The line is tied high with a pull-up resistor.

This is why pins such as reset and interrupt lines on a microcontroller, among others, are all "active low" - meaning when they are not asserted (logic 1) they are in a high-impedance state, effectively disconnecting the pin from the line. Since none of the output lines are then driving the line, a pull-up resistor is necessary to keep the line going into the microcontroller in a high, or logic 1 state. Then any of the devices can pull the line low (logic 0) without affecting the other devices. (If one device actively pulled the line high, and another device actively pulled the line low, you'd have a short.)

Such inputs are usually designated as active-low with a bar across the top of the signal name ($\small \overline{\text{INT}}$). On systems where that is not possible, other methods are to use a leading exclamation point (!INT), or a leading slash (/INT), or a trailing # sign (INT#). In the Eagle schematic capture program, if you prefix a symbol with ! the program will turn it into an overbar.

In the circuit above, there are three devices that are capable of generating an interrupt. When none of the interrupts are active (logic 0), all the outputs are in a high-impedance state and the high voltage (VCC) is supplied to the input of the microcontroller on the right by the pull-up resistor R1. When one of the interrupt lines is asserted, it drives the output low (logic 0), which feeds into the active low interrupt pin of the microcontroller and generates an interrupt.

If the microcontroller needs to determine source of the interrupt, the outputs can be isolated with diodes as shown below, and each one brought back to an individual pin on the microcontroller. (the other way, which saves using the extra pins on the microcontroller, is for it to pull the registers of each device.)

Pull-up resistors are also used on I2C lines, as shown below:

One of the "nodes" is typically a microcontroller, with the other nodes being devices. However they all use essentially the same circuitry. I2C allows more than one master (e.g. microcontroller) to be connected to the same bus (multi-master mode).

The pull-ups are required because both the clock lead (SCL) and data lead (SDA) are bi-directional, so you have more than one device capable of driving the same line. (SCL because of clock stretching by the slave, and SDA because the same line is used for input and output.)

When no device is driving the SCL or SDA lines, all MOSFETs are off. When one of the devices is asserting line, one of the MOSFETs is on, driving the line low.

• And I2C. Can't forget about I2C. – Ignacio Vazquez-Abrams Jun 26 '15 at 16:35
• @IgnacioVazquez-Abrams I thought of including I2C but figured the answer was long enough already. Essentially the same as what I wrote, allows more then one output to be connected to the same line. I'll add a paragraph about it. – tcrosley Jun 26 '15 at 16:39