written 6.1 years ago by | • modified 6.1 years ago |
To convert decimal into gray code form, we will follow the following steps:-
1) Convert the decimal into its binary equivalent form.
2) To convert the binary form into its equivalent gray code form,
Let Binary code be b3 b2 b1 b0. Then, the respective Gray Code g3 g2 g1 g0 can be obtained is as follows:-
i.e.
g3 = b3
g2 = b3 ⊕ b2
g1 = b2 ⊕ b1
g0 = b1 ⊕ b0
Now,
1) $(42)_{10}$
The binary equivalent of $(42)_{10}$ is $(101010)_2$ i.e b5 = 1, b4 = 0, b3 = 1, b2 = 0, b1 = 1, b0 = 0.
Therefore, its gray code form is
g5 = b5 = 1
g4 = b5 ⊕ b4 = 1 ⊕ 0 = 1
g3 = b4 ⊕ b3 = 0 ⊕ 1 = 1
g2 = b3 ⊕ b2 = 1 ⊕ 0 = 1
g1 = b2 ⊕ b1 = 0 ⊕ 1 = 1
g0 = b1 ⊕ b0 = 1 ⊕ 0 = 1
Therefore, $(42)_{10} = (111111)_g$
2) $(17)_{10}$
The binary equivalent of $(42)_{10}$ is $(10001)_2$ i.e b4 = 1, b3 = 0, b2 = 0, b1 = 0, b0 = 1.
Therefore, its gray code form is
g4 = b4 = 1
g3 = b4 ⊕ b3 = 1 ⊕ 0 = 1
g2 = b3 ⊕ b2 = 0 ⊕ 0 = 0
g1 = b2 ⊕ b1 = 0 ⊕ 0 = 0
g0 = b1 ⊕ b0 = 0 ⊕ 1 = 1
Therefore, $(42)_{10} = (11001)_g$