answersLogoWhite

0

Gray code, named after Frank Gray, a Bell Labs researcher who originally called it "reflected binary code", is used to help correct errors in digital communications. It was developed as a response to preventing desynchronized switching actions, requiring only one switch be flipped to increment or decrement a binary value represented by a hardware-based switch array.

The simplest method, without using a whole lot of CPU or brain power, is to create an array of Gray code values that correspond to their binary representation. For example, a 2-bit Gray code array would consist of the following values:

int gray2bit[]={0, 1, 3, 2};

A 3-bit Gray code array would be declared and initialized as follows:

int gray3bit[]={0, 1, 3, 2, 6, 7, 5, 4};

To find the Gray code for a particular value, simply reference that offset in the desired array:

int n=gray2bit[2]; /* results in 3 */

int m=gray3bit[6]; /* results in 5 */

See the related links for more information on Gray codes as well as sample source code that will assist you further.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

How do you write a c program to convert binary to decimal by using while statement?

write a c++ program to convert binary number to decimal number by using while statement


Write a C program that takes a binary file as input and finds error check using different mechanisms?

write a c program that takes a binary file as input and finds error check using different mechanisms.


Write a c program to convert binary number to decimal number?

How is this a question? Sounds like you should do more of your homework offline.


Write a program that takes a binary file as input and finds error check using different mechanism?

networking


Write a Program to convert decimal number into hexadecimal no without using function and string?

This is not a question.


Write algorithms and draw a corresponding flow chart to convert a decimal number to binary equiavalent?

Write algorithms and draw a corresponding flow chart to convert a decimal number to binary equivalent?


Write a program to convert stack into queue using c language?

In order to write a program to convert stack into queue using c language you must be able to identify the proper program. Having a special certification in programing will be beneficial as well to make sure you recognize the proper queues for the programs.


Write a program of binary heap in c or c language?

to implement operations on binary heap in c


Write a program to convert a 2 digit BCD number into hexadecimal number?

Write a program to convert a 2-digit BCD number into hexadecimal


How do you convert Binary-to-Decimal and Decimal-to-Binary?

You can use a table to convert binary to decimal & back:MSBBinary DigitLSB2827262524232221202561286432168421Figure out the greatest power that will fit into the number you want to convert to binary. Move to the next lower power of two. If you can fit into the next lower number write down a "1", if it can't put down "0". Put together the binary answer.


2 Write a program to convert a 2-digit BCD number into hexadecimal?

WRITE A PROGRAM TO CONVERT A 2-DIGIT bcd NUMBER INTO HEXADECIMAL


How can you write a program to convert binary code to gray code using 8085 microprocessor?

It can be implemented very easily .... Suppose the Binary word is X7X6X5.... X0 then the corresponding Gray code is G7G6G5....G0 where G7=X7 G6=X7 XOR X6 G5=X6 XOR X5 ..... G0=X1 XOR X0 Now implement the above algorithm