Lite / Building Machines That Respond / Week 16
Multiplexers and decoders: choosing and pointing
A robot has eight sensors but only one analog-to-digital converter. How does it read them all through one input?
Why should I care?
Multiplexers and decoders are the traffic police of a computer: they choose which data goes where. Every processor uses them to pick registers, select memory and route results.
- Describe a multiplexer as a logic-controlled selector and write Y = ¬S·A + S·B.
- Describe a decoder as turning a binary number into one active output line.
- Relate the number of select lines to the number of inputs or outputs (2ⁿ).
Predict
A multiplexer chooses one of several inputs using binary select lines. How many inputs can 3 select lines choose between?
- 3
- 6
- 8
Guess first, then reveal
Three select bits can make 2³ = 8 different numbers, 000 to 111, so they can pick one of 8 inputs.
Discover
Open the '2:1 multiplexer' challenge in the logic lab. Build Y = ¬S·A + S·B from AND, OR and NOT gates. Test all eight rows: confirm that S = 0 passes A through and S = 1 passes B, whatever the other input does.
What the interactive shows (text version)
In the logic lab's 2:1 multiplexer challenge, the circuit Y = NOT S AND A, OR S AND B is checked on all eight rows of S, A and B. When S is 0 the output always equals A; when S is 1 it always equals B.
Understand
Multiplexer: a selector
A 2:1 multiplexer has data inputs A and B and a select input S. If S = 0 the output copies A; if S = 1 it copies B: Y = ¬S·A + S·B. A 4:1 mux uses two select bits; an 8:1 mux uses three.
Decoder: a pointer
A decoder takes an n-bit number and switches on exactly one of 2ⁿ outputs. A 2-to-4 decoder with inputs A1 A0 has outputs D0 = ¬A1·¬A0, D1 = ¬A1·A0, D2 = A1·¬A0, D3 = A1·A0. Give it 10 and only D2 lights.
Where machines use them
A microcontroller uses a mux to connect one of its many analog pins to its single converter. Memory uses decoders to switch on one row out of thousands. A processor uses muxes to choose which register feeds the adder.
Explain it another way
Intuitive
A multiplexer is a railway junction: the select lever decides which track reaches the station. A decoder is a lift panel lighting exactly one floor number.
Technical
A 2ⁿ:1 multiplexer implements Y = Σ (minterm_k(S) · D_k). A decoder generates all 2ⁿ minterms of its inputs; combined with an OR gate it can implement any Boolean function of those inputs.
Mathematical
Select lines n and inputs N relate by N = 2ⁿ, so n = log₂ N. Choosing among 16 channels needs 4 select bits; 1024 memory rows need a 10-bit decoder.
Applied
Sensor boards often share one converter between many channels through a multiplexer, reading them one after another. Seven-segment display drivers decode a 4-bit number into the segments to light.
Worked example 1
A 2:1 mux has A = 0, B = 1, S = 1. What is Y?
Y = ¬S·A + S·B = 0·0 + 1·1 = 1: S = 1 selects B.
Common mix-ups
A multiplexer mixes its inputs together.
✓ It passes exactly one input through, chosen by the select lines.
Practice
Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.
Apply it
A robot has four distance sensors and one converter. Draw the 4:1 multiplexer, label the select lines, and write the sequence of select values its program should cycle through to read every sensor once.
Reflect
Why is selecting with binary numbers so much cheaper in wires than having one 'choose me' wire per input?
Write your answer on paper or in your own notes. Lite never stores what you write.