Convert 1010 1100 to gray code.


Q.) Convert 1010 1100 to gray code.

Subject: Digital Circuit and System Design

To convert a binary number to Gray code, you can follow these steps:

  1. Write down the binary number.
  2. The most significant bit (MSB) of the Gray code is the same as the MSB of the binary number.
  3. For each subsequent bit of the Gray code, perform an exclusive OR (XOR) operation between the current bit and the bit to its left in the binary number.

Let's apply these steps to convert the binary number 1010 1100 to Gray code:

  1. Write down the binary number:
   Binary: 1 0 1 0  1 1 0 0
  1. The MSB of the Gray code is the same as the MSB of the binary number:
   Binary: 1 0 1 0  1 1 0 0
   Gray:   1
  1. Perform XOR for each subsequent bit:
  • For the second bit: 1 XOR 0 = 1
  • For the third bit: 0 XOR 1 = 1
  • For the fourth bit: 1 XOR 0 = 1
  • For the fifth bit: 0 XOR 1 = 1
  • For the sixth bit: 1 XOR 1 = 0
  • For the seventh bit: 1 XOR 0 = 1
  • For the eighth bit: 0 XOR 0 = 0

So, the Gray code equivalent of the binary number 1010 1100 is 1111 1010.

Here is the step-by-step conversion in a tabular format:

Binary Operation Gray Code
1 - 1
0 1 XOR 0 1
1 0 XOR 1 1
0 1 XOR 0 1
1 0 XOR 1 1
1 1 XOR 1 0
0 1 XOR 0 1
0 0 XOR 0 0

The XOR operation is represented by the symbol , and the formula for converting the n-th bit (b_n) in binary to the n-th bit (g_n) in Gray code is:

g_n = b_n ⊕ b_(n-1)

Where b_(n-1) is the bit to the left of b_n in the binary number.

Using this formula, the Gray code bits are calculated as follows:

g_1 = b_1        = 1
g_2 = b_2 ⊕ b_1  = 0 ⊕ 1 = 1
g_3 = b_3 ⊕ b_2  = 1 ⊕ 0 = 1
g_4 = b_4 ⊕ b_3  = 0 ⊕ 1 = 1
g_5 = b_5 ⊕ b_4  = 1 ⊕ 0 = 1
g_6 = b_6 ⊕ b_5  = 1 ⊕ 1 = 0
g_7 = b_7 ⊕ b_6  = 0 ⊕ 1 = 1
g_8 = b_8 ⊕ b_7  = 0 ⊕ 0 = 0

Therefore, the final Gray code is 1111 1010.