MOULDLKnowledge BaseElectrical Knowledge Base3D Model DownloadsMembership
中文版Model Store »
Knowledge Base › Electrical Knowledge Base › Implementing combinational logic with a decoder
HomeModels
Table of contents

On this page

Electrical & Electronic Basics (600 articles)

Quick Reference

  • PLC & Programming
  • Electrical & Electronic Basics (monthly)(每月更新中)
  • Electrical Control & Drawings (monthly)(每月更新中)
  • Drives & Actuators (monthly)(每月更新中)
  • Sensors & Detection (monthly)(每月更新中)
  • Industrial Communication & Networks (monthly)(每月更新中)
  • HMI & Host Systems (monthly)(每月更新中)
  • Industrial Robots & Motion Control (monthly)(每月更新中)
  • Mechatronic System Integration (monthly)(每月更新中)
  • Fault Diagnosis & Standards (monthly)(每月更新中)

Implementing combinational logic with a decoder

A decoder like 74LS138 turns an address into one active output, and in reverse it acts as a minterm generator for any combinational function. This page shows the method.

1. How it works

A 3 to 8 decoder 74LS138 turns address CBA into exactly one of eight low active outputs, so it naturally produces the eight minterms, one per address. The function to implement is written as a sum of minterms, and those minterm outputs are gathered with a NAND (or OR) to form the function. This decoder expansion beats pure gates in chip count and clarity.

2. Practice and pitfalls

Steps: list the truth table; find the minterms where the function is 1; enable the 138 and connect the three address bits to the input variables; gather the corresponding minterm outputs (low active) with a NAND then invert, or use NOR. Set enables G1 high and G2 low correctly. For more variables cascade two 138s into a 4 to 16 decoder covering more minterms.

3. Decoder logic

StepDoNote
EnableG1 high G2 lowelse off
Addressto variablesbit order
Mintermfind 1 termslow active
CollectNAND mergethen invert
Cascadeto 4-16chip select
Trapactive leveldont flip

4. Notes

The 138 generates minterms; gather the function equals 1 minterm outputs with a NAND then invert to get the logic. Key is correct enable, address bit order, low active outputs via NAND not direct OR, and for expansion the chip select allocation.

5. References

The quantities and component characteristics discussed here follow current national standards and the corresponding IEC documents: Decode and logic per GB/T 4728; control to GB/T 5226.1 and IEC 60204-1. Always check the device datasheet and the product design file for ratings and derating.

6. Cautions

⚠️ Three common pitfalls:
① Wrong G1 G2 enable leaves the decoder inert.
② Treating low active output as high active flips the OR logic.
③ Wrong minterm bit order gives the wrong function.

Locate the issue with the approach above, then confirm with measurements; safety-related circuits must follow the standards and manufacturer requirements.

Related reading

Related 3D models: Ready to build it? Download free 3D models & CAD drawings at MOULDL »
MOULDL · Electrical Knowledge Base · free self-study reference for electrical & automation engineers, 3D CAD models at MOULDL