Beruflich Dokumente
Kultur Dokumente
Date: 07-09-20
Objectives:
Study about encoder, decoder circuit and binary to gray code converter.
Making Logic Diagram.
Theoretical Background:
Encoder: An Encoder is a combinational circuit that performs the reverse operation of Decoder. It has
maximum of 2n input lines and ‘n’ output lines. It will produce a binary code equivalent to the input,
which is active High. Therefore, the encoder encodes 2 n input lines with ‘n’ bits. It is optional to
represent the enable signal in encoders.
4 to 2 Encoder: Let 4 to 2 Encoder has four inputs Y 3, Y2, Y1 & Y0 and two outputs A1 & A0. The block
diagram of 4 to 2 Encoder is shown in the following figure.
At any time, only one of these 4 inputs can be ‘1’ in order to get the respective binary code at the
output. The Truth table of 4 to 2 encoder is shown below.
4:2 Priority Encoder: A 4 to 2 priority encoder has four inputs Y 3, Y2, Y1 & Y0 and two outputs A 1 & A0.
Here, the input, Y3 has the highest priority, whereas the input, Y 0 has the lowest priority. In this case,
even if more than one input is ‘1’ at the same time, the output will be the binary code corresponding to
the input, which is having higher priority.
We considered one more output, V in order to know, whether the code available at outputs is valid or
not.
If at least one input of the encoder is ‘1’, then the code available at outputs is a valid one. In this
case, the output, V will be equal to 1.
If all the inputs of encoder are ‘0’, then the code available at outputs is not a valid one. In this
case, the output, V will be equal to 0.
The Truth table of 4 to 2 priority encoder is shown below.
Binary to Gray Code Converter: The logical circuit which converts the binary code to equivalent Gray
code is known as binary to Gray code converter. An n-bit Gray code can be obtained by reflecting an n-
1-bit code about an axis after 2n-1 rows and putting the MSB (Most Significant Bit) of 0 above the axis and
the MSB of 1 below the axis. Reflection of Gray codes is shown below.
Gray code to Binary Converter: In a gray to binary code converter, the input is gray code and output is
its equivalent binary code. Let us consider a 4-bit gray to binary code converter. To design a 4-bit gray to
binary code converter, we first have to draw a gray code conversion table, as shown below:
Logic Diagram:
Learnings: In this experiment we learned about encoder and decoders. We also learned
their applications. We learned about how to generate gray code from binary and also
how to convert gray code to binary. We also learned advantages of encoders, decoders
and binary to gray converter. We learned about disadvantages of each one of them. This
gave us the view why we use priority encoder.