gray code is a quasi-weighted code. assume that the lowest bit of gray code is n=1, then the absolute value of the weight of gray code is (2^n)-1, and its sign alternates between positive and negative from left to right. a typical gray code is a single-step self-complement code with reflective and cyclic characteristics. its cyclic and single-step characteristics eliminate the possibility of major errors when randomly taking numbers. its reflection and self-complementary characteristics make inversion very convenient. . gray code is a reliable coding method that minimizes errors.
decimal number | natural binary numbers | gray code |
0 | 0000 | 0000 |
1 | 0001 | 0001 |
2 | 0010 | 0011 |
3 | 0011 | 0010 |
4 | 0100 | 0110 |
5 | 0101 | 0111 |
6 | 0110 | 0101 |
7 | 0111 | 0100 |
8 | 1000 | 1100 |
9 | 1001 | 1101 |
10 | 1010 | 1111 |
11 | 1011 | 1110 |
12 | 1100 | 1010 |
13 | 1101 | 1011 |
14 | 1110 | 1001 |
15 | 1111 | 1000 |