# Digital Codes

Each digit of a decimal number is represented by binary equivalent.

In 4-bit binary formats:

Total number of possible representation = 2

In 8 - bit binary formats :

Valid BCD codes = 100 , Invalid BCD codes = 256-100 = 156.

BCD is also called 8421 code.

It is a 4-bit code.

It can be derived from BCD code by adding "3" to each coded number and "Self-complementing code".

It is the only code which is unweighted and self complementing. 2421 , 3321 , 4311 and 5211 all are self complementing codes where sum of weight is 9.

Also called "minimum change codes" in which only one bit in the code group changes when going from one step to the next.

Gray code is also called cyclic or reflective code.Since error is minimum so also called minimum error code.

"MSB" in the gray code is same as corresponding digit in binary number.

Starting from"Left to Right", EXOR each adjacent pair of binary digits to get next gray code digit.

"MSB" of Binary is same as that of gray code.

If a number system has base b then we can find its b's complement and (b-1)'s complement.

To determine (b-1)'s complement subtract given number form maximum number possible to given base i.e ( r

To determine b's complement , first determine (b-1)'s complement then add 1 to get b's complement of number.

To convert decimal number into any other base b divide integer part with b and multiply fractional part with b.

In 4-bit binary formats:

Total number of possible representation = 2

^{4}= 16 , Valid BCD codes = 10 and invalid BCD codes = 6.In 8 - bit binary formats :

Valid BCD codes = 100 , Invalid BCD codes = 256-100 = 156.

BCD is also called 8421 code.

**Excess-3 Code**It is a 4-bit code.

It can be derived from BCD code by adding "3" to each coded number and "Self-complementing code".

It is the only code which is unweighted and self complementing. 2421 , 3321 , 4311 and 5211 all are self complementing codes where sum of weight is 9.

**Gray Code**Also called "minimum change codes" in which only one bit in the code group changes when going from one step to the next.

Gray code is also called cyclic or reflective code.Since error is minimum so also called minimum error code.

**Binary-to-Gray Conversion**"MSB" in the gray code is same as corresponding digit in binary number.

Starting from"Left to Right", EXOR each adjacent pair of binary digits to get next gray code digit.

**Gray-to-Binary Conversion**"MSB" of Binary is same as that of gray code.

If a number system has base b then we can find its b's complement and (b-1)'s complement.

To determine (b-1)'s complement subtract given number form maximum number possible to given base i.e ( r

^{n}- 1).To determine b's complement , first determine (b-1)'s complement then add 1 to get b's complement of number.

To convert decimal number into any other base b divide integer part with b and multiply fractional part with b.

If ( X

_{3}X_{2}X_{1}X_{0})_{b }= (A)_{10}then A = X_{0 }+ X_{1}b^{1}+ X_{2}b^{2}+ X_{3}b^{3}
## No comments