Decoders & Encoders

Decoders & Encoders

Encoders
An encoder is a device used to change a signal (such as a bitstream) or data into a code. The code may serve any of a number of purposes such as compressing information for transmission or storage, encrypting or adding redundancies to the input code, or translating from one code to another. This is usually done by means of a programmed algorithm, especially if any part is digital, while most analog encoding is done with analog circuitry.
Decoders
decoder is a device which does the reverse of an encoder, undoing the encoding so that the original information can be retrieved. The same method used to encode is usually just reversed in order to decode.
In digital electronics this would mean that a decoder is 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, BCD decoders.
Enable inputs must be on for the decoder to function, otherwise its outputs assume a single “disabled” output code word. Decoding is necessary in applications such as data multiplexing, 7 segment display and memory address decoding.
The simplest decoder circuit would be an AND gate because the output of an AND gate is “High” (1) only when all its inputs are “High“. A slightly more complex decoder would be the n-to-2n type binary decoders. These type of decoders are combinational circuits that convert binary information from ‘n’ coded inputs to a maximum of 2n unique outputs.
We say a maximum of 2n outputs because in case the ‘n’ bit coded information has unused bit combinations, the decoder may have less than 2n outputs. We can have 2-to-4 decoder, 3-to-8 decoder or 4-to-16 decoder. We can form a 3-to-8 decoder from two 2-to-4 decoders (with enable signals).
One application where digital signals are used to enable a device is to identify the unique conditions to enable an operation. For example, the magnetron in a microwave is enabled only when the timer is running and the start button is pushed and the oven door is closed.
This method of enabling a device based on the condition of a number of inputs is common in digital circuits. One common application is in the processor’s interface to memory. It is used to determine which memory device will contain a piece of data.
In the microwave example, the sentence used to describe the enabling of the magnetron joined each of the inputs with the word “and”. Therefore, the enabling circuit for the magnetron should be realized with an AND gate as shown in image below
img
Decoder circuits are a group of enable circuits that have an individual output that satisfies each row of the truth table. In other words, a decoder has a unique output for each combination of ones and zeros possible at its inputs.
For example, a 2-input decoder circuit with inputs A and B can have an output that is 1 only when A=0and B=0, an output that is 1 only when A=0 and B=1, an output that is 1 only when A=1 and B=0, and an output that is 1 only when A=1 and B=1.
The Boolean expressions that satisfy this decoder circuit are:
img
This two-input circuit is called a 1-of-4 decoder due to the fact that exactly one of its four outputs will be enabled at any one time. A change at any of the inputs will change which output is enabled, but never change the fact that only one is enabled. As for the logic circuit, it has four AND gates, one satisfying each of the above Boolean expressions.
Image below presents this digital circuit.
img