# Code converter | Types | Truth table and logic circuits

The Code converter is used to convert one type of binary code to another. There are different types of binary codes like BCD code, gray code, excess-3 code, etc. Different codes are used for different types of digital applications.

To get the required code from any one type of code, the simple code conversion process is done with the help of combinational circuits. In this section, three types of conversion is discussed.

## Binary to BCD code converter

In BCD code, 0 to 9 numbers represent the equivalent binary numbers. For the numbers above 10, LSB of a decimal number is represented by its equivalent binary number and MSB of a decimal number is also represented by their equivalent binary numbers.

For example, the BCD code of 12 is represented as

The following truth table shows the conversion between the binary code input and the BCD code output. As you see from the table, the 4-bit binary number is converted into 5-bit BCD code. Decimal code is added in the table to understand the equivalence of Binary and BCD code.

The converter has 5 outputs D_{0}, D_{1}, D_{2}, D_{3} and D_{4}. From the truth table, the minterms can be obtained for each output.

D_{4} = ∑m(10, 11, 12, 13, 14, 15), D_{3} = ∑m(8, 9), D_{2} = ∑m(4, 5, 6, 7, 14, 15), D_{1} = ∑m(2, 3, 6, 7, 12, 13), D_{0} = ∑m(1, 3, 5, 7, 9, 11, 13, 15)

The minterms are plotted in the karnaugh map and the simplified boolean expressions are obtained. Learn, How to minimize a boolean function using K-map?

The digital logic circuit for Binary to BCD code converter is designed from the simplified output expressions obtained from karnaugh map.

## BCD to Excess-3 code converter

For this conversion process, 4-bit BCD code is considered as input, which is converted into 4-bit Excess-3 code. Since 4-bit is considered for BCD code, the output is produced only for the inputs from 0 to 9.

The truth table shown below has only the valid 4-bit BCD codes. For the remaining input combinations, the output cannot be predicted. So they are don’t care outputs.

From the truth table, the minterms are obtained for each outputs(E_{3}, E_{2}, E_{1}, E_{0}).

E_{3} = ∑m(5, 6, 7, 8, 9), E_{2} = ∑m(1, 2, 3, 4, 9), E_{1} = ∑m(0, 3, 4, 7, 8), E_{0} = ∑m(0, 2, 4, 6, 8,)

The minterms of each output in plotted in k-map and simplified expression is obtained.

The combinational logic circuit for BCD code to Excess-3 code conversion is drawn from the obtained boolean expressions.

## BCD to Gray code converter

The truth table having the conversion from BCD code to gray code is shown below. Since the BCD code has only 4 bits, a total of 9 BCD digits have been considered. The output is unpredictable for other input combinations.

From the minterms of each output G_{3}, G_{2}, G_{1}, G_{0}, the karnaugh map is implemented to simplify the function.

The code converter circuit for BCD to gray code is drawn as below from the obtained expression.

## Gray code to Excess-3 code converter

For this conversion, 4-bit gray code is considered as an input, which produces 4-bit excess-3 code as the output. Since 4-bit is considered for excess-3 code, the maximum possible output will be ‘1111’. Hence up to 12 numbers are considered for this conversion.

The truth table for this conversion is shown below. For understanding purposes, the decimal number and binary code are included in the below table.

The minterms of each output E_{3}, E_{2}, E_{1}, E_{0} are plotted in the karnaugh map and is simplified as below.

In the k-map shown above for E_{0} output, although 2 to 3 pairs of cells can be grouped, all the minterms are marked as isolated cells to make simplification easier.

Here you can see the actual boolean expression obtained from the K-map for E_{0} output and you can also see, how it is simplified to get the minimal expression.

From the obtained expression for E_{3}, E_{2}, E_{1}, E_{0}, the code converter circuit for gray to excess-3 is drawn as below.

SIR PLEASE PUT THE ANSWER FOR THE 4-BIT GRAY TO EXCESS-3 CODE CONVERTER IN YOUR SITE

Sure, I will try to update it as soon as possible.