Excess-3 Code
The excess-3 code is also treated as XS-3 code. The excess-3 code is a non-weighted and self-complementary BCD code used to represent the decimal numbers. This code has a biased representation. This code plays an important role in arithmetic operations because it resolves deficiencies encountered when we use the 8421 BCD code for adding two decimal digits whose sum is greater than 9. The Excess-3 code uses a special type of algorithm, which differs from the binary positional number system or normal non-biased BCD.
We can easily get an excess-3 code of a decimal number by simply adding 3 to each decimal digit. And then we write the 4-bit binary number for each digit of the decimal number. We can find the excess-3 code of the given binary number by using the following steps:
- We find the decimal number of the given binary number.
- Then we add 3 in each digit of the decimal number.
- Now, we find the binary code of each digit of the newly generated decimal number.
We can also add 0011 in each 4-bit BCD code of the decimal number for getting excess-3 code.
The Excess-3 code for the decimal number is as follows:
Decimal Digit | BCD Code | Excess-3 Code |
---|---|---|
0 | 0000 | 0011 |
1 | 0001 | 0100 |
2 | 0010 | 0101 |
3 | 0011 | 0110 |
4 | 0100 | 0111 |
5 | 0101 | 1000 |
6 | 0110 | 1001 |
7 | 0111 | 1010 |
8 | 1000 | 1011 |
9 | 1001 | 1100 |
In excess-3 code, the codes 1111 and 0000 are never used for any decimal digit. Let’s take some examples of Excess-3 code.
Example 1: Decimal number 31
1. We find the BCD code of each digit of the decimal number.
Digit | BCD |
---|---|
3 | 0011 |
1 | 0001 |
2) Then, we add 0011 in both of the BCD code.
Decimal | BCD | Excess-3 |
---|---|---|
3 | 0011+0011 | 0110 |
1 | 0001+0011 | 0100 |
3. So, the excess-3 code of the decimal number 31 is 0110 0100
Example 2: Decimal number 81.61
1. We find the BCD code of each digit of the decimal number.
Digit | BCD |
---|---|
8 | 1000 |
1 | 0001 |
6 | 0110 |
1 | 0001 |
2) Then, we add 0011 in both of the BCD code.
Decimal | BCD | Excess-3 |
---|---|---|
8 | 1000+0011 | 1011 |
1 | 0001+0011 | 0100 |
6 | 0110+0011 | 1001 |
3) So, the excess-3 code of the decimal number 81.61 is 1011 0100.1001 0100
Self-complementary property
A self-complementary binary code is a code which is always complimented in itself. By replacing the bit 0 to 1 and 1 to 0 of a number, we find the 1’s complement of the number. The sum of the 1’st complement and the binary number of a decimal is equal to the binary number of decimal 9.
Note: if we perform the 1’s complement of excess-3 of a decimal number, it will be equal to the excess-3 code of the 9’s complement of that decimal number.
For example: If we perform 1’s complement of the excess-3 code 1000(decimal 5), complement value will be 0111, which is the excess-3 code of 9’s complement of 5, i.e., 4(0111).
Why use Excess-3 code?
There are the following advantages of excess-3 code which make it required to use:
- These codes are self-complementary.
- These codes use biased representation.
- The excess-3 code has no limitation, so that it considerably simplifies arithmetic operations.
- The codes 0000 and 1111 can cause a fault in the transmission line. The excess-3 code doesn’t use these codes and gives an advantage for memory organization.
- These codes are usually unweighted binary decimal codes.
- This code has a vital role in arithmetic operations. It is because it resolves deficiencies which are encountered when we use the 8421 BCD code for adding two decimal digits whose sum is greater than 9.