$\require{cancel}$
Value | 2 bit | 3 bit | 4 bit | binary |
0 | 00 | 000 | 0000 | 0000 |
1 | 01 | 001 | 0001 | 0001 |
2 | 11 | 011 | 0011 | 0010 |
3 | 10 | 010 | 0010 | 0011 |
4 | 110 | 0110 | 0100 | |
5 | 111 | 0111 | 0101 | |
6 | 101 | 0101 | 0110 | |
7 | 100 | 0100 | 0111 | |
8 | 1100 | 1000 | ||
9 | 1101 | 1001 | ||
10 | 1111 | 1010 | ||
11 | 1110 | 1011 | ||
12 | 1010 | 1100 | ||
13 | 1011 | 1101 | ||
14 | 1001 | 1110 | ||
15 | 1000 | 1111 |
Convert 13 to gray code 11012 = G3 = B3 = 1 G2 = B3 ⊕ B2 = 1 ⊕ 1 = 0 G1 = B2 ⊕ B1 = 1 ⊕ 0 = 1 G0 = B1 ⊕ B0 = 0 ⊕ 1 = 1 = 1011gray Convert 10 to gray code 10102 G3 = B3 = 1 G2 = B3 ⊕ B2 = 1 ⊕ 0 = 1 G1 = B2 ⊕ B1 = 0 ⊕ 1 = 1 G0 = B1 ⊕ B0 = 1 ⊕ 0 = 1 = 1111gray
Convert 1001gray to binary 1001gray = B3 = G3 = 1 B2 = B3 ⊕ G2 = 1 ⊕ 0 = 1 B1 = B2 ⊕ G1 = 1 ⊕ 0 = 1 B0 = B1 ⊕ G0 = 1 ⊕ 1 = 0 = 11102