Binary - Gray Code Converter
|
|||||||||
|
|||||||||
|
Binary - Gray Code Converter
is an online tool used in digital computation to convert either Binary code into its equivalent Gray code or Gray code to its equivalent Binary code. From the above, this calculator is comprises of two converters namely Binary to Gray Code Converter and Gray to Binary Code Converter and it is separated by the respective radio button |
||
A Gray code is an encoding of numbers so that adjacent numbers have a single digit differing by 1. The term Gray code is often used to refer to a "reflected" code, or more specifically still, the binary reflected Gray code. To convert a binary number d1d2d3.....d(n-1)dn to its corresponding binary reflected Gray code, start at the right with the digit dn (the nth, or last, digit). If the d(n-1) is 1, replace dn by 1- dn; otherwise, leave it unchanged. Then proceed to d(n-1). Continue up to the first digit d1, which is kept the same since d0 is assumed to be a 0. The resulting number g1g2g3...g(n-1)gn is the reflected binary Gray code. To convert a binary reflected Gray code g1g2g3.....g(n-1)gn to a binary number, start again with the nth digit, and compute
If Σn is 1, replace gn by 1-gn; otherwise, leave it the unchanged. Next compute
and so on. The resulting number d1d2d3.....d(n-1)dn is the binary number corresponding to the initial binary reflected Gray code. The code is called reflected because it can be generated in the following manner. Take the Gray code 0, 1. Write it forwards, then backwards: 0, 1, 1, 0. Then prepend 0s to the first half and 1s to the second half: 00, 01, 11, 10. Continuing, write 00, 01, 11, 10, 10, 11, 01, 00 to obtain: 000, 001, 011, 010, 110, 111, 101, 100, ... (OEIS A014550). Each iteration therefore doubles the number of codes. |
||
Gray Code to Binary Conversion This conversion method strongly follows the operation of Exclusive-OR gate. The following steps let you know how to achieve Gray Code to Binary number conversion 1. The left most significant bit of a given grey code number is same as the most left significant bit of the binary number 2. To obtain the successive binary bits to produce the equivalent binary number for the given grey code number, add the first bit of grey code to the second one and write down the result next to the first bit, add the second grey code bit to third one and write down the result and so on next to the second bit and repeat the same operation until the last bit |
||
Binary to Gray Code Conversion Write down the Binary number first and follow the above said information given for Grey to Binary conversion. These conversion techniques are used in digital computation to represent position of the rotating disk. When it comes to online calculation, this converter assists you to perform the conversion as you required |