In the previous tutorial - More Combinational Circuits, the basic concepts of encoder, decoder, multiplexer and demultiplexer were discussed. An encoder is used to code digital information according to a pre-defined code system (like BCD, Gray, etc). An encoder inputs data (like from a keypad or keyboard) representing familiar numbers or characters or symbols and output coded binary numbers. So, it inputs the alphabetic characters and decimal numbers from an input device via individual wire lines and produces the outputs as binary coded representation of the input symbols.

In communication systems, encoders are used for transmitting the digital information. There, the encoders reduces the number of bits needed to represent digital information, so that, the transmission link could transfer the encoded information using fewer lines. The encoders are also used for encoding the data which is to be stored for later use as it facilitates fewer bits storing over the available space.

The decoders perform inverse operation of encoders. They are used to decode binary codes into respective minterms which in turn represent individual symbols and characters. Both encoder and decoder are combinational circuits as their output depends only on current values of the input.

In this tutorial, the encoder and decoder circuits will be constructed using 7400 Series ICs. From the previous tutorial, it must be known that a decoder can be constructed using NOT and the AND gates. In this tutorial, a 2-to-4-line decoder will be constructed using 7404 IC for NOT gates and 7411 IC for AND gates. Similarly an encoder can be constructed using OR gate, AND gate and NOT gates. Here, a 4-to-2-line encoder is constructed using 7404 IC for NOT gate, 7408 IC for AND gate and 7432 IC for OR gate.

**Components Required** -

*Fig. 1: List of components used for making SN-7400 Series IC based Encoder and Decoder*

**Circuit Diagrams -**

The 2-to-4-line decoder has the following circuit diagram -

*Fig. 2: Circuit Diagram of 2 to 4 Line Decoder*

The 4-to-2-line encoder has the following circuit diagram -

*Fig. 3: Circuit Diagram of 4 to 2 Line Encoder*

**Circuit Connections** -

Both decoder and encoder are combinational circuits. Their output depends only on the current value of inputs. Each circuit has a unique truth table from which the respective boolean expression for each output can be derived. The minimized boolean expression is then converted into logic gate diagram which is built on a breadboard using 7400 series ICs.

The following logic gate ICs are used in the construction of the circuits -

**7411 IC** - The 7411 IC is triple 3-input AND gate IC. The IC has the following pin configuration -

*Fig. 4: Table listing pin configuration of 7411 IC*

The IC has the following pin diagram -

*Fig. 5: Pin Diagram of 7411 IC*

The IC requires a supply voltage of 5V which can be tolerated up to 5.25V. The voltage at the inputs of AND gates must be 2V for high logic and 0V for low logic. The output of the AND gates has a voltage of 3.4 V for high logic and up to 0.8 V for low logic. The IC operates on positive logic system. The propagation delay while transiting from LOW to HIGH level at the output ranges between 4 to 18 ns while propagation delay while transiting from HIGH to LOW level at the output ranges between 3 to 18 ns.

**7408 IC **- The 7408 IC has quad 2-input AND gates. The IC has the following pin configuration -

*Fig. 6: Table listing pin configuration of 7408 IC*

The IC has the following Pin Diagram -

*Fig. 7: Pin Diagram of 7408 IC*

The IC requires a supply voltage of 5V which can be tolerated up to 7V. The voltage at the inputs of AND gates must be 2V for high logic and 0V for low logic. The output of the AND gates has a voltage of 3.4 V for high logic and 0.2 V for low logic. The IC operates on positive logic system. The propagation delay while transiting from LOW to HIGH level at the output is 27 ns while propagation delay while transiting from HIGH to LOW level at the output is 19 ns.

*7432 IC* - The 7432 IC has quad 2-input OR gates. The IC has the following pin configuration -

*Fig. 8: Table listing pin configuration of 7432 IC*

The IC has the following Pin Diagram -

*Fig. 9: Pin Diagram of 7432 IC*

