logica-combinacional-multiplexor-decodificador

Combinational Logic: Multiplexers and Decoders

  • 4 min

Combinational logic is digital electronics without memory. The output depends solely on the current state of the inputs: there is no past, no history, only what is happening right now matters.

So far we have seen individual logic gates (AND, OR, NOT…). But when we start combining many of these gates to perform more useful tasks, we enter this domain.

The main characteristic of these circuits is that they have no memory. The output depends exclusively on the current state of the inputs. If you remove the inputs, the output disappears or changes instantaneously.

Today we will meet the two most important traffic controllers in digital electronics: the multiplexer (which selects paths) and the decoder (which identifies addresses).

ComponentFunctionAnalogyMain Use
Multiplexer (MUX)Many OneTV input selectorExpanding inputs (reading many sensors).
DecoderBinary 1 activeMail sorterSelecting chips (chip select), driving displays.
DemultiplexerOne ManyTrain switchDistributing one signal to multiple destinations.

The Multiplexer (MUX): The Selector

Imagine you have only one analog input on your microcontroller, but you want to read 8 different sensors. How do you do it?

You need a digital “rotary switch”. That is a multiplexer.

A MUX is a device that has multiple data inputs and a single output. Using control pins (selectors), we decide which input is connected to the output.

Operation

The relationship is very simple: with n control pins we can select between inputs.

  • Data inputs: (8 inputs).
  • Selectors: (3 pins, because ).
  • Output: .

If we apply the binary 000 (0 decimal) to the selectors, the output is connected to . If we apply 101 (5 decimal), the output is connected to .

The king of MUX: 74HC4051 / CD4051 is the most famous chip in the world of microcontrollers for expanding inputs.

It is an 8-channel analog/digital multiplexer. With only 3 digital pins and 1 analog pin, we can read 8 potentiometers!

The Decoder

The decoder does the inverse work of an encoder. Its main function is to translate a binary code into a single active output.

Imagine your processor wants to talk to one of its 8 memory chips. The processor sends the address “5” in binary (101). The decoder receives this code and activates only output number 5, keeping all others off.

In most commercial decoders (like the 74HC series), the outputs are active low (they go to 0V when activated and to 5V when idle). This is because most chip select pins work this way.

Operation (One-Hot Encoding)

  • Inputs: Binary code (e.g., 3 bits).
  • Outputs: lines (e.g., 8 lines).
  • Behavior: Only ONE output is active at a time.

The king of decoder: 74HC138, a 3-to-8 line decoder.

  • You feed it a number from 0 to 7 in binary on its A, B, C pins.
  • It sets the corresponding output (Y0 to Y7) to LOW.

The Demultiplexer (DEMUX): The Distributor

You will often see the term demultiplexer. In reality, it is the same hardware as the decoder, but used in a different way.

While the MUX is “many to one”, the DEMUX is “one to many”.

  • It has a common data input.
  • It has multiple outputs.
  • It has selectors.

Depending on the number we set on the selectors, the data from the input is sent to the chosen output. It is like a train switch.

Most decoder chips can act as demultiplexers if we use their enable pin as a data input.