MOULDLKnowledge BaseElectrical Knowledge Base3D Model DownloadsMembership
中文版Model Store »
Knowledge Base › Electrical Knowledge Base › Encoder and priority encoder working
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)(每月更新中)

Encoder and priority encoder working

An encoder turns the active one of many inputs into binary, and a priority encoder honors only the highest priority. This page explains the principle and 74LS148 use.

1. How it works

A normal encoder has 2 to the n inputs and n outputs, allowing only one input active at a time and outputting its binary code; an 8 to 3 encoder turns active line 5 into 101. If several go active it errors, so inputs must be mutually exclusive. Used for keyboard scan and position coding, compressing state into compact binary.

2. Practice and pitfalls

A priority encoder like 74LS148 allows several inputs active and responds only to the highest priority (usually smallest or largest number), outputting its code plus a GS (group select) valid flag. This solves which of many interrupt sources to serve first by hardware arbitration; software reads the code to know who. The EI enable cascades to expand lines.

3. Encoder compare

TypeMulti activeOutput
Normalerrorsits code
Prioritytop priorityplus GS
74LS1488 in 3 outlow inv code
EIcascade enexpand
Usekey intarbitrate
Trapforget GSfalse none

4. Notes

A normal encoder needs exclusive inputs; a priority encoder like 74LS148 takes the highest priority and gives a GS flag. Use priority for interrupt arbitration and read GS before trusting the code; note the output is often low true inverted and EI cascades one way.

5. References

The quantities and component characteristics discussed here follow current national standards and the corresponding IEC documents: Encoding and interrupt 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:
① Using normal as priority errors when many inputs are active.
② Forgetting to read GS mistakes no valid input for a code.
③ Reading low true inverted output as straight code flips logic.

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