Logic gates
AND, OR, NOT, NAND, NOR and XOR.
AND, OR, NOT, NAND, NOR and XOR.
A logic gate is a tiny circuit that looks at one or two inputs, each either high (1) or low (0), and sets its output high or low by a fixed rule. Everything digital, from a keyer to a transceiver's processor, is built by wiring huge numbers of gates together.
The rule for each is one short sentence, and the truth table lists every case:
| Gate | Output is 1 when | Handy to know |
|---|---|---|
| NOT | the input is 0 | an inverter |
| AND | both inputs are 1 | "all conditions met" |
| OR | either input is 1 | "any condition met" |
| NAND | not both inputs are 1 | AND followed by NOT |
| NOR | neither input is 1 | OR followed by NOT |
| XOR | the inputs differ | a "difference" detector |
| XNOR | the inputs match | a "same" detector |
The bubble on a symbol's output means "inverted". NAND and NOR are universal: any other gate can be built from NAND gates alone, which is why chips are often full of them.
Gates combine into decisions. A tone-squelch circuit passes audio only when a carrier is present and the right sub-audible tone is detected, or when you hold the monitor button:
XOR is especially useful: wired to two signals of the same frequency, its output is high for as long as they disagree, which makes it a simple phase detector (see PLLs and frequency synthesizers). An XOR and an AND together add two bits (XOR gives the sum, AND the carry), which is how arithmetic is built.
"High means 1" is called positive logic, and is the usual convention. Many control lines are active low: the action happens when the line goes low, often drawn with a bar over the name. A radio's push-to-talk input is a familiar example: grounding it means transmit.