Quantcast
Viewing all articles
Browse latest Browse all 3

Binary to gray code conversion

Binary to gray code

  1. First, write the binary code and copy down MSB. The MSB of gray and binary code are same.
  2. Then, add MSB and next lower significant bit and write down the addition of them.
  3. Continue the same process for all bits.

E.g. Find gray code for (1100)2

 Image may be NSFW.
Clik here to view.
Binary to gray

List of gray codes of first 16 binary numbers.

BINARY

GRAY

0000

0000

0001

0001

0010

0011

0011

0010

0100

0110

0101

0111

0110

0101

0111

0100

1000

1100

1001

1101

1010

1111

1011

1110

1100

1010

1101

1011

1110

1001

1111

1000

Alternate method

There is an alternate method for finding gray code.

  1. Write down the binary code.
  2. Once again write the binary code starting from second MSB.
  3. Add both of them and ignore any carry in the process.Also ignore the LSB of the sum.

 

   1 1 0 1

+ 1 1 0 1

   1 0 1 1

Use the method you feel is simpler. Both of them will give correct gray code.

 

TAGS:

binarycodeconversiongray

Comments:


Source link

The post Binary to gray code conversion appeared first on Speak Electronics.


Viewing all articles
Browse latest Browse all 3

Trending Articles