The reverse operation of the Decoder is performed by an encoder, which is a combinational circuit. There are a total of 2n input lines and ‘n’ output lines. It will generate a binary code that is equivalent to the active High input. As a result, the encoder uses ‘n’ bits to encode 2n input lines. In encoders, representing the enable signal is optional.

**4 to 2 line Encoder:**

There are four inputs (Y0, Y1, Y2, and Y3) and two outputs (A0 and A1) in the 4 to 2 line encoder. In addition, To get the respective binary code on the output side, one input line at a time is set to true in a 4-input line. The 4 to 2 line encoder’s block diagram and truth table are shown below.

Truth table

The terms A0 and A1 are logically expressed as follows:

A_{1}=Y_{3}+Y_{2}

A_{0}=Y_{3}+Y_{1}

**Circuit Diagram**

Two input OR gates can be used to implement the aforementioned two Boolean functions. Further, The 4 to 2 encoder circuit diagram is given in the graphic below.

**Octal to Binary Encoder**

The octal to binary encoder has eight inputs, ranging from Y7 to Y0, and three outputs, A2, A1, and A0. The 8 to 3 encoder is the same as the octal to binary encoder. The following graphic depicts the block diagram of an octal to binary encoder.

Only one of these eight inputs can be ‘1’ at any given time in order to obtain the binary code. The octal to binary encoder’s truth table is presented below.

**Truth Table**

The following is the logical expression of the terms A0, A1, and A2:

A_{2}=Y_{4}+Y_{5}+Y_{6}+Y_{7}

A_{1}=Y_{2}+Y_{3}+Y_{6}+Y_{7}

A_{0}=Y_{7}+Y_{5}+Y_{3}+Y_{1}

**Circuit Diagram**

The following is the logical circuit for the above expressions:

**Uses of Encoder**

In all digital systems, these systems are relatively simple to operate.

To convert a decimal number to a binary number, encoders are employed. The goal is to complete a binary operation like addition, subtraction, multiplication, and so on.

**Disadvantages **

The disadvantages of a standard encoder are listed below.

- When all of the encoder’s outputs are 0, there is ambiguity. Because when only the least significant input is one or when all inputs are zero, it could be the code matching the inputs.
- When more than one input is set to high, the encoder generates an output that may or may not be the proper code. If both Y3 and Y6 are ‘1’, for example, the encoder outputs 111. This is neither the comparable code for Y3, when it is ‘1’, nor is it the equivalent code for Y6, when it is ‘1’.

**Interested in learning about similar topics? Here are a few hand-picked blogs for you!**