Self-Complementing Codes (Excess 3, 84-2-1, 2*421)

bcd
Beta Tracks picture Beta Tracks · Sep 9, 2014 · Viewed 73.9k times · Source

I'm having a topic here which is from "Number Systems" in the subject of "Introduction to Computer Organisation & Architecture"

Then i came across this topic,"Self complementing Codes"

There are 3 parts of it which are as follows:

i)Excess-3 (I understand this part as it requires us to add 3 to BCD)

ii)84-2-1 (I don't understand)

iii)2*421 (I don't understand)

I hope someone could explain how the part ii & iii works.

Thanks alot.

Answer

Mehrshad picture Mehrshad · Feb 3, 2015

I think this part of "Digital Design" book from Morris Mano will answer your question:

BCD and the 2421 code are examples of weighted codes. In a weighted code, each bit position is assigned a weighting factor in such a way that each digit can be evaluated by adding the weights of all the 1’s in the coded combination.

Four Different Binary Codes for the Decimal Digits
_____________________________________________________________
Decimal     BCD          2421       Excess‐3    8, 4, -2, -1
 Digit      8421
_____________________________________________________________
 0          0000         0000         0011         0000
 1          0001         0001         0100         0111
 2          0010         0010         0101         0110
 3          0011         0011         0110         0101
 4          0100         0100         0111         0100
 5          0101         1011         1000         1011
 6          0110         1100         1001         1010
 7          0111         1101         1010         1001
 8          1000         1110         1011         1000
 9          1001         1111         1100         1111
_____________________________________________________________
            1010         0101         0000         0001
 Unused     1011         0110         0001         0010
 bit        1100         0111         0010         0011
 combi-     1101         1000         1101         1100
 nations    1110         1001         1110         1101
            1111         1010         1111         1110

The 2421, the excess‐3 and the 84-2-1 codes are examples of self‐complementing codes. Such codes have the property that the 9’s complement of a decimal number is obtained directly by changing 1’s to 0’s and 0’s to 1’s (i.e., by complementing each bit in the pattern). For example, decimal 395 is represented in the excess‐3 code as 0110 1100 1000. The 9’s complement of 604 is represented as 1001 0011 0111, which is obtained simply by complementing each bit of the code (as with the 1’s complement of binary numbers).

Digital Design-Fifth edition-By Morris Mano