An encoder is a combinational circuit that converts a set of inputs into a binary code. It has multiple input lines and a single output line. The encoder detects the active input and generates a binary code corresponding to that input.

There are two main types of encoders: the priority encoder and the binary encoder.

  • Priority Encoder : This is used when there are multiple active inputs, and it gives priority to the input with the highest priority. It produces an n-bit binary code representing the highest priority active input, where n is the number of input lines.
  • Binary Encode : Also known as a simple encoder, generates a binary code for each input combination. It has 2n input lines and n output lines, where n is the number of input lines.

The implementation of a 4-to-2 line binary encoder is shown below:

In this circuit, there are four input lines Y3 to Y0 and two output lines F1 and F0. The encoder generates a binary code depending on which input is activated.

For example: if Y2 is active (HIGH voltage level) and all other inputs Y0, Y1, and Y3 are inactive (LOW voltage level), the encoder will output the binary code 10.

Encoders find a wide range of applications in digital circuits, such as data compression, data transmission, and error detection and correction.

Note that the above encoder circuit will always be on, and it would need an enable bit to validate its outputs when required.