Jump to content

Electronics/Decoders and Encoders

From Wikibooks, open books for an open world

Encoders

[edit | edit source]

Encoders are devices that act on data to transform it in such a way that the data acquires some new characteristics. These characteristics can vary from reduction in length to inclusion of error correction properties to use of security measures. At the most basic level, encoders can be used to reduce the size of data. Consider the following block diagram :

      ____
A ---|    |
B ---|    |-- X
C ---|    |-- Y
     |____|


If out of ABCD only one is high at any given time, then we can only have the following possibilities for input : 000, 001, 010, 100. Thus we can make the internal circuit of the encoder in such a way that when it sees 000 it outputs 00, when it sees 001 it outputs 01, when it sees 010 it gives 10 and when it sees 100 it outputs 11


    __________
---| 000 | 00 |
---|-----|----|
---| 001 | 01 |
---|-----|----|
---| 010 | 10 |
---|-----|----|
---| 100 | 11 |
---|_____|____|


Thus we have effectively reduced the size of the data, by exploiting the fact that all possible combinations of input will never be provided at the input terminals.

The internal circuit of the encoder can be easily derived by using truth tables


    _____________________
---| A | B | C ||| X | Y |
---| 0 | 0 | 0 ||| 0 | 0 |
---| 0 | 0 | 1 ||| 0 | 1 |
---| 0 | 1 | 0 ||| 1 | 0 | 
---| 1 | 0 | 0 ||| 1 | 1 |
---|___|___|___|||___|___|


Clearly X = A + B and Y = A + C

So the circuit diagram can be :

A ----------[ OR ]----------X
    |   B---[ OR ]
    |
    |-------[ OR ]----------Y
        C---[ OR ]

This scheme can be extended for n inputs.

This was a very basic encoder, it could act only on data when a single line was high. It is possible that multiple lines may be high, in that case one may use priority encoders which assign output based on priority, that is if two lines are high, for example A and C in the previous example, then a priority encoder will, based on a prior decision by the designer, decide to assign output to either C or A thereby assigning it a higher priority.

In some cases we don't want priority encoding, rather when faced with multiple signals, we wish to create a new code for that particular combination as well, and still obtain some reduction in size.

At other times we may wish to modify the incoming code in a manner that allows the receiver to detect any errors that may have crept in during transmission. These topics will be elaborated upon in appropriate topics.