Encoder-Decoder
Definition
An encoder is a combinational circuit that converts one active input line among many into a coded binary output.
A decoder is a combinational circuit that converts coded binary input into one active output line among many.
Together, encoder and decoder circuits are used for data compression, code conversion, addressing, and control applications in digital systems.
Main Content
1. Encoder
- An encoder has
2^ninput lines andnoutput lines, where each input line corresponds to a unique binary code at the output. - Only one input is assumed to be active at a time in a basic encoder. For example, if input line
D3is active in a 4-to-2 encoder, the output becomes11because binary 3 is11.
An encoder reduces the number of wires required to represent data. Instead of sending separate signals for many lines, it sends a compact binary code. This is especially useful in keyboards, interrupt controllers, and priority systems.
Example: 4-to-2 Encoder
| Input | Output |
|---|---|
| D0 | 00 |
| D1 | 01 |
| D2 | 10 |
| D3 | 11 |
If D2 = 1, then the output is 10.
Basic idea of encoder logic:
- Inputs are decoded into binary code.
- Output bits represent the position of the active input.
- It saves hardware and simplifies transmission.
ASCII view of a simple encoder:
D0 ----\
D1 -----\
D2 ------> [ 4-to-2 Encoder ] ---> Y1 Y0
D3 -----/
2. Decoder
- A decoder has
ninput lines and2^noutput lines, where each output line represents one possible input combination. - When a particular binary input is applied, only the corresponding output becomes active.
A decoder is used when a system needs to select or activate one line from many. It is widely used in memory address decoding, demultiplexing, display control, and instruction decoding.
Example: 2-to-4 Decoder
| Input A | Input B | Active Output |
|---|---|---|
| 0 | 0 | Y0 |
| 0 | 1 | Y1 |
| 1 | 0 | Y2 |
| 1 | 1 | Y3 |
If input is 10, then output Y2 becomes active.
Typical decoder output equations:
Y0 = A'B'Y1 = A'BY2 = AB'Y3 = AB
ASCII view of a simple decoder:
A ----\
B -----> [ 2-to-4 Decoder ] ---> Y0 Y1 Y2 Y3
3. Encoder-Decoder Relationship and Types
- Encoders and decoders are complementary circuits: an encoder compresses many inputs into fewer coded outputs, while a decoder expands coded inputs into many outputs.
- Both can be designed using basic logic gates such as AND, OR, and NOT, and they may include enable inputs for control purposes.
There are several important types of encoders and decoders:
Types of Encoders
Simple Encoder
- Assumes only one active input at a time.
Priority Encoder
- Gives priority to the highest-order input if more than one input is active. This is more practical in real-world systems.
Decimal-to-BCD Encoder
- Converts decimal input lines into BCD output code.
Types of Decoders
Binary Decoder
- Converts binary input into one of many outputs.
BCD-to-Decimal Decoder
- Converts BCD input into decimal output selection.
Seven-Segment Decoder
- Converts binary or BCD input into signals required to display digits on a seven-segment display.
Enable Decoder
- Works only when an enable signal is active.
Priority Encoder Example
If inputs D3 = 1 and D1 = 1 are active simultaneously, the output will represent D3 because it has higher priority.
This makes priority encoders useful in interrupt handling, where the most important request must be serviced first.
Working / Process
- In an encoder, one input line is activated, and the circuit generates the corresponding binary code at the output.
- In a decoder, binary input is applied, and the circuit activates only the matching output line.
- In practical systems, enable signals, priority rules, and gate combinations are used to make encoder-decoder circuits reliable and efficient.
Advantages / Applications
- Reduces the number of communication lines by converting many inputs into compact binary outputs.
- Used in memory address decoding, keyboard encoding, interrupt handling, and display systems.
- Improves circuit efficiency by simplifying data selection, signal routing, and code conversion.
Summary
- Encoder converts many inputs into a coded output, and decoder converts coded input into selected outputs.
- They are important combinational circuits used for data representation and selection.
- Priority encoders and seven-segment decoders are commonly used in real digital systems.
- Important terms to remember: encoder, decoder, priority encoder, binary decoder, enable, BCD, seven-segment decoder