Logic Gates
Every digital circuit — from the simple frequency counter in your shack to the complex signal processor inside your software defined radio — is built from a handful of basic building blocks called logic gates. A logic gate takes one or more binary inputs and produces a single binary output according to a fixed rule. There are only seven basic types, and once you understand each one, you have the tools to analyze and understand any digital circuit.
Logic gates are not exotic — most of them you already understand intuitively, even if you have never called them gates. An AND gate says "the output is high only if input A AND input B are both high." An OR gate says "the output is high if input A OR input B (or both) is high." An understanding of logic gates transforms digital circuits from black boxes into readable diagrams.
The seven fundamental logic gates, their ANSI/IEEE symbols, and truth tables. Mastering these builds the foundation for all digital electronics.
View LargerWhat Is a Logic Gate
A logic gate is an electronic circuit that implements a Boolean function. Its inputs and outputs are digital signals — each signal is either LOW (logic 0, typically near 0 V) or HIGH (logic 1, typically near 3.3 V or 5 V depending on the logic family). The gate examines its inputs and produces an output according to a fixed rule, regardless of what happened previously. This is unlike a flip-flop (covered in lesson M18E), which has memory — a gate has no memory at all. Change the inputs and the output changes instantly.
Physically, logic gates are built from transistors. A CMOS NAND gate, for example, contains four MOSFETs arranged so that the output is pulled low only when both inputs are simultaneously high. Modern digital ICs pack millions or billions of gates onto a single chip. But the behavior of any gate is completely described by its truth table — the list of every possible input combination and the corresponding output.
NOT Gate (Inverter)
The NOT gate is the simplest gate. It has one input and one output. The output is always the opposite of the input: if the input is LOW, the output is HIGH, and if the input is HIGH, the output is LOW. In Boolean algebra the NOT operation is written as Ā (A-bar), or sometimes ¬A or A'.
| Input A | Output Q = Ā |
|---|---|
| 0 | 1 |
| 1 | 0 |
The NOT gate schematic symbol is a triangle pointing right with a small circle (bubble) at the output. The bubble is the key symbol in digital logic — wherever you see a bubble on any gate, that signal is inverted at that point. NOT gates are also called inverters.
In a practical circuit, a NOT gate can be used to ensure that a control signal is active-low (a common convention). If a chip reset pin requires a LOW to reset, but your microcontroller outputs a HIGH to initiate a reset, a NOT gate in between inverts the signal correctly.
AND Gate
An AND gate has two or more inputs and one output. The output is HIGH only when ALL inputs are simultaneously HIGH. The name is the rule: A AND B must both be HIGH for the output to be HIGH. In Boolean algebra AND is written as A · B, or simply AB.
| Input A | Input B | Output Q = A·B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Think of an AND gate as a series circuit with two switches: current flows only when switch A AND switch B are both closed. Any single input being LOW forces the output LOW, regardless of the other inputs. The AND gate is used for enabling or gating signals — the output only passes through when an enable input is HIGH.
OR Gate
An OR gate produces a HIGH output when ANY input is HIGH. The output is LOW only when all inputs are simultaneously LOW. In Boolean algebra OR is written as A + B (using the plus sign, not addition).
| Input A | Input B | Output Q = A+B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Think of an OR gate as a parallel circuit with two switches: current flows if either switch A OR switch B (or both) is closed. The OR gate is used for combining signals — if any of several condition inputs becomes true, the output indicates a condition has occurred.
NAND Gate — The Universal Gate
The NAND gate is an AND gate followed by a NOT gate. Its output is LOW only when ALL inputs are HIGH — in every other case the output is HIGH. The name NAND is a contraction of "NOT AND." In Boolean algebra the NAND output is written as AB̄ (the whole AND expression negated) or equivalently ¬(A · B).
| Input A | Input B | Output Q = AB |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
The NAND gate's schematic symbol is the AND symbol with a bubble at the output. NAND is called a universal gate because every other logic gate can be built from NAND gates alone. A single NAND gate with both inputs tied together is a NOT gate (since if A=B the NAND output is Ā). Two NAND gates in series (the second one with inputs tied) implement an AND. Arrange NAND gates appropriately and you can build OR, NOR, and XOR functions too. This is why early computers were often built from nothing but NAND gates — one gate type is easier to manufacture in large quantities.
NOR Gate — Also Universal
The NOR gate is an OR gate followed by a NOT gate. Its output is HIGH only when ALL inputs are LOW — in every other case the output is LOW. NOR stands for "NOT OR." In Boolean algebra the output is written as A+B.
| Input A | Input B | Output Q = A+B |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
Like NAND, NOR is also a universal gate — any logic function can be implemented using NOR gates only. NOR gates with tied inputs also implement NOT (since A+A = Ā). A NOR gate is often used to detect a zero state — its output is HIGH only when no inputs are active, which is useful for interrupt logic and bus arbitration circuits.
XOR Gate
The XOR (exclusive OR) gate outputs HIGH when its inputs are different. If both inputs are the same (both 0 or both 1), the output is LOW. The XOR operation is written A ⊕ B. XOR is sometimes described as "one but not both" or "odd number of 1s."
| Input A | Input B | Output Q = A⊕B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
XOR has many practical applications. In binary addition, the XOR gate computes the sum bit of two inputs (the carry is computed by an AND gate). XOR is also used for error detection (parity checking) and data encryption. For radio applications, XOR gates appear in BPSK and DBPSK demodulators, where XOR compares the current data bit with the previous one to detect transitions.
XNOR Gate
The XNOR (exclusive NOR) gate is the inverse of XOR. It outputs HIGH when both inputs are the same (both 0 or both 1), and LOW when they differ. XNOR is written as A⊕B or sometimes A ⊙ B.
| Input A | Input B | Output Q |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
XNOR is used as an equality comparator — its output is HIGH when inputs match. This is useful in phase-locked loops (PLLs), where an XNOR phase detector compares the phase of the input signal with the VCO output and outputs a HIGH signal proportional to how well they agree.
Gate Summary Table
| Gate | Output is HIGH when… | Boolean notation | Key use |
|---|---|---|---|
| NOT | Input is LOW | Ā | Signal inversion |
| AND | ALL inputs are HIGH | A·B | Enable/gating |
| OR | ANY input is HIGH | A+B | Combining signals |
| NAND | NOT all inputs are HIGH (universal) | AB | Universal building block |
| NOR | ALL inputs are LOW (universal) | A+B | Zero detector, universal |
| XOR | Inputs are DIFFERENT | A⊕B | Parity, binary sum bit |
| XNOR | Inputs are the SAME | A⊕B | Equality comparator, PLL phase detector |
Boolean Algebra Basics
Boolean algebra is the mathematical system that describes logic operations. It uses three main operations — AND (multiplication), OR (addition), and NOT (complement) — and a set of axioms that are almost always simpler than ordinary algebra.
- A + 0 = A (OR with 0 leaves A unchanged)
- A · 1 = A (AND with 1 leaves A unchanged)
- A + 1 = 1 (OR with 1 always gives 1)
- A · 0 = 0 (AND with 0 always gives 0)
- A + A = A (idempotent law)
- A · A = A (idempotent law)
- A + Ā = 1 (complement law)
- A · Ā = 0 (complement law)
- Ā̄ = A (double negation)
De Morgan's Theorems
De Morgan's theorems are among the most useful tools in digital design. They let you convert between AND and OR forms, which is essential for simplifying logic circuits and for understanding why NAND and NOR are universal.
- First theorem: A·B = Ā + B̄ — "NAND equals NOT-A OR NOT-B"
- Second theorem: A+B = Ā · B̄ — "NOR equals NOT-A AND NOT-B"
In words: to negate an AND, change it to OR and negate each term (and vice versa). The inversion "moves through" the operator and flips AND to OR or OR to AND.
You have the expression Ā + B̄. Apply De Morgan to the outer inversion:
Ā + B̄ = Ā · B̄ = A · B
So inverting an OR of two inverted signals gives the AND of the original signals. This means a NOR gate with inverted inputs is equivalent to an AND gate.
CMOS and TTL Logic Families
Logic gates are manufactured in different technology families that determine their voltage levels, speed, power consumption, and noise immunity. The two families you will encounter in ham radio work are CMOS and TTL.
TTL (Transistor-Transistor Logic) was the dominant logic family from the 1970s through the 1990s. The 74xx series (7400, 7408, 7486, etc.) is TTL. TTL uses 5 V power, defines logic LOW as 0 to 0.8 V and logic HIGH as 2.0 to 5 V. TTL is fast and robust. Many older transceivers use 5 V TTL for internal control signals, and the 74xx parts are still in production and cheap.
CMOS (Complementary Metal-Oxide-Semiconductor) uses far less power than TTL because CMOS transistors draw current mainly during switching, not continuously. The 4000-series CMOS parts (4001, 4011, 4070, etc.) can run from 3 V to 18 V, making them very flexible. Modern "74HC" (High-speed CMOS) parts combine CMOS power efficiency with TTL-compatible speeds and pin assignments, running at 3.3 V or 5 V. Most modern microcontrollers use 3.3 V CMOS logic.
Logic Gates in Ham Radio
Frequency display and band decoding. In older transceivers, logic gates decode the BCD (binary-coded decimal) output of the synthesizer to drive seven-segment frequency displays. AND gates check which band is selected; OR gates combine band signals to drive specific relay outputs. You will find 74LS00 (quad NAND) and 74LS86 (quad XOR) ICs throughout service schematics of HF radios from the 1980s and 1990s.
CW keyer logic. Electronic CW keyers use flip-flops and gates to implement iambic keying: XOR gates compare the paddle states to determine which element to send next; AND gates gate the sidetone and transmitter keying signals.
Digital modes. PSK31 modulators and demodulators use XOR gates to implement DBPSK differential encoding. The current bit is XORed with the previous bit to produce the encoded output — if the bits differ, a phase reversal occurs; if they match, no reversal. The demodulator XORs consecutive samples to recover the original data.
Relay control and protection. PTT control circuits in transceivers use AND gates to ensure that transmit is only enabled when all conditions are met: power supply voltage is OK AND the transceiver is not already in receive mode AND the operating temperature is within limits AND the SWR is not too high. Any condition going LOW forces the AND output LOW and inhibits transmission.
Experiment: Explore a 74HC00 NAND Gate IC
The 74HC00 is a quad 2-input NAND gate — it contains four independent NAND gates in a 14-pin DIP package and costs less than $1. This experiment lets you verify the NAND truth table and build both a NOT gate and an AND gate from a single NAND chip.
- 74HC00 quad NAND gate IC (DIP-14)
- Breadboard
- 5 V power supply (or USB power bank with 5 V output)
- 2 × momentary pushbuttons
- LED with 470 Ω resistor
- 2 × 10 kΩ pull-down resistors
- Jumper wires
- Place the 74HC00 in the breadboard. Pin 14 is VCC (5 V), pin 7 is GND. Connect power and ground.
- Use one NAND gate (pins 1, 2 = inputs; pin 3 = output). Connect a 10 kΩ resistor from each input to GND (pull-down to default LOW). Connect each input also to a pushbutton that connects to VCC (5 V) when pressed.
- Connect the output (pin 3) through a 470 Ω resistor to an LED, then to GND.
- Test the NAND truth table: no buttons pressed (0,0) → LED ON; button A only (1,0) → LED ON; button B only (0,1) → LED ON; both pressed (1,1) → LED OFF. This matches the NAND truth table exactly.
- Now build a NOT gate: use a second NAND gate on the same chip. Tie both inputs together (pins 4 and 5 connected). Connect a pushbutton to both tied inputs. Connect the output (pin 6) to a second LED via 470 Ω. Now pressing the button (input = 1) should turn the LED off (output = 0), and releasing it (input = 0) should turn it on (output = 1). The NAND-with-tied-inputs is a NOT gate.
Frequently Asked Questions
Why are NAND and NOR called universal gates?
Because any logic function can be built using only NAND gates (or only NOR gates). You can make a NOT by tying both inputs together. You can make AND by following a NAND with a NOT (another tied-input NAND). You can make OR using three NAND gates via De Morgan's theorem. Because only one gate type is needed, manufacturing is simpler and cheaper when a chip contains only NAND or only NOR gates throughout.
What does the bubble on a gate symbol mean?
A small circle (bubble) at a gate input or output means that signal is inverted at that point. A NOT gate is just a buffer with a bubble on its output. A NAND gate is an AND gate with a bubble on its output. A NOR gate is an OR gate with a bubble. If you see a bubble on an input of a gate, it means that input is active-low — the gate responds to a LOW on that input as if it were a HIGH.
Can I mix CMOS and TTL gates in the same circuit?
Sometimes, but carefully. "74HC" (high-speed CMOS) parts running at 5 V are generally compatible with 5 V TTL logic levels at their inputs. However, 3.3 V CMOS parts cannot tolerate 5 V inputs. If you are mixing a 5 V TTL source with a 3.3 V CMOS input, use a level-shifting buffer or a resistive voltage divider. Many modern Arduino projects run into problems mixing 5 V Arduino outputs with 3.3 V sensors or modules — the solution is always a level shifter.
Is there any difference between AND and multiplication in Boolean algebra?
In Boolean algebra, AND behaves like multiplication in one key way: A · 0 = 0 always, just as in ordinary multiplication. And A · 1 = A, as expected. But Boolean addition (OR) is different from ordinary addition: 1 + 1 = 1 in Boolean algebra (not 2). This is the key distinction: Boolean numbers are never greater than 1, and the OR operation is not the same as arithmetic addition.
Test Your Knowledge
Answer the questions below to check your understanding. Every answer can be found in the lesson above.