There is a wide variety of binary codes used in digital systems. Some of these codes are binary coded-decimal (BCD), Excess-3, Gray, octal, hexadecimal, etc. Often it is required to convert from one code to another. For example the input to a digital system may be in natural BCD and output may be 7-segment LEDs. The digital system used may be capable of processing the data in straight binary format. Therefore, the data has to be converted from one type of code to another type for different purpose. The various code converters can be designed using gates.
1. BCD Code:
Binary Coded Decimal (BCD) is used to represent each of decimal digits (0 to 9) with a 4-bit binary code. For example (23)10 is represented by 0010 0011 using BCD code rather than (10111)2 This code is also known as 8-4-2-1 code as 8421 indicates the binary weights of four bits(23, 22, 21, 20). It is easy to convert between BCD code numbers and the familiar decimal numbers. It is the main advantage of this code. With four bits, sixteen numbers (0000 to 1111) can be represented, but in BCD code only 10 of these are used. The six code combinations (1010 to 1111) are not used and are invalid.
Applications: Some early computers processed BCD numbers. Arithmetic operations can be performed using this code. Input to a digital system may be in natural BCD and output may be 7- segment LEDs.
It is observed that more number of bits is required to code a decimal number using BCD code than using the straight binary code. However in spite of this disadvantage it is very convenient and useful code for input and output operations in digital systems.
2. EXCESS-3 Code:
Excess-3, also called XS3, is a non-weighted code used to express decimal numbers. It can be used for the representation of multi-digit decimal numbers as can BCD.The code for each decimal number is obtained by adding decimal 3 and then converting it to a 4-bit binary number.
For e.g. decimal 2 is coded as 0010 + 0011 = 0101 in Excess-3 code.
This is self-complementing code which means 1‟s complement of the coded number yields 9‟s complement of the number itself. Self-complementing property of this helps considerably in performing subtraction operation in digital systems, so this code is used for certain arithmetic operations.
BCD To Excess – 3 Code Conversions:
Convert BCD 2 i.e. 0010 to Excess – 3 code
For converting 4 bit BCD code to Excess – 3, add 0011 i.e. decimal 3 to the respective code using rules of binary addition.
0010 + 0011 = 0101 – Excess – 3 code for BCD 2