   0

# Convert the gray code 10101111 to binary?

To convert Gray code to binary code you must be familiar with the logical XOR operator. XOR outputs a 1 bit if either of two input bits is 1, but not both. The truth table for XOR, for all possible inputs p and q, is as follows:

p q output

0 0 0

0 1 1

1 0 1

1 1 0

The algorithm to convert from Gray code to binary code is as follows:

Step 1: Fix the most-significant bit, the MSB, which is always the same for both codes. If there are no more bits, we're done, otherwise proceed to step 2.

Step 2: XOR the most recently fixed binary bit with the next available Gray bit. Fix the result as the next binary bit.

Step 3: If there is at least one more Gray bit available, go to step 2. Otherwise we're done.

Therefore, to convert 10101111 from Gray to binary, we proceed as follows:

Gray = 10101111

Fix MSB = 1

1 XOR 0 = 1

1 XOR 1 = 0

0 XOR 0 = 0

0 XOR 1 = 1

1 XOR 1 = 0

0 XOR 1 = 1

1 XOR 1 = 1

Thus: Binary = 11010101

Note that we carry the fixed bit (the bold bit) onto the next line as the l-value (left operand) of XOR. The r-value (right operand) of XOR is always the next available Gray bit after the MSB. Reading the fixed bits from top to bottom reveals the binary code.

We can also write this as follows:

Gray = 10101111

Binary = 1 XOR 0 = 1 XOR 1 = 0 XOR 0 = 0 XOR 1 = 1 XOR 1 = 0 XOR 1 = 1 XOR 1 = 1

Reading the fixed (bold) bits left to right reveals the binary code. Study guides

20 cards

## A number a power of a variable or a product of the two is a monomial while a polynomial is the of monomials

➡️
See all cards
3.75
865 Reviews

[object Object] 1010  Earn +20 pts  