No more secrets Part 5: Mux Demux

Da raspibo.
Jump to navigation Jump to search

The MUX (or Selector)

The Multiplexor (also called Mux or Selector by closer friends) is a circuit which has n control inputs, 2^n data inputs and une output.

The control input decides which data input is copied into the output all the other inputs are simply ignored.

In my mind a Mux is similar to a track switch on a railroad. More specifically the switching system for the trains leaving a station. There are plenty of platforms in the station and the switches must be set up for the departing train to guarantee the routing to the railroad to the next station

Railswitch1.jpg

The truth table for a mux having two control inputs is the following

c1  c0  in0 in1 in2 in3 out
0   0   0   x   x   x    0
0   0   1   x   x   x    1
0   1   x   0   x   x    0
0   1   x   1   x   x    1
1   0   x   x   0   x    0
1   0   x   x   1   x    1
1   1   x   x   x   0    0
1   1   x   x   x   1    1

(where x means for any value of this input, both 0 and 1)

The circuit is the following:

File:Mux.jpg

ANd this is the file for the jumpers:

c0: AACF
c1: HHJ
in0: B
in1: C
in2: E
in3: F
A: BE
B: D
C: D
D: I
E: G
F: G
G: J
H: I
I: K
J: K
K: out

For each configuration of in0 and in1 the corresponding input will be copied to the output. To test this circuit, plug in a led to the output gate (K) and set both c0 and c1 to 0, now the led is turned on and off by setting on and off in0. In other words, in0 is copied on out. Any input on in1, in2 or in3 does not change the value of out. Now if you set c0 to 1, in1 is copied to out. Now the values at in0 in1 and in3 are irrelevant, while the led turns on and off when the input at in1 changes. Similarly when c0 and c1 are 1 0, in2 is copied and when c0 and c1 are 1, 1 is the turn of in3.

The Demux

A demultiplexer is the opposite of a mux. It takes one data input and n control inputs and 2^n output lines. The input is copied on the output line addressed by the control input.

A demux is conceptually similar to a railroad switching system, this time the one that the trains use entering a station. A train coming from a railroad is router to a specific track to approach a specific platform where people can get on and off.

Railswitch2.jpg

Unfortunately it needs 14 nand gates to create a two control inputs demux circuits, two more than those available on out breadboard. However, It is possible to build two 1 control bit demuxes.

This is the circuit: File:Demux.jpg

This is the table to set up the jumpers on the breadboard:

c0: AAD
in0: BD
c1: FFI
in1: GH
A: B
B: CC
C: out00
D: EE
E: out01
F: G
G: HH
H: out10
I: JJ
J: out11