# Encoders

An encoder is a combinational circuit that performs reverse function of a decoder. It accepts 2n input and produces output in n output lines. This process of generating codes based on the values of input lines is called encoding.

## 4 to 2 Line Encoder

A 4 to 2 line encoder consists of 4 input lines and 2 output lines. When any of the input lines becomes 1, we get corresponding binary at the output lines.

Truth table of 4 to 2 line encoder is,

InputOutput
Y3Y2Y1Y0A1A0
000100
001001
010010
100011

From the truth table, we can find logic expressions for A0 and A1 as following,

The circuit diagram for a 4 to 2 line encoder is shown below,

## Octal to Binary Encoder

An 8 to 3 line encoder or octal to binary encoder consists of 8 input lines and 3 output lines. When any of the input lines becomes 1, we get corresponding binary at the output lines.

Truth table of 8 to 3 line encoder is,

InputsOutput
Y7Y6Y5Y4Y3Y2Y1Y0A2A1A0
00000001000
00000010001
00000100010
00001000011
00010000100
00100000101
01000000110
10000000111

From the truth table, we can find logic expressions for A0, A1 and A2 as following,

The circuit diagram for a 8 to 3 line encoder is shown below,