Physics › Electronics › Digital signal processing
Digital signal processing
Send a voltage a hundred miles and noise ruins it on the way. Send the same information as ones and zeros and a cheap circuit rebuilds it perfectly at every stop. Six small gates then add, compare and decide, and a one-bit memory turns them into machines that count.
Builds on Operational amplifiers and Summing and difference amplifiers.
IN THIS TOPIC
- Explain why digital signals resist noise, and what regeneration does that amplification cannot.
- Write the truth table of each of the six gates without hesitation.
- Turn a Boolean expression, or a specification in words, into a gate circuit, the half-adder included.
- Describe the D-type flip-flop as a one-bit memory, and use counters that halve the frequency at every stage.
WHAT YOU PROBABLY THINK
Digital signals survive long distances because they are transmitted at higher power.
Why two levels beat a wavy line
An analogue signal carries its information in its exact shape, and that is its weakness. Every metre of cable adds a little random noise, and once noise is mixed in no circuit can tell it from signal. Amplifying a tired analogue signal amplifies the noise with it, so each leg of a long link leaves the signal permanently worse.
A digital signal gives up the shape entirely. Only two levels mean anything, logic 0 near 0 V and logic 1 near the supply voltage, and the receiver asks one crude question, above the threshold or below it? Noise that would wreck an analogue waveform leaves a 1 still recognisably a 1. There is a genuine margin for error, and small noise sits inside it.
Better still, a digital signal can be regenerated. A repeater partway along the route reads each incoming pulse as 0 or 1, then issues a brand-new, full-height, noise-free pulse. It does not amplify the old signal, it replaces it, and the noise collected so far is discarded completely. Do this before the noise ever approaches half a logic level and the message crosses a continent unchanged. That kills the lie above; transmitted power is beside the point, and digital links usually use less of it.
The six gates
The circuits that chew on logic levels are gates. A gate's output depends only on its present inputs, so the whole behaviour fits in a truth table, one row per input combination. The simplest is NOT, one input, one output, always the opposite: input 0 gives 1, input 1 gives 0. The remaining five take two inputs, so their tables have four rows:
| A | B | AND | OR | NAND | NOR | EOR |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 |
Three of these are worth learning as sentences. AND outputs 1 only when both inputs are 1. OR outputs 1 when at least one input is 1. EOR, exclusive-OR, outputs 1 when the inputs differ, and that last row is the one that separates it from OR. NAND and NOR are simply AND and OR with the answer inverted, drawn with a small circle on the output, and each of them alone can be wired up to build every other gate.
Combinational design is reading Boolean sentences in both directions. A specification in words becomes an expression, the expression becomes gates. The habit that keeps you honest is the full truth table, every input combination in binary counting order, because it forces the cases you did not think about into the open.
WORKED EXAMPLE
Reading a Boolean sentence
A machine may run (Q = 1) only when the guard is closed (G = 1) and either the two-hand switch is pressed (T = 1) or a supervisor override is on (S = 1). Write the expression, name the gates, and evaluate Q for G = 1, T = 0, S = 1.
The sentence translates directly: Q = G AND (T OR S). One OR gate feeds one AND gate.
With T = 0 and S = 1 the OR gives 1; with G = 1 the AND gives Q = 1, and the machine may run.
Check the guard's authority in the table. Whenever G = 0 the AND cannot output 1, whatever the other switches plead. The expression enforces the safety rule structurally.
The half-adder
Binary arithmetic in one column is small enough to build by inspection. Adding bits A and B gives 0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1, and 1 + 1 = 10, which is the number two, written as sum 0 carry 1. Now stare at the two output columns. The sum is 1 exactly when the inputs differ, and the carry is 1 exactly when both inputs are 1. Those are tables you already know.
So a half-adder is one EOR gate for the sum and one AND gate for the carry, wired to the same pair of inputs. It is the standard exam example of combinational design, a truth table recognised as a pair of known gates. Chain half-adders with provision for an incoming carry and you have the adder at the heart of every processor.
YOUR TURN
One plus one, in gates
Trace the half-adder for A = 1, B = 1, then for A = 1, B = 0, and read each result as a binary number.
Show the working
A = 1, B = 1: the inputs match, so EOR gives S = 0; both are 1, so AND gives C = 1. Read carry then sum, the answer is 10, the number two.
A = 1, B = 0: the inputs differ, so S = 1; AND gives C = 0. The answer is 01, the number one.
Both agree with ordinary arithmetic, and that is the point. The gates are not imitating addition, they are addition, one column at a time.
Memory, and counting by halving
Gates have no memory; release a switch and the output forgets it instantly. Sequential circuits add the missing ingredient with the D-type flip-flop, a one-bit memory. It has a data input D, a clock input, and an output Q. On each rising clock edge it copies whatever is on D to Q, then holds Q frozen until the next edge, ignoring D completely in between. Registers and computer memory are rows of these, one per bit.
One wiring trick turns storage into rhythm. Connect the flip-flop's inverted output back to its own D input and every clock edge loads the opposite of what Q held, so Q toggles at each edge. Two clock cycles pass before Q completes one full cycle of its own, so Q runs at half the clock frequency, a clean square wave. Feed Q onward as the clock of a second stage and the halving repeats. For n stages,
Read all the Q outputs at once, last stage first, and the same chain is a binary counter. The outputs step through 00, 01, 10, 11 and onward, one count per clock pulse, rolling over after states. Counting and frequency division are one circuit wearing two labels.
WORKED EXAMPLE
The watch that counts out one second
A quartz watch crystal oscillates at 32 768 Hz. How many toggling stages does the watch need to derive its once-per-second tick?
32 768 is , so each of 15 halvings takes the frequency down one power of two, ending at exactly 1 Hz.
That number is designed backwards. Crystal makers chose 32 768 Hz precisely because a whole number of halvings lands on one second.
TRY IT UNSEEN
Designing the divider
A timing circuit is clocked at 4096 Hz and must drive a display at 16 Hz. How many flip-flop stages are needed, and how many distinct states does that chain pass through as a counter?
Show the working
The division needed is 4096/16 = 256 = , so 8 stages.
An 8-stage counter runs through = 256 states, 0 to 255, before repeating.
Keep the two answers apart. Frequency out is , states counted is . Swapping them is the standard slip.
THE EXAM BIT
- The regeneration argument is a contrast, so give both halves. An amplifier boosts signal and accumulated noise together; a regenerator decides 0 or 1 and issues a new clean pulse, discarding the noise.
- Write truth tables with the inputs counting in binary order, 00, 01, 10, 11. Examiners look for the complete table, and a missing row forfeits the mark.
- EOR's definition is worth one crisp sentence, output 1 when the inputs differ. The row that catches people is 1, 1, where OR gives 1 and EOR gives 0.
- Half-adder answers must name both gates and both outputs. Sum from EOR, carry from AND, one pair of shared inputs.
- The D-type in one line: on the clock's rising edge it copies D to Q, and holds Q between edges. The qualitative description is the whole mark.
- Counter arithmetic: frequency divides by , the number of states is . Decide which the question wants before reaching for the calculator.
CHECK YOURSELF
A 3-stage binary counter is clocked at 96 Hz. Find the frequency at the final output, state how many distinct states the counter passes through, and give the EOR output for inputs 1 and 1.
Show a hint
Each stage halves the frequency once. EOR asks whether the inputs differ.
Show the answer
Three halvings divide by = 8, so the final output runs at 96/8 = 12 Hz.
The counter passes through = 8 states, 000 up to 111, then rolls over.
The inputs match, so EOR outputs 0. That is the row that separates it from OR.
A gate's output depends only on its present inputs; a flip-flop remembers one bit until the next clock edge.
EOR answers 1 when the inputs differ; NAND and NOR are AND and OR with the answer flipped.
Sum from EOR, carry from AND: that pair is the half-adder.
Every toggling stage halves the frequency, so n stages divide by 2 to the n.
WORKBOOK
Printable practice for this topic: original exam-style questions with room to work, and a fully worked answer book. Free to use; please do not redistribute or sell.
CHECK YOUR PROGRESS
Rate how confident you feel with each objective for this lesson. Ratings are saved in this browser, on this device only.
- Explain why digital signals resist noise, and what regeneration does that amplification cannot.
- Write the truth table of each of the six gates without hesitation.
- Turn a Boolean expression, or a specification in words, into a gate circuit, the half-adder included.
- Describe the D-type flip-flop as a one-bit memory, and use counters that halve the frequency at every stage.
Open the full revision checklist to track your progress across the whole unit.