The encoder is a combinational logic circuit having multiple inputs and multiple outputs. It has 2n inputs and n inputs. The encoder is used to code the information to be transmitted.
In multiplexer, it takes multiple inputs and transmits the selected single data as output. In comparison, an encoder takes multiple inputs and produces a coded output. It is also called as a digital encoder or binary encoder.
The following figure shows the general structure of a digital encoder. It also has an enable input. The circuit will work only when enable input is set to 1.
Let us discuss some of the types, its operation and applications in the following section.
4-bit binary encoder
The 4-bit binary encoders have 4 input bits and 2 output bits. The given input data bits are coded into 2-bit output as shown in the figure below.
From the truth table, when the data input D0 is at logic 1 and all the other inputs are at logic 0, then the coded output will be BA = 00. The output will be 01, when the data input D1 = 1 and all the other inputs are 0. In the same way, when D3 = 1 and the other inputs are 0, the output produced is BA = 11.
But when two or more data inputs are at logic 1 in a particular time, then the produced output will not be correct. For example, when D1 and D2 are having logic HIGH values at the same time. The obtained result will neither be 01 nor 10, but it will be some other incorrect value.
To overcome this problem, priority is set for each input data pins. If more than one input has a logic HIGH value, then the output code corresponds to the input at the data pin with the highest priority. The encoders designed with such priority levels are called as priority encoder.
The priority encoder is an encoder with a priority function. If two or more inputs have the same value, then the output will be corresponding to the inputs having the highest priority.
4-bit priority encoder
A 4-bit priority encoder has 4 active-low inputs and 2 coded outputs. The four inputs D3, D2, D1, D0 has a different priority. D3 has the highest priority, whereas D0 has the lowest priority.
The following table shows the truth table for the logic circuit. When D3 input is high, irrespective of other inputs, the output will be AB = 11. When D3 input is low, D2 has the next higher priority. Irrespective of the other inputs, the output will be BA = 10.
Similarly, When D3 and D2 inputs are low, D1 takes the next higher priority. In this case, irrespective of D0 input, the output will be BA = 01.
The output expression for the 4-bit priority encoder can be obtained by using the Karnaugh map(K-map) method.
From the K-map simplification, we have got two output expressions for A and B as shown above. The circuit of 4-bit priority encoder can be drawn from the obtained expressions as shown below.
Octal to binary encoder
It has eight octal inputs and three coded binary outputs. When anyone input goes high, the corresponding output is produced as shown in the truth table below.
For example, when D2 is at logic 1, the output produced will be 010. When the data input D5 has HIGH input. the output produced will be 101. In this way, the eight octal bits are coded.
From the truth table, three expressions can be obtained for three outputs A, B and C. The expressions can be obtained by either plotting a K-map or by simply writing the expressions by observing the truth table.
The output expressions for A can be written in such a way that, the output is HIGH only when the data inputs D4, D5, D6, and D7 are at logic 1. Similarly, the output of B is at logic 1 when the inputs D2, D3, D6 and D7 are at logic HIGH. The output of C is at logic HIGH when the data inputs D1, D3, D5 and D7 are at logic HIGH.
The expressions are as follows
A = D4 + D5 + D6 + D7
B = D2 + D3 + D6 + D7
C = D1 + D3 + D5 + D7
For the obtained expression, the combinational logic circuit for octal to binary encoder is drawn below.
There are different ICs used for encoding purposes. The encoder IC 74147 performs Decimal to BCD function. Similarly, IC 74148 performs an 8-input priority encoder.
The encoders are used in several applications like
- Position control in the navigation of ships, robotic arm positioning.
- Encoders are used to reduce the number of connections and wires in electronic circuits in applications like keyboard or keypads.
- Priority encoders detect the interrupts in the microprocessor applications.
- It is used to transmit a binary code over a network to protect it from hackers.