Encoder

Comprehensive study notes, diagrams, and exam preparation for Encoder.

Encoder

Definition

An encoder is a combinational logic circuit that converts an active input signal into a coded output, usually a binary code. In its simplest form, an encoder has 2^n input lines and n output lines, where only one input is assumed to be active at a time. The output represents the binary position of the active input.

For example, a 4-to-2 encoder takes 4 input lines and produces 2 output lines. If input line I2 is active, the output becomes 10, which is the binary representation of 2.


Main Content

1. Basic Concept of Encoder

  • An encoder performs the reverse operation of a decoder. While a decoder converts binary information into one of many outputs, an encoder compresses many input lines into fewer output lines.
  • It is used when a system needs to identify which one of many inputs is active and represent that information in binary form.

An encoder is especially useful in digital systems where a large number of switches, keys, or interrupt lines must be represented using fewer wires. Instead of sending separate signals for each input, the encoder converts the active input into a compact binary code.

Example: If four input switches I0, I1, I2, I3 are available and only I3 is pressed, the encoder output is 11, which corresponds to decimal 3.

Simple representation of a 4-to-2 encoder:

I0 ─┐
I1 ─┼──> Encoder ──> Y1 Y0
I2 ─┼
I3 ─┘

2. Types of Encoder

Simple encoder

  • Assumes only one input is active at a time. If more than one input is active, the output may become undefined or incorrect.

Priority encoder

  • Gives priority to the highest-order active input when multiple inputs are active simultaneously.

A priority encoder is more practical in real systems because multiple inputs may be active at the same time. It resolves ambiguity by assigning priority levels. For example, if inputs I3 and I1 are both active in a 4-input priority encoder, the output may represent I3 because it has higher priority.

Common forms of encoders:

4-to-2 encoder

8-to-3 encoder

16-to-4 encoder

Priority encoders with enable input

Priority encoder idea:

I3  (highest priority)
I2
I1
I0  (lowest priority)

If more than one input is 1, the encoder selects the highest active input.

3. Logic Operation and Truth Table

  • The output of an encoder is determined by the input combination and the binary code assigned to the active line.
  • Each output bit is generated using Boolean expressions derived from the input lines.

For a simple 4-to-2 encoder:

Input Y1 Y0
I0 = 1 0 0
I1 = 1 0 1
I2 = 1 1 0
I3 = 1 1 1

Boolean expressions:

  • Y1 = I2 + I3
  • Y0 = I1 + I3

Here, + represents OR operation. These equations show that the output bits depend on which inputs are active.

Important note:

  • A basic encoder works correctly only when one input is high at a time.
  • If I1 and I2 are both high together, the output may not correctly indicate a single valid binary code unless it is a priority encoder.

Working / Process

  1. The input line corresponding to the event, key, or signal becomes active.
  2. The encoder detects the active input and converts its position into a binary code.
  3. The output lines present that binary code to the next stage of the digital system.

Example process for a 8-to-3 encoder:

  • If I5 = 1, then the output becomes 101
  • This binary output indicates that input 5 is active

Advantages / Applications

  • Reduces the number of wires needed in a digital system by converting many inputs into fewer output bits.
  • Used in keyboard encoding, interrupt handling, and data compression in control circuits.
  • Helps digital systems identify active input lines quickly and efficiently.
  • Common in microprocessor systems, digital communication, and priority request handling.

Applications:

Keyboard encoding

  • Keys are converted into binary codes for processing.

Interrupt controllers

  • Multiple devices request service, and the encoder identifies the highest-priority request.

Data acquisition systems

  • Active sensor or switch signals are encoded into binary form.

Digital devices

  • Used in machines, control panels, and communication interfaces.

Summary

  • An encoder is a combinational circuit that converts an active input into a binary code.
  • Priority encoders are used when multiple inputs may be active at the same time.
  • Encoders reduce hardware complexity by reducing many input lines into fewer output lines.
  • Important terms to remember: encoder, priority encoder, binary code, active input, combinational logic