The Gray code is sometimes called a reflected code because the bit values are reflected on both sides of any 2″ value

The Gray code is sometimes called a reflected code because the bit values are reflected on both sides of any 2″ value. For example, as shown in Table 3-5, the values of the three low-order bits are reflected over a line drawn between 7 and 8. Using this property of the Gray code, obtain:

a. The Gray code numbers for 16 through 31 as a continuation of Table 3-5.

b. The excess-3 Gray code for decimals 10 to 19 as a continuation of the list in Table 3-6.

The Correct Answer and Explanation is :

Part (a): Gray Code Numbers for 16 through 31

To generate the Gray code numbers for 16 through 31, we start by recalling the Gray code conversion method. The Gray code for a number (N) is calculated by performing an XOR operation between (N) and the number (N >> 1) (right-shifted value of (N)).

The table of Gray codes from 16 to 31 is obtained by following this procedure.

DecimalBinaryGray Code
161000011000
171000111001
181001011011
191001111010
201010011110
211010111111
221011011101
231011111100
241100010100
251100110101
261101010111
271101110110
281110010010
291110110011
301111010001
311111110000

Explanation:

  • The Gray code for any binary number can be generated by XORing the binary number with itself right-shifted by one bit. For example, for 16, in binary it’s (10000), and its Gray code is generated as follows: XOR(10000, 01000) = 11000.
  • The table above demonstrates the conversion of decimal numbers 16 through 31 to Gray code using this method.

Part (b): Excess-3 Gray Code for Decimals 10 to 19

Excess-3 is a binary-coded decimal (BCD) system where each decimal digit is represented by its corresponding binary equivalent plus 3. After this transformation, the result is used in generating the Gray code.

To get the Excess-3 Gray code, first add 3 to each decimal number (10 to 19) and convert the result to binary. Then, convert this binary value to Gray code.

DecimalExcess-3Binary (Excess-3)Gray Code (Excess-3)
101311011111
111411101010
121511111011
13161000011000
14171000111001
15181001011011
16191001111010
17201010011110
18211010111111
19221011011101

Explanation:

  • Excess-3 encoding: First, add 3 to the decimal values (10 to 19), which results in the numbers 13 to 22. These are then converted into binary, and the Gray code is generated as described in part (a).
  • For example, for decimal 10, Excess-3 gives 13, which in binary is (1101), and its Gray code is (1111).

Thus, the two tables display the Gray code transformations for the specified ranges in the question.

Scroll to Top