Better to know some
... than all
The opposite of the multiplexer circuit, logically enough, is the demultiplexer. This circuit takes a single data input and one or more address inputs, and selects which of multiple outputs will receive the input signal. The same circuit can also be used as a decoder, by using the address inputs as a binary number and producing an output signal on the single output that matches the binary addres input. In this application, the data input line functions as a circuit enabler - if the circuit is disabled, no output will show activity regardless of the binary input number.
A one-line to two-line decoder/demultiplexer is shown below.
This circuit uses the same AND gates and the same addressing scheme as the two-input multiplexer circuit shown in these pages. The basic difference is that it is the inputs that are combined and the outputs that are separate. By making this change, we get a circuit that is the inverse of the two-input multiplexer. If you were to construct both circuits on a single breadboard, connect the multiplexer output to the data IN of the demultiplexer, and drive the (A)ddress inputs of both circuits with the same signal, you would find that the initial X0 input would be transmitted to OUT0 and the X1 input would reach only OUT1.
The one problem with this arrangement is that one of the two outputs will be inactive while the other is active. To retain the output signal, we need to add a latch circuit that can follow the data signal while it's active, but will hold the last signal state while the other data signal is active. An excellent circuit for this is the D (or Data) Latch. By placing a latch after each output and using the Addressing input (or its inverse) to control them, we can maintain both output signals at all times. If the Address input changes much more rapidly than the data inputs, the output signals will match the inputs faithfully.
Like the multiplexer circuit, the decoder/demultiplexer is not limited to a single address line, and therefore can have more than two outputs. With two, three, or four addressing lines, this circuit can decode a two, three, or four-bit binary number, or can demultiplex up to four, eight, or sixteen time-multiplexed signals.
A 2-to-4 line decoder/demultiplexer is shown below.
As a decoder, this circuit takes an n-bit binary number and produces an output on one of 2n output lines. It is therefore commonly defined by the number of addressing input lines and the number of data output lines. Typical decoder/demultiplexer ICs might contain two 2-to-4 line circuits, a 3-to-8 line circuit, or a 4-to-16 line circuit. One exception to the binary nature of this circuit is the 4-to-10 line decoder/demultiplexer, which is intended to convert a BCD (Binary Coded Decimal) input to an output in the 0-9 range.
If you use this circuit as a demultiplexer, you may want to add data latches at the outputs to retain each signal while the others are being transmitted. However, this does not apply when you are using this circuit as a decoder - then you will want only a single active output to match the input code.