A decoder is a combinational circuit that converts a binary code into a set of output signals. It has N input lines and 2N output lines. The decoder takes the binary code on its N input lines and activates the output line corresponding to the binary code.
The most commonly used decoder is the binary decoder, which converts a binary input code into a set of outputs. The binary decoder has N input lines (A0 to An-1) and 2N output lines (Y0 to Y2N-1). The decoder enables only one output at a time for a specific combination of input bits.
The implementation of a decoder depends on the number of input and output lines. The implementation of a 2-to-4 line decoder with enable is shown below:
In this circuit, there are two input lines A, B, and four output lines F3 to F0.
The binary input code applied to the two input lines A and B selects one of these four output lines. The output line corresponding to the binary code of the inputs will have a HIGH voltage level or logic 1, while all other output lines will have a LOW voltage level or logic 0.
For example, if A=0 and B=1, the binary code applied to the decoder is 01, which corresponds to output line F1. Thus, the output F1 will be 1 (HIGH voltage level) and all other outputs (F3, F2 and F0) will be 0 (LOW voltage level).
An enable (E) pin can be added to the circuit to disable the decoder. Outputs F3 to F0 will have valid values only when E=0, else they will be zero.
Decoders can be used in various digital circuits, such as address decoding in memory and input/output devices, data conversion, and data encryption.