1. (123)10 = ( ? )Gray CodeSolution:(123)10 = (_______)GrayCode1. Convert decimal to binary
(123)10 = (_______)22 | 123 | | |
2 | 61 | 1 | ↑ |
2 | 30 | 1 | ↑ |
2 | 15 | 0 | ↑ |
2 | 7 | 1 | ↑ |
2 | 3 | 1 | ↑ |
2 | 1 | 1 | ↑ |
| 0 | 1 | ↑ |
`:.` (123)
10 = (
1111011)
22. Convert binary to GrayCode
Binary code : `1111011`Method-1: (Binary to Gray code)
`g_6=b_6=1`
`g_5=b_6 o+ b_5=1 o+ 1=0`
`g_4=b_5 o+ b_4=1 o+ 1=0`
`g_3=b_4 o+ b_3=1 o+ 1=0`
`g_2=b_3 o+ b_2=1 o+ 0=1`
`g_1=b_2 o+ b_1=0 o+ 1=1`
`g_0=b_1 o+ b_0=1 o+ 1=0`
`:.`
Gray code : `1000110`
Method-2: (Binary to Gray code)
`b_6` `1` | `b_5` `1` | `b_4` `1` | `b_3` `1` | `b_2` `0` | `b_1` `1` | `b_0` `1` | Binary code |
`b_6` `1` | `b_6 o+ b_5` `1 o+ 1` | `b_5 o+ b_4` `1 o+ 1` | `b_4 o+ b_3` `1 o+ 1` | `b_3 o+ b_2` `1 o+ 0` | `b_2 o+ b_1` `0 o+ 1` | `b_1 o+ b_0` `1 o+ 1` | |
`darr` | `darr` | `darr` | `darr` | `darr` | `darr` | `darr` | |
`1` `g_6` | `0` `g_5` | `0` `g_4` | `0` `g_3` | `1` `g_2` | `1` `g_1` | `0` `g_0` | Gray code |
`:.`
Gray code : `1000110``:.` (123)10 = (1000110)GrayCode
2. (345)10 = ( ? )Gray CodeSolution:(345)10 = (_______)GrayCode1. Convert decimal to binary
(345)10 = (_______)22 | 345 | | |
2 | 172 | 1 | ↑ |
2 | 86 | 0 | ↑ |
2 | 43 | 0 | ↑ |
2 | 21 | 1 | ↑ |
2 | 10 | 1 | ↑ |
2 | 5 | 0 | ↑ |
2 | 2 | 1 | ↑ |
2 | 1 | 0 | ↑ |
| 0 | 1 | ↑ |
`:.` (345)
10 = (
101011001)
22. Convert binary to GrayCode
Binary code : `101011001`Method-1: (Binary to Gray code)
`g_8=b_8=1`
`g_7=b_8 o+ b_7=1 o+ 0=1`
`g_6=b_7 o+ b_6=0 o+ 1=1`
`g_5=b_6 o+ b_5=1 o+ 0=1`
`g_4=b_5 o+ b_4=0 o+ 1=1`
`g_3=b_4 o+ b_3=1 o+ 1=0`
`g_2=b_3 o+ b_2=1 o+ 0=1`
`g_1=b_2 o+ b_1=0 o+ 0=0`
`g_0=b_1 o+ b_0=0 o+ 1=1`
`:.`
Gray code : `111110101`
Method-2: (Binary to Gray code)
`b_8` `1` | `b_7` `0` | `b_6` `1` | `b_5` `0` | `b_4` `1` | `b_3` `1` | `b_2` `0` | `b_1` `0` | `b_0` `1` | Binary code |
`b_8` `1` | `b_8 o+ b_7` `1 o+ 0` | `b_7 o+ b_6` `0 o+ 1` | `b_6 o+ b_5` `1 o+ 0` | `b_5 o+ b_4` `0 o+ 1` | `b_4 o+ b_3` `1 o+ 1` | `b_3 o+ b_2` `1 o+ 0` | `b_2 o+ b_1` `0 o+ 0` | `b_1 o+ b_0` `0 o+ 1` | |
`darr` | `darr` | `darr` | `darr` | `darr` | `darr` | `darr` | `darr` | `darr` | |
`1` `g_8` | `1` `g_7` | `1` `g_6` | `1` `g_5` | `1` `g_4` | `0` `g_3` | `1` `g_2` | `0` `g_1` | `1` `g_0` | Gray code |
`:.`
Gray code : `111110101``:.` (345)10 = (111110101)GrayCode
This material is intended as a summary. Use your textbook for detail explanation.
Any bug, improvement, feedback then