4 Bit Gray Code

4-bit Gray code

Generating a 4-bit Gray code is simple if you use the mirror technique. It might be useful if you need to draw a Gray coded shaft encoder for exams. Reading vertically down the column, we start on the first column with 0 1. In the second column, we mirror vertically (shown in blue), to get 0 1 1 0. In the third column, we apply the zeros and ones vertically as shown in green. The zeros go in front of the part we had, and the ones in front of the mirrored part. We keep repeating this until the seventh column where we have 4 bits. If you click on the image above you will see an animation of how to build a 4-bit Gray code. With this method, the intermediate columns also show 3-bit and 2-bit Gray code as well.

4-bits

0 0 0 0
0 0 0 1
0 0 1 1
0 0 1 0
0 1 1 0
0 1 1 1
0 1 0 1
0 1 0 0
1 1 0 0
1 1 0 1
1 1 1 1
1 1 1 0
1 0 1 0
1 0 1 1
1 0 0 1
1 0 0 0

This Article Continues...

4 Bit Gray Code
4-bit Gray Code Animation
Gray Code Shaft Encoder