ENCODER
This digital circuit does the exact opposite of the function of a decoder. An encoder is a combinational circuit that performs the inverse operation of a decoder. It converts the information from 2 n to n lines.
Basically, it accepts an active level on one of its inputs representing a digit, such as Decimal, Octal or Hex Digit, and converts it to a Coded Output such as BCD or Binary. Generally, digital encoders produce outputs of 2-bit, 3-bit or 4-bit codes depending upon the number of data input lines. An “n-bit” binary encoder has 2n input lines and n-bit output lines with common types that include 4-to-2, 8-to-3 and 16-to-4 line configurations. The output lines of a digital encoder generate the binary equivalent of the input line whose value is equal to “1” and are available to encode either a decimal or hexadecimal input pattern to typically a binary or “B.C.D” (binary coded decimal) output code.
The simplest encoder is a 2n-to-n binary encoder, where it has only one of 2n inputs = 1 and the output is the n-bit binary number corresponding to the active input. Let's begin making a 2-to-1 line encoder truth table by reversing the 1-to-2 decoder truth table.
For comparison, here is the simplest 1-to-2 line decoder. The truth table and the circuit.
The 2-to-1 line ENCODER will have the reverse of the Truth Table above.
A complete truth table would be as follows and its Logic Circuit.
Some Examples of Encoders are the following.
Priority encoders
Decimal to BCD encoder
Octal to binary encoder
Hexadecimal to binary encoder
One of the main disadvantages of standard digital encoders is that they can generate the wrong output code when there is more than one input present at logic level “1”. For example, if we make inputs D1 and D2 HIGH at logic “1” both at the same time, the resulting output is neither at “01” or at “10” but will be at “11” which is an output binary number that is different to the actual input present. Also, an output code of all logic “0”s can be generated when all of its inputs are at “0” OR when input D0 is equal to one.
One simple way to overcome this problem is to “Prioritise” the level of each input pin and if there was more than one input at logic level “1” the actual output code would only correspond to the input with the highest designated priority. Then this type of digital encoder is known commonly as a Priority Encoder or P-encoder for short.
Priority Encoder
The Priority Encoder solves the problems mentioned above by allocating a priority level to each input. The priority encoders output corresponds to the currently active input which has the highest priority. So when an input with a higher priority is present, all other inputs with a lower priority will be ignored. This is a special type of encoder. Priority is given to the input lines. If two or more input line are 1 at the same time, then the input line with highest priority will be considered. There are four input D0, D1, D2, D3and two output Y0, Y1. Out of the four input D3 has the highest priority and D0 has the lowest priority. That means if D3 = 1 then Y1 Y1 = 11 irrespective of the other inputs. Similarly if D3 = 0 and D2 = 1 then Y1 Y0 = 10 irrespective of the other inputs. Below is a 4-to-2 Bit Priority Encoder.
In Simple terms, a 4-bit priority encoder (also sometimes called a priority decoder), basically converts the 4-bit input into a binary representation. If the input n is active, all lower inputs (n-1 .. 0) are ignored:
The priority encoder comes in many different forms with an example of an 8-input priority
encoder along with its truth table shown below.
Priority encoders are available in standard IC form and the TTL 74LS148 is an 8-to-3 bit priority encoder which has eight active LOW (logic “0”) inputs and provides a 3-bit code of the highest ranked input at its output. Priority encoders output the highest order input first for example, if input lines “D2“, “D3” and “D5” are applied simultaneously the output code would be for input “D5” (“101″) as this has the highest order out of the 3 inputs. Once input “D5” had been removed the next highest output code would be for input “D3” (“011″), and so on.
The truth table for a 8-to-3 bit priority encoder is given as:
NOTE: The above TRUTH Table is also the same for the Octal-to-binary Encoder
From this truth table, the Boolean expression for the encoder above with inputs D0 to D7 and outputs Q0, Q1, Q2 is given as:
Output Q0
Output Q1
Output Q2
Then the final Boolean expression for the priority encoder including the zero inputs is defined as:
In practice these zero inputs would be ignored allowing the implementation of the final Boolean expression for the outputs of the 8-to-3 priority encoder above to be constructed using individualOR gates as follows.
The 74148 is an 8-input Priority Decoder. Just like the Decoders, we could combine Smaller Encoders to form a Bigger ones. Combining 2 chips of 74148 (2 X 8-to-3 ) will form a 16-to-4 Line Encoder, as shown below.
Another type of Encoder : Decimal-to-BCD Encoder
TRUTH TABLE And its Logic Circuit
Application: KeyBoard Encoder.
End of Encoders