I was learning methods of digital data storage in computer memory. I want to convert binary to Gray code numbers so that I can understand a piece of machine code. How can I do it?
Method To Convert Binary To Gray Code Using Any Tool
The computer understands only machine language. The machine language comprises only of two bits, 0s, and 1s since there are only two states a semiconductor device can be. Either high conduction state or low resistive state. This binary numbers can be compressed using the Gray code as follows.
- The MSB stays the same for both binary code and corresponding Gray code.
- Make a XOR operation of the first two bits of the binary number to get the second bit of Gray code. But you need to reject the first bit in this operating.
- Iteratively perform this operation till the LSB
- The final result is the equivalent result in Gray code.