- Digital Electronics Tutorial
- Digital Electronics - Home
- Digital Electronics Basics
- Types of Digital Systems
- Types of Signals
- Logic Levels And Pulse Waveforms
- Digital System Components
- Digital Logic Operations
- Digital Systems Advantages
- Number Systems
- Number Systems
- Base Conversions
- Binary Numbers Representation
- Binary Arithmetic
- Signed Binary Arithmetic
- Octal Arithmetic
- Hexadecimal Arithmetic
- Complement Arithmetic
- Binary Codes
- Binary Codes
- 8421 BCD Code
- Excess-3 Code
- Gray Code
- ASCII Codes
- EBCDIC Code
- Code Conversion
- Error Detection & Correction Codes
- Logic Gates
- Logic Gates
- AND Gate
- OR Gate
- NOT Gate
- Universal Gates
- XOR Gate
- XNOR Gate
- CMOS Logic Gate
- Two Level Logic Realization
- Threshold Logic
- Boolean Algebra
- Boolean Algebra
- Laws of Boolean Algebra
- Boolean Functions
- DeMorgan's Theorem
- SOP and POS Form
- Minimization Techniques
- K-Map Minimization
- Three Variable K-Map
- Four Variable K-Map
- Five Variable K-Map
- Six Variable K-Map
- Don't Care Condition
- Quine-McCluskey Method
- Min Terms and Max Terms
- Canonical and Standard Form
- Max Term Representation
- Simplification using Boolean Algebra
- Combinational Logic Circuits
- Digital Combinational Circuits
- Digital Arithmetic Circuits
- Multiplexers
- Parity Bit Generator and Checker
- Comparators
- Encoders
- Keyboard Encoders
- Priority Encoders
- Decoders
- Demultiplexers
- Arithmetic Logic Unit
- 7-Segment LED Display
- Code Converters
- Code Converters
- Binary to Decimal Converter
- Decimal to BCD Converter
- BCD to Decimal Converter
- Binary to Gray Code Converter
- Gray Code to Binary Converter
- BCD to Excess-3 Converter
- Excess-3 to BCD Converter
- Adders
- Half Adders
- Full Adders
- Serial Adders
- Parallel Adders
- Full Adder using Half Adder
- Half Adder vs Full Adder
- Binary Adder-Subtractor
- Subtractors
- Half Subtractors
- Full Subtractors
- Parallel Subtractors
- Full Subtractor using 2 Half Subtractors
- Half Subtractor using NAND Gates
- Sequential Logic Circuits
- Digital Sequential Circuits
- Clock Signal and Triggering
- Latches
- Flip-Flops
- Conversion of Flip-Flops
- Shift Registers
- Shift Register Applications
- Counters
- Finite State Machines
- Algorithmic State Machines
- A/D and D/A Converters
- Analog-to-Digital Converter
- Digital-to-Analog Converter
- DAC and ADC ICs
- Realization of Logic Gates
- NOT Gate from NAND Gate
- OR Gate from NAND Gate
- AND Gate from NAND Gate
- NOR Gate from NAND Gate
- XOR Gate from NAND Gate
- XNOR Gate from NAND Gate
- NOT Gate from NOR Gate
- OR Gate from NOR Gate
- AND Gate from NOR Gate
- NAND Gate from NOR Gate
- XOR Gate from NOR Gate
- XNOR Gate from NOR Gate
- NAND/NOR Gate using CMOS
- Memory Devices
- Memory Devices
- RAM and ROM
- Cache Memory Design
- Programmable Logic Devices
- Programmable Logic Devices
- Programmable Logic Array
- Programmable Array Logic
- Field Programmable Gate Arrays
- Digital Electronics Families
- Digital Electronics Families
- CPU Architecture
- CPU Architecture
Binary to Gray Code Converter
A binary-to-gray code converter is a type of code converter that can translate a binary code into its equivalent gray code.
The binary-to-gray code converter accepts a binary number as input and produces a corresponding gray code as output.
Here is the truth table explaining the operation of a 4-bit binary-to-gray code converter.
Binary Code | Gray Code | ||||||
---|---|---|---|---|---|---|---|
B3 | B2 | B1 | B0 | G3 | G2 | G1 | G0 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 |
0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 |
0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 |
0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
0 | 1 | 0 | 1 | 0 | 1 | 1 | 1 |
0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 |
0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 |
1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 |
1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 |
1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 |
1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 |
1 | 1 | 0 | 0 | 1 | 0 | 1 | 0 |
1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 |
1 | 1 | 1 | 0 | 1 | 0 | 0 | 1 |
1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 |
Let us derive the Boolean expressions for the gray code output bits. For this, we will simplify the truth table using the K-map technique.
K-Map for Gray Code Bit G0
The K-Map simplification to obtain the Boolean expression for the gray code bit G0 is shown in the following figure.
Hence, the Boolean expression for the gray code bit G0 is,
$$\mathrm{G_{0} \: = \: \overline{B_{1}} \: B_{0} \: + \ B_{1} \: \overline{B_{0}} \: = \: B_{0} \: \oplus \: B_{1}}$$
K-Map for Gray Code Bit G1
The K-Map simplification for the gray code bit G1 is shown below −
Thus, the Boolean expression for the gray code bit G1 is,
$$\mathrm{G_{1} \: = \: \overline{B_{2}} \: B_{1} \: + \ B_{2} \: \overline{B_{1}} \: = \: B_{1} \: \oplus \: B_{2}}$$
K-Map for Gray Code Bit G2
The K-Map simplification for the gray code bit G2 is depicted in the following figure −
The Boolean expression for the gray code bit G2 will be,
$$\mathrm{G_{2} \: = \: \overline{B_{3}} \: B_{2} \: + \ B_{3} \: \overline{B_{2}} \: = \: B_{2} \: \oplus \: B_{3}}$$
K-Map for Gray Code Bit G3
The K-Map simplification for the gray code bit G3 is shown in the following figure −
Hence, the Boolean expression for the gray code bit G3 is,
$$\mathrm{G_{3} \: = \: B_{3}}$$
Let us now utilize these Boolean expressions to implement the logic circuit of the binary-to-gray code converter.
The following figure shows the logic circuit diagram of a 4-bit binary code to gray code converter −
This circuit can convert a 4-bit binary number into an equivalent gray code.
We can follow the same procedure to design a binary-to-gray code converter for any number of bits.