Gray Code to Hex Converter is used to convert a Gray Code number into Hex format. Use the Gray Code Converter tool to convert between any number base and gray code.
Output: Hex numbers
Convert Hex number to Gray Code
View ToolGray Code
Gray Code also known as Reflected Binary Code is an ordering of binary numeral system used for error correction in digital terrestrial television and some cable TV systems.
Hex
Hexadecimal is a numeric system widely used by systems designers and computer programmers. It contains 16 symbols from 0 to 9 and A to F, thus having a base of 16.
Conversion from Gray Code to Hex
A Gray Code can be converted to Hex using these steps:-
- Take the first bit of the gray code input and write it to the output
- Repeat the following steps until you reach the end of the input
- Take the second bit of the input and XOR it to the last bit of the output
- Write this result to the output. So,
0 + 0 = 0
,0 + 1 = 1
,1 + 0 = 1
and1 + 1 = 0
. - Convert the binary output to hex
Example Gray Code to Hex Conversion
Let's say your Gray Code value is 11111011
, and you want to convert it to its hex form.
- Step 1: Take the first bit of the gray code input and write it to the output. Output is
1
- Step 2: Repeat the steps below until you reach the end of the input
- Take the second bit of the input and XOR it to the last bit of the output.
1 + 1 = 0
- Write the result to the output. Output:
10
- Take the third bit of the input and XOR it to the last bit of the output.
1 + 0 = 1
- Write the result to the output. Output:
101
- Take the fourth bit of the input and XOR it to the last bit of the output.
1 + 1 = 0
- Write the result to the output. Output:
1010
- Take the fifth bit of the input and XOR it to the last bit of the output.
1 + 0 = 1
- Write the result to the output. Output:
10101
- Take the sixth bit of the input and XOR it to the last bit of the output.
0 + 1 = 1
- Write the result to the output. Output:
101011
- Take the seventh bit of the input and XOR it to the last bit of the output.
1 + 1 = 0
- Write the result to the output. Output:
1010110
- Take the eighth (last) bit of the input and XOR it to the last bit of the output.
1 + 0 = 1
- Write the result to the output. Output:
10101101
- Take the second bit of the input and XOR it to the last bit of the output.
- Step 3: So, our binary result is:
10101101
- Step 4: Convert the binary output to hex. So,
10101101
becomes0xad
Gray Code Table
Decimal | Hex | Binary | Gray Code |
---|---|---|---|
0 | 0 | 0000 | 0000 |
1 | 1 | 0001 | 0001 |
2 | 2 | 0010 | 0011 |
3 | 3 | 0011 | 0010 |
4 | 4 | 0100 | 0110 |
5 | 5 | 0101 | 0111 |
6 | 6 | 0110 | 0101 |
7 | 7 | 0111 | 0100 |
8 | 8 | 1000 | 1100 |
9 | 9 | 1001 | 1101 |
10 | a | 1010 | 1111 |
11 | b | 1011 | 1110 |
12 | c | 1100 | 1010 |
13 | d | 1101 | 1011 |
14 | e | 1110 | 1001 |
15 | f | 1111 | 1000 |
History
- Feb 5, 2018
- Tool Launched
Comments 0