What is the Key Difference Between Decoder and Encoder?
Encoder and Decoder are both combinational logic circuit that is used to convert between message signal and binary coded decimal BCD. They are used in a communication system to encode or decode any message signal. Combinational logic circuits are made of basic logic gates.
The main difference between encoder and decoder is that encoder output is BCD while decoder input is BCD. Their operation is quite opposite of each other. Other than that they have various other differences explained in this article.
Before going into the list of differences between encoder and decoder, let’s introduce them first.
Combinational Logic Circuit
A type of logic circuit whose output only depends on the level of the current input. Whereas in sequential logic the output depends on current as well as previous input. It is made of combinations of basic logic gates without any memory units.
Logic circuits are either combinational logic circuits or sequential logic circuit.
Related Posts:
- Difference Between Microprocessor and Microcontroller
- Difference Between 8085 & 8086 Microprocessor – Comparison
What is Encoder?
An encoder is a combinational logic circuit that converts any active or msg signal into a coded (especially BCD) signal. It is also known as a binary encoder or digital encoder. It has ‘2n‘ number of input lines and ‘n’ number of output lines. It encodes a signal into binary code. Here is a figure of a general encoder.
Each input line is associated with only one output. When an input line is ‘high’ a binary output for that line is generated. Therefore only one input can be high at a time. However, if there is more than one ‘high’ input, it is considered invalid input. To avoid such problem, priority encoders are used to prioritize the most significant line and provide an output based on that significant line.
Here is a 4 to 2 line encoder:
It has 4 input lines D0, D1, D2, D3 and 2 output lines X0, X1. It converts input into a 2-bit BCD signal. Only one of the inputs can be high at a time otherwise the output will be ambiguous. Each input line provides a single combination of BCD as shown in the table.
Input | Output | ||||
D0 | D1 | D2 | D3 | X1 | X0 |
1 | 0 | 0 | 0 | 0 | 0 |
0 | 1 | 0 | 0 | 0 | 1 |
0 | 0 | 1 | 0 | 1 | 0 |
0 | 0 | 0 | 1 | 1 | 1 |
The Boolean function for each output of the given truth table is
X1 = D2 + D3
X0 = D1 + D3
The given Boolean functions can be implemented using simple OR gates as shown below.
Encoders are also used to convert other data formats into binary such as
- Hexadecimal into binary encoder
- Decimal into binary encoder
- Octal into binary encoder
Related Post: Binary Encoder – Construction, Working, Types & Applications
What is Decoder?
A binary decoder or digital decoder converts BCD (binary coded decimal) into an active message signal. It operates exactly in reverse to the encoder. It has ‘n’ number of input lines and ‘2n‘ number of output lines. It decodes the BCD into separate output lines. Here is a general decoder figure.
It had multiple output lines each line associated with a single BCD at the input. Therefore only one output line can be high at a time. There are no invalid conditions.
Here is a 2 to 4 line decoder.
It has 2 input lines D0, D1 and 4 output lines X0, X1, X2, X3. It generates the original message signal from the 2-bit BCD signal. Each input combination provides only one output and only one output line will be high as shown in the truth table.
Input | Output | |||||
E | D1 | D0 | X0 | X1 | X2 | X3 |
0 | – | – | 0 | 0 | 0 | 0 |
1 | 0 | 0 | 1 | 0 | 0 | 0 |
1 | 0 | 1 | 0 | 1 | 0 | 0 |
1 | 1 | 0 | 0 | 0 | 1 | 0 |
1 | 1 | 1 | 0 | 0 | 0 | 1 |
Since the output at X0 is ‘high’ when both inputs are ‘low’. It will still be high even if there is no input at all or the inputs are not connected, it can create a problem. Therefore there is an enable E input that enables the input and provides output based on the input.
The Boolean function for each output is
X0 = D0‘.D1‘
X1 = D0‘.D1
X2 = D0.D1‘
X3 = D0.D1
These Boolean functions for the outputs can be implemented using NOT and AND gates as given below.
Main Differences between Encoder and Decoder
The following table shows the comparison between decoder and encoder.
Encoder | Decoder |
It converts message signal into binary coded decimal BCD. | It converts binary coded decimal BCD into the original message signal. |
Symbol of Encoder: ![]() |
Symbol of Decoder: ![]() |
It has ‘2n’ number of inputs. | It has ‘n’ number of inputs. |
It has ‘n’ number of outputs. | It has ‘2n‘ number of outputs. |
It takes the original message signal as input. | It takes encoded BCD signal as input. |
Its output is a BCD signal. | Its output is the original message signal. |
It is implemented using only OR gates. | It is implemented using NOT and AND gates. |
It has a very simple operation. | It has a little complex operation. |
It has an invalid input state when two or more than two inputs are high. | It does not have an invalid input state. |
It is installed at the transmitting end | It is installed at the receiving end. |
It is used for encoding data of emails, videos, messages, calls, etc. | It is used to decode the received encoded data in microprocessor etc. |
Related Posts:
- Difference between Analog and Digital Circuit – Digital vs Analog
- Difference Between Real Ground and Virtual Ground
Key Differences
- The encoder converts the original signal into binary data while the decoder converts back the binary data into the original signal.
- The encoder has ‘2n‘ inputs and ‘n’ outputs while the decoder has ‘n’ inputs and ‘2n‘ outputs.
- The encoder is implemented using only OR gates while the decoder is implemented using NOT and AND gates.
- The encoder is simple to design and operate while the decoder is relatively complex.
- The encoder is installed at the transmitting end while the decoder is installed at receiving end.
Both these encoder and decoder are combinational logic circuit whose operation is the complete opposite of each other. The encoder encodes the message or information in a coded signal while the decoder decodes back the coded signal into the original message or information.
Both decoders and encoders are used in combination to increase the encryption and protect the information from getting into the wrong hands or to easily process the data.
Related Posts:
- Difference Between Multiplexer (MUX) & Demultiplexer (DEMUX)
- Difference Between CPU and GPU – Comparison
- Difference Between RAM and ROM – Comparison
- Difference Between JFET and MOSFET
- Difference Between D-MOSFET and E-MOSFET
- Difference Between BJT and FET Transistors
- Difference Between Diode and SCR (Thyristor)
- Difference Between Diode and Transistor
- Difference Between NPN and PNP Transistor
- Difference Between DIAC and TRIAC
- What is The Difference Between Transistor & Thyristor (SCR)?
- Difference Between Synchronous and Asynchronous Transmission
- Difference Between Serial and Parallel Communication
- Difference between LED and Photodiode
- Difference Between Photodiode and Phototransistor
- Differences between Active and Passive Filter