Data selectors, commonly known as multiplexers (or muxes for short), connect one of several inputs to a single output based on the multiplexer's “select” inputs. The number of data inputs for a multiplexer is directly related to the number of select inputs and is covered in more detail below in the multiplexer sizes section. When dealing with multiplexers, there are two main types that you will encounter: analog and digital. Digital multiplexers can only send a digital signal (HIGH or LOW) to their output. Analog multiplexers, on the other hand, can send a continuous signal to their output.

Multiplexer circuits typically have an enable input (EN pin in Fig. 1) in addition to the other inputs. The EN pin functions as a global on/off switch. As an example of how a multiplexer's EN pin operates, a truth table is shown below in Fig. 1. If you are unfamiliar with truth tables, follow the red tab on the right. When EN is HIGH you can use the select pins to route one of the input pins (Y0–Y3) to the output pin Y. Otherwise, when EN is LOW nothing is output no matter how you drive the select pins.

In Fig. 1 you may have noticed the input pins are labeled Y0 to Y3. The numbers in the label make it easy to clarify which pin we are talking about. These numbers also make it easier to choose what input pin we want to select for output. For example, if we want to select pin Y2 to be output, we would only send the mux (the number 2 in binary form). In binary, the number 2 is denoted as '10' (follow the orange tab if you are unfamiliar with binary numbers). All binary numbers are sent to the multiplexer using its selection pins. The position a bit appears in a binary number corresponds to which selection pin it needs to be sent on. For example, to send the binary number '10', we would set pin S1 to HIGH for '1' and S0 to LOW for '0'. Figure 1 illustrates the binary numbers you need to select particular input pins. If you would like to learn more about binary numbers in general, check out the Marching LEDs project.

Figure 1. Multiplexer truth table (4:1).

Multiplexer Sizes

The mux depicted in Fig. 1. has four inputs and one output, so it is referred to as a 4:1 (4 to 1) mux. There are many other common multiplexer sizes, including 2:1 (with 1 select input), 8:1 (with 3 select inputs), and so on. If you know how many selection inputs a mux has, you can calculate the number of data inputs. The equation below equates the number of selection pins to the maximum number of data inputs the mux will have.

\[ NumDataPins = 2^{NumSelection Pins}\]

With a bit of algebra you can also re-arrange this equation and determine how many selection pins a mux will have based on the number of data pints.

\[NumSelectionPins = log_{2}(NumDataPins)\]

The reason these equations occur is due to the fact that a multiplexer's input pins are referenced using binary numbers. This means that the number of the mux's selection pins needs to match the number of bits present in the largest input pin number.

For example, using an 8:1 there will be 8 input pins. This means we will label the input pins with 8 values, 0 through 7. Seven will be the largest number we use to reference a pin. The binary form of seven is equal to '111' which contains 3 bits. This means the multiplexer will have 3 selection pins. This can be verified using the aforementioned equations, as shown below.

\[log_{2}(8) = 3 \]

The logic we just used to find the number of selection pins can also be applied backwards. If a multiplexer has 4 selection pins, we know that the largest number used to reference an input pin can only have 4 bits. The largest possible 4 bit binary number is '1111' which equals 16. This means a multiplexer with 4 selection pins is a 16:1 mux, since it has 16 input pins. This can be verified using the aforementioned equations, as shown below.

\[ 2^{4} = 16\]

  • Other product and company names mentioned herein are trademarks or trade names of their respective companies. © 2014 Digilent Inc. All rights reserved.