In which code the successive code characters differ in only one bit position?
96 views
- gray code (Correct Answer)
- excess 3 code
- 8421 code
- algebraic code
Explanation
Binary to Gray code converter.
MSB
Binary-> B3 B2 B1 B0
1 xor 0 xor 1 xor 1
Gray-> 1 1 1 0
G3 G2 G1 G0
MSB
When we are converting from binary to gray code ...let the no is 1011 . here the msb is 1.start from there .Write it as it is, then do the xor of 1(msb bit) and the next bit i.e 0 and go on doing like this.
G3=B3
G2= B3 xor B2
G1= B2 xor B1
G0= B1 xor B0
similarly when converting from GRAY CODE TO BINARY CODE.
MSB
Gray-> G3 G2 G1 G0
1 1 1 0
Binary-> 1xor G2 =0->0 xor G1=1->1 xor G0=1
MSB
B3=G3
B2=B3 xor G2
B1=B2 xor G1
B0=B1 xor G0