An XOR gate outputs a logical HIGH only when its inputs differ, an XNOR outputs HIGH when they match, and combining these gates creates binary adders that perform the foundational arithmetic of every digital processor. When you introduce these components into a design, what it changes in a real circuit is the fundamental capability: it transforms a digital layout from simple boolean state routing into a computational engine capable of arithmetic, parity evaluation, and edge detection. However, what people commonly confuse it with is standard inclusive logic; beginners frequently mix up the XOR "either-or" behavior with the inclusive OR gate (which outputs high when both inputs are high), and they often mistake the carry-out bit of a full adder for a simple logical AND rather than a three-input majority function.
The Core Logic: XOR, XNOR, and the Half/Full Adder
To tackle the core concepts of this lab module, we have to look at the silicon. The standard workhorse for these labs is the 74LS86 (Quad 2-input XOR) and the 74LS266 (Quad 2-input XNOR). In a modern 74HC-series CMOS implementation, these gates exhibit a typical propagation delay of about 8ns at 5V, but in the older 74LS TTL series you will find on most lab benches, expect closer to 10ns to 14ns.
The Half Adder is the simplest computational block. It uses an XOR gate to generate the Sum (A ⊕ B) and an AND gate to generate the Carry (A · B). But a half adder cannot accept a carry from a previous column. To cascade addition, we use a Full Adder, which adds a Carry-In (Cin) pin.
| A | B | Cin | Sum (XOR) | Cout (Carry) |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 | 1 |
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 |
Worked Numeric Example: 4-Bit Binary Addition
Instead of wiring four full adders manually, lab kits usually provide the 74LS283 4-bit binary full adder with fast carry. This IC uses carry-lookahead logic internally to speed up the addition process, avoiding the sequential delay of a ripple-carry chain.
Let us run a numeric example through the 74LS283. We want to add two 4-bit numbers:
- Input A: 1011 (Decimal 11)
- Input B: 0110 (Decimal 6)
- Carry In (C0): 0 (Tied to Ground)
The Bitwise Math:
- Bit 0 (LSB): 1 + 0 + 0(Cin) = 1. Sum0 = 1, Carry = 0.
- Bit 1: 1 + 1 + 0(Cin) = 2 (Binary 10). Sum1 = 0, Carry = 1.
- Bit 2: 0 + 1 + 1(Cin) = 2 (Binary 10). Sum2 = 0, Carry = 1.
- Bit 3 (MSB): 1 + 0 + 1(Cin) = 2 (Binary 10). Sum3 = 0, Carry = 1.
Final Output: The Carry Out (C4) is 1, and the Sum bits (Σ3 to Σ0) are 0001. Concatenating the carry and sum gives us 10001 in binary, which is exactly 17 in decimal. The math holds up on the bench, provided your VCC is a clean 5.0V and your ground connections are tight.
Where You Meet This in Practice
You might think binary adders only live inside the ALU (Arithmetic Logic Unit) of a microcontroller, but XOR and XNOR logic gates are everywhere in physical electronics and industrial installations.
- Parity Generators in RS-485/UART: Industrial serial communication uses XOR trees to generate parity bits. If you are debugging a Modbus RTU network and getting frame errors, the hardware parity generator relies entirely on cascaded XOR gates to count the 1s in a byte.
- Quadrature Encoders: When you wire up a rotary encoder to a PLC or an ESP32 to track stepper motor position, the direction decoding logic (determining if channel A leads or lags channel B) is fundamentally an XOR/XNOR state-machine evaluation.
- Phase Detectors in PLLs: In motor drive inverters and RF synths, an XOR gate acts as a basic phase detector. When two square waves of the same frequency are fed into an XOR gate, the duty cycle of the output pulse is directly proportional to the phase difference between the inputs.
Bench Scenario Walkthrough: The Floating Input Trap
During practical lab work, theory often collides with the physical realities of breadboards and silicon physics. Here is a classic scenario that trips up students and hobbyists alike.
The Setup:
You are breadboarding a half-adder using a 74LS86 (XOR) and a 74LS08 (AND). You wire VCC to pin 14 and GND to pin 7. You connect DIP switches to the inputs to toggle between 5V and Ground, and you wire the outputs through 330Ω resistors to LEDs.
The Numbers:
Your bench power supply reads 5.05V. You set Input A to HIGH (5V) and Input B to LOW (open switch). You expect the XOR output to be HIGH (LED on) and the AND output to be LOW (LED off).
The Outcome:
The XOR LED turns on, but the AND LED also glows dimly, or flickers erratically. When you toggle Input A to LOW, the outputs behave unpredictably.
What Went Wrong:
Your DIP switch connects the input to 5V when closed, but when open, the input is left floating (disconnected). In 74LS (Low-power Schottky TTL) logic, internal transistor structures act as weak pull-ups. A floating TTL input defaults to a logical HIGH. Therefore, your AND gate sees (HIGH, HIGH) instead of (HIGH, LOW), and outputs a HIGH.
The Fix: You must install 10kΩ pull-down resistors between every switch output and ground. This ensures that when the switch is open, the input is firmly pulled to 0V (LOW), overriding the internal TTL pull-up and stabilizing the logic state.
FAQ: Activity 2.3.5 Sticking Points
Why use a 74LS283 instead of chaining four discrete full adders?
Chaining discrete full adders creates a "ripple carry" adder. The carry bit must propagate sequentially from the LSB to the MSB. If each gate has a 10ns delay, a 4-bit ripple adder takes roughly 40ns to settle. The 74LS283 uses carry-lookahead logic, generating the carry bits in parallel rather than sequentially, reducing the propagation delay to about 16ns regardless of the bit width. In modern CPUs, this concept scales up to 64-bit ALUs.
My XNOR gate output is always HIGH, even when inputs differ. Why?
Check your power pins. The pinout for the 74LS266 (XNOR) is not identical to the 74LS86 (XOR), and some XNOR ICs have open-collector outputs. If you are using an open-collector XNOR (like the 74LS266), you must wire a pull-up resistor (typically 1kΩ to 4.7kΩ) from the output pin to VCC, otherwise the output can only pull low and will never drive the LED high.
How do I test if my binary adder is overflowing?
Overflow in unsigned binary addition is simply indicated by the Carry-Out (Cout) pin going HIGH. If you are working with signed numbers (Two's Complement), overflow occurs when the carry into the MSB differs from the carry out of the MSB. You can detect this by feeding the internal carry of the MSB and the final Cout into an XOR gate. If the XOR outputs a 1, a signed overflow has occurred.






