The second category of codes are those codes which cannot be represented by any analytical relation, hence these codes are also called as nonanalytical code.NonAnalytical code. These are the following codes:
Excess3 Codes, Gray Codes, BCD greater than 4bits
2421, 5211, Excess3 (XS3)
8421 and XS3
Gray Code
Gray Code
Parity, Hamming Code
This code also known as a unit distance code. This code is best suited as a shat position encoder. Going from any one position to next position, there is only one bit change in the code. The pattern formed by the gray code is the mirror image, so the code is also called as reflected code. Figure shows the formation of gray code from 1bit to 2bits and from 2bit to 3bit.
This code is an extension of decimal code. This code make use of 4bit binary code for decimal digit 0 through 9. As with 4bit, we can have 16 combinations, but the valid decimal digit symbols are from 0 to 9, code 1010 to 1111 are invalid code in BCD.
To encode in BCD, 4bit code of each decimal digit is written to form a valid binary equivalent
Examples
Decimal —–> 
9 
10 
128 
458 
89 
BCD —–> 
1001 
0001 0000 
0001 0010 1000 
0100 0101 1000 
1000 1001 
An XS3 code is obtained by adding 3 with the equivalent decimal of a binary number and again converting it into binary number.
Procedure:
Binary 
Decimal 
+3 
XS3 
0000 
0 
0+3 =3 
0011 
0001 
1 
1+3=4 
0100 
0010 
2 
2+3=5 
0101 
0011 
3 
3+3=6 
0110 
0100 
4 
4+3=7 
0111 
0101 
5 
5+3=8 
1000 
0110 
6 
6+3=9 
1001 
0111 
7 
7+3=10 
1010 
1000 
8 
8+3=11 
1011 
1001 
9 
9+3=12 
1100 
Example:
Decimal 
4 8_{10}

920_{10}

73_{10}

Add 3 to each digit 
(4+3) (8+3)
7 11 
(9+3) (2+3) (0+3)
12 5 3 

XS3 Code 
0111 1011 
1100 0101 0011 
The primary advantage of XS3 coding over nonbiased coding is that a decimal number can be nines’ complemented (for subtraction) as easily as a binary number can be ones’ complemented; just invert all bits.
Just complement the bits to get the 9’s complement
Decimal 
6 
9 
1 
XS3 Code 
1001 
1100 
0100 
Complement Bits 
0110 
0011 
1011 
9’s complement
“(XS3) – 3” 
3 
0 
8 
Summary > 
9’s complement of 6 is 3 
9’s complement of 9 is 0 
9’s complement of 1 is 8 
The weight of the bits is 2, 4, 2, 1 and the numbers formed are:
2 
4 
2 
1 

0 
0 
0 
0 
0 
1 
0 
0 
0 
1 
2 
0 
0 
1 
0 
3 
0 
0 
1 
1 
4 
0 
1 
0 
0 
5 
0 
1 
0 
1 
6 
0 
1 
1 
0 
7 
0 
1 
1 
1 
8 
1 
1 
1 
0 
9 
1 
1 
1 
1 
5 
4 
2 
1 

0 
0 
0 
0 
0 
1 
0 
0 
0 
1 
2 
0 
0 
1 
0 
3 
0 
0 
1 
1 
4 
0 
1 
0 
0 
5 
0 
1 
0 
1 
6 
0 
1 
1 
0 
7 
0 
1 
1 
1 
8 
1 
0 
1 
1 
9 
1 
1 
0 
0 
10 
1 
1 
0 
1 
11 
1 
1 
1 
0 
12 
1 
1 
1 
1 