The IC requires a supply voltage of 5V which can be tolerated up to 7V. The voltage at the inputs of OR gates must be 2V for high logic and 0V for low logic. The output of the OR gates has a voltage of 3.4 V for high logic and 0.35 V for low logic. The IC operates on positive logic system. The propagation delay while transiting from LOW to HIGH level at the output comes 3 to 15 ns while propagation delay while transiting from HIGH to LOW level at the output also comes 3 to 15 ns.

**7404 IC** - The 7404 IC has six inverting gates. The IC has the following pin configuration -

*Fig. 10: Table listing pin configuration of 7404 IC*

The IC has the following Pin Diagram -

*Fig. 11: Pin Diagram of 7404 IC*

The IC requires a supply voltage of 5V which can be tolerated up to 7V. The voltage at the inputs of NOT gates must be 2V for high logic and 0.8 V for low logic. The output of the NOT gates have a voltage of 3.4 V for high logic and 0.2 V for low logic. The IC operates on positive logic system. The propagation delay while transiting from LOW to HIGH level at the output is 22 ns while propagation delay while transiting from HIGH to LOW level at the output is 15 ns.

It must be noted that the selected ICs have compatible input, output and supply voltage levels as they are taken from a common family (74XX series) of digital ICs.

**How the circuit works** -

For constructing the 2-to-4-line decoder and 4-to-2-line encoder circuit, first of all, their truth table must be known. From the truth table, the boolean expressions for each output line can be derived. The boolean expression relates the output variables with the input variables by respective boolean equation. The derived boolean equations can be realized by interconnecting logic gates accordingly. The encoder and decoder circuits are constructed as follow -

*4-to-2-line Encoder* - An encoder is a digital circuit that performs inverse operation of a decoder. An encoder has 2^{n} input lines and n output lines. In encoder the output lines generates the binary code corresponding to the input value. In a 4-to-2-line encoder, there are four inputs representing any four symbols or characters and two outputs that generate the corresponding binary code. In an encoder circuit, it is assumed that only one input is passed at a time, so only one line is set HIGH at any given time. The circuit constructed here is based on positive logic system. It has an ambiguity that when all inputs are zero the outputs are zero. The 4-to-2-line encoder has the following truth table -

*Fig. 12: Truth Table of 4 to 2 Line Encoder*

From the above truth table, the outputs Y0 and Y1 are derived to have the following boolean expressions -

**Y0** = D3 + D2'D1

**Y1** = D3 + D2

So, the encoder circuit can be constructed using OR gate, AND gate and NOT gates. Here, for constructing the 4-to-2-line encoder 7404 IC for NOT gate, 7408 IC for AND gate and 7432 IC for OR gate are used.

*2-to-4-Line Decoder* - A decoder is a multiple input multiple output logic circuit which converts coded input into coded output where input and output codes are different. The input code generally has fewer bits than the output code. Each input code word produces a different output code word i.e. there is one to one mapping which can be expressed in truth table. In a decoder circuit, the encoded information is present as n input producing 2^{n} possible outputs. The 2n output values range from 0 to 2^{n} – 1.

A 2-to-4-line decoder can interpret 4 symbols or characters. There are two inputs that can have input values ranging from 00 to 11 and at the output, there are 4 lines. The decoder constructed here has an additional enable input to switch on and off the decoder operation. The 2-to-4-line decoder has the following truth table -

*Fig. 13: Truth Table of 2 to 4 Line Decoder*

The decoder circuit can be constructed using NOT gates and AND gates. Here, for constructing the 2-to-4-line decoder 7404 IC for NOT gate, 7411 IC for AND gate are used. Since there is enable input as well, 3-input AND gates are used.

**Testing the circuits **-

The circuits designed above can be tested by giving supply voltage to the ICs by a battery via 7805 voltage regulator. The same voltage can be dropped to 2V level using a variable resistor for HIGH logic while providing LOW logic through ground. The output signals can be checked by connecting LEDs at the output pins of each combinational circuit. The circuits can be checked by verifying truth tables for each circuit.

In the next tutorial, learn to construct multiplexer and demultiplexer circuits.