Preview

Gray codes

Satisfactory Essays
Open Document
Open Document
392 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Gray codes
Gray Code
This is a variable weighted code and is cyclic. This means that it is arranged so that every transition from one value to the next value involves only one bit change. The gray code is sometimes referred to as reflected binary, because the first eight values compare with those of the last 8 values, but in reverse order.
The gray code is often used in mechanical applications such as shaft
Decimal Binary Gray encoders. Modulo 2 Arithmetic
0
0000 0000
This is binary addition with the carry ignored.
1
0001 0001
Converting Gray Code to Binary
A. write down the number in gray code
2
0010 0011
B. the most significant bit of the binary number is the most significant bit of
3
0011 0010 the gray code
C. add (using modulo 2) the next significant bit of the binary number to the
4
0100 0110 next significant bit of the gray coded number to obtain the next binary bit
5
0101 0111
D. repeat step C till all bits of the gray coded number have been added modulo 2
6
0110 0101 the resultant number is the binary equivalent of the gray number
Example, convert 1101101 in gray code to binary
Gray
1.
2.
3.
4.
3/4
3/4
3/4
3/4

Binary
1101101
1101101 1 copy down the msb
1101101 10 1 modulo2 1 = 0
1101101 100 0 modulo2 0 = 0
1101101 1001 0 modulo2 1 = 1
1101101 10010 1 modulo2 1 = 0
1101101 100100 0 modulo2 0 = 0
1101101 1001001 0 modulo2 1 = 1

the answer is 1001001

7
8

0111 0100
1000 1100

9
10
11

1001 1101
1010 1111
1011 1110

12
13
14

1100 1010
1101 1011
1110 1001

15

1111 1000

Converting Binary to Gray
A. write down the number in binary code
B. the most significant bit of the gray number is the most significant bit of the binary code
C. add (using modulo 2) the next significant bit of the binary number to the next significant bit of the binary number to obtain the next gray coded bit
D. repeat step C till all bits of the binary coded number have been added modulo 2 the resultant number is

You May Also Find These Documents Helpful

Related Topics