DECODER AND ENCODER

DECODER AND ENCODER

 

                                       Decoder

In digital electronics, a decoder can take the form of a multiple-input, multiple-output logic circuit that converts coded inputs into coded outputs, where the input and output codes are different e.g. n-to-2n , binary-coded decimal decoders. Decoding is necessary in applications such as data multiplexing, 7 segment display and memory address decoding.

The example decoder circuit would be an AND gate because the output of an AND gate is “High” (1) only when all its inputs are “High.” Such output is called as “active High output”. If instead of AND gate, the NAND gate is connected the output will be “Low” (0) only when all its inputs are “High”. Such output is called as “active low output”.

A slightly more complex decoder would be the n-to-2n type binary decoders. These types of decoders are combinational circuits that convert binary information from ‘n’ coded inputs to a maximum of 2n unique outputs. In case the ‘n’ bit coded information has unused bit combinations, the decoder may have less than 2n outputs. 2-to-4 decoder, 3-to-8 decoder or 4-to-16 decoder are other examples.

The input to a decoder is parallel binary number and it is used to detect the presence of a particular binary number at the input. The output indicates presence or absence of specific number at the decoder input.

Let us suppose that a logic network has 2 inputs A and B. They will give rise to 4 states A, A’, B, B’ . The truth table for this decoder is shown below:

Table 1: Truth Table of 2:4 decoder

 

 

 

Fig 1: Logic Diagram of 2:4 decoder

 

Fig 2: Representation of 2:4 decoder

 

For any input combination only one of the outputs is low and all others are high. The low value at the output represents the state of the input.                             

It uses all AND gates, and therefore, the outputs are active- high. For active- low outputs, NAND gates are used. It has 3 input lines and 8 output lines. It is also called as binary to octal decoder it takes a 3-bit binary input code and activates one of the 8(octal) outputs corresponding to that code. The truth table is as follows:

 

Table 2: Truth Table of 3:8 decoder

 

Fig 3: Logic Diagram of 3:8 decoder

 

                                        Encoder

An encoder is a device, circuit, transducer, software program, algorithm or person that converts information from one format or code to another. The purpose of encoder is standardization, speed, secrecy, security, or saving space by shrinking size. Encoders are combinational logic circuits and they are exactly opposite of decoders. They accept one or more inputs and generate a multibit output code.

 

Encoders perform exactly reverse operation than decoder. An encoder has M input and N output lines. Out of M input lines only one is activated at a time and produces equivalent code on output N lines. If a device output code has fewer bits than the input code has, the device is usually called an encoder.