Solved Problem -Gray Code to Binary Conversion
Question
Convert the Gray coded number 10011011 to its binary equivalent.
Answer
The rules of conversion from Gray code to binary are given in the Gray code summary
- The Gray code number has 8 bits so the Binary equivalent will also have 8 bits
- The most significant bit (left-most bit) is the same in both cases
- The next-to-most significant bit in the binary number comes from adding the most significant bit in the binary number to the next-to-most significant bit in the Gray coded number, the sum is noted and any carry ignored.
- Generally, working from left to right i.e. from most significant bit to least significant bit, then the nth bit (counting from right to left) in the binary number is formed from summing the n+1th bit in the binary number with the nth bit in the Gray coded number. The corresponding sum is noted and any carry ignored.
In the case of this example
| Gray Code | 10011011 | Binary Digit 1 | = 1 | (same as Gray code) |
|---|---|---|---|---|
| Gray Code | 10011011 | Binary Digit 2 | = 0 + 1 = 1 | |
| Gray Code | 10011011 | Binary Digit 3 | = 0 + 1 = 1 | |
| Gray Code | 10011011 | Binary Digit 4 | = 1 + 1 = 0 | (carry 1) |
| Gray Code | 10011011 | Binary Digit 5 | = 1 + 0 = 1 | |
| Gray Code | 10011011 | Binary Digit 6 | = 0 + 1 = 1 | |
| Gray Code | 10011011 | Binary Digit 7 | = 1 + 1 = 0 | (carry 1) |
| Gray Code | 10011011 | Binary Digit 8 | = 1 + 0 = 1 |
and so
10011011gray = 11101101bin