# Perform the XOR/XNOR function with a diode bridge and a transistor

Raju Baddi, Tata Institute of Fundamental Research, Pune, India -May 24, 2012

Click here to download a PDF |

When designing logic for higher-than-usual supply voltages, such as 24V, you can use a voltage regulator with a standard logic family and interface it through level shifters. Alternatively, if the logic is not too complex and the speed is not extensively high, you can build gates from discrete components and operate them directly from the available voltage. Discrete-component AND, OR, and NOT functions are relatively straightforward, but XOR and XNOR functions usually require combining several of the basic AND, OR, and NOT functions.

This Design Idea presents an unusual method of performing the exclusive functions with two resistors, four diodes, and one transistor. The NPN configuration results in the XNOR operation, and the PNP configuration gives the XOR operation.

Consider the XNOR circuit in

**Figure 1a**. When either of the gate inputs, A or B, is at an opposite logic state, a voltage drop of the high voltage minus the low voltage minus 1.2V is available to forward-bias the base-emitter junction. The transistor turns on, and the logic-zero voltage at the collector is approximately 0.6+V_{L}+V_{CE}, where V_{L}is the low voltage and V_{CE}is the collector-to-emitter voltage. When inputs A and B are at the same logic state, you cannot forward-bias the transistor’s base-to-emitter junction, so output Y is at the supply voltage.The choice of 6.8 kΩ at the collector is based on driving the A and the B inputs with standard transistor-transistor or CMOS logic, and you can change it to suit your application. The CMOS 4000 family can reliably source or sink 1 mA with a 5V supply. Low-speed TTL can source 0.4 mA and sink 8 mA. A 0.4-mA logic-one drive is sufficient for the base current, but the logic zero at either A or B forms the emitter current and is of more concern with regard to the limited 1-mA sink of the CMOS. With a net 1-mA current and approximately 250 μA remaining for the output load, you must choose a 6.8-kΩ resistor (0.75 mA×6.8 kΩ) to drop approximately 5V.

_{H}−0.6V−V

_{CE}, and logic zero is approximately 0V but current-limited through the collector resistor.

The concern here is with the TTL logic-one output current of approximately 0.4 mA, which is the transistor’s emitter current. With the choice of 10 kΩ for the collector resistor, the voltage drop across it can reach nearly 4V. This level would be tolerable for driving CMOS loads but not for TTL, which demands a current of at least 0.4 mA for logic-zero inputs when Y is at logic zero. The 10-kΩ resistor cannot provide this current. However, using the previous XNOR configuration and another inverting transistor after Y, you can obtain the XOR function (

**Figure 1b**). The XOR seems to be suitable only for the CMOS/TTL input at A and B and capable of driving only CMOS at output Y.

System level design and integration challenges with multiple ADCs on single chip

Understanding the basics of setup and hold time

Product How-to: Digital isolators offer easy-to-use isolated USB option

Managing noise in the signal chain, Part 2: Noise and distortion in data converters

War of currents: Tesla vs Edison

Simple reverse-polarity-protection circuit has no voltage drop

Control an LM317T with a PWM signal

Start with the right op amp when driving SAR ADCs

Currently no items

FEATURED RESOURCES