How to Create a Demultiplexer Circuit

Last modified by Microchip on 2025/01/02 09:09

Overview

A demultiplexer (DEMUX) is a device that routes a single input signal to one of several output lines based on selection inputs, leaving unused outputs at 0. It operates as the inverse of a multiplexer (MUX), which combines multiple inputs into a single output. DEMUX is commonly used in communication systems to separate multiplexed signals into individual channels, in digital circuits for decoding addresses and distributing data, and in debugging logic circuits (e.g., WS2812 code with a two-output DEMUX). Using the CLB peripheral, the DEMUX logic can be configured to operate independently of the CPU, streamlining processing.

The demultiplexer uses AND gates and inverters to route the input signal (In) to the correct output based on the selection bits (sel). Each AND gate combines the input signal with specific combinations of inverted and non-inverted selection bits, following the truth table. For example, out0 uses all inverted selection bits, while out1 and out2 have sel0 and sel1 non-inverted, respectively. The diagram shows a four-output configuration.

InputsOutputs
Sel0Sel1Out0Out1Out2Out3
00In000
010In00
1000In0
11000In

MPLAB Melody CLB Demultiplexer Driver Setup

Requirements

Information

Note: This training is not intended to be demonstrable. It's provided as a solution to a specific aspect of a larger project. 

Procedure

Implement the CLB Logic

Configure the CLB to implement the demulitplexer logic. Refer to the block diagram for guidance.

Information

Note: If using MPLAB® Code Configurator (MCC), use the CLB Synthesizer tool or download the pre-configured CLB file. There are CLB files provided for the 2, 4 and 8 output demultiplexers.

Back to Top


Assign the input signal (In) to the appropriate input pin and map the selection inputs (sel) to control pins. Connect each output (out0, out1, etc.) to its designated output pin, ensuring proper routing for the intended functionality.

Back to Top


Verify the Design

Confirm the demultiplexer functionality using a debugging tool to ensure proper operation.

Back to Top

Results

This waveform demonstrates a 1-to-4 demultiplexer (demux) working correctly. The input (In) is routed to one of the four outputs (out0, out1, out2, out3) based on the selection lines (Sel0 and Sel1). For Sel0 and Sel1 combinations (00, 01, 10, 11), the input is directed to out0, out1, out2, and out3, respectively. Only the selected output mirrors the input while others remain low, confirming proper operation.
2 Input Demultiplexer Output

Learn More

Back to Top