Page 167 - FUNDAMENTALS OF COMPUTER
P. 167
NPP
NPP Number System, Boolean Algebra and Logic Circuits 167
3.10 Gray Codes 3.10 J«o H$moS>
Before defining Gray codes first obtain a J«o H$moS> H$mo n[a^m{fV H$aZo go nyd© `h C{MV hmoJm
Gray code for a given binary number: {H$ XoI| {H$gr ~mBZar g§»`m H$m J«o H$moS> H¡$go
{ZH$mbVo h¢…
Step 1: Record the MSB of the given binary ñQ>on 1: Xr JB© ~mBZar g§»`m Ho$ MSB H$mo d¡go hr ZrMo
number. CVma bm|Ÿ&
Step 2: Perform arithmetic addition of this bit ñQ>on 2: Bg MSB H$mo AJbr {~Q> _| Omo‹S>mo VWm hm{gb
to the adjacent bit. Record the sum H$mo N>mo‹S> XmoŸ& `moJ H$mo ZrMo {bImoŸ&
and ignore carry.
Step 3 : Record the sum until LSB occurs. For ñQ>on 3: Eogm ~mBZar g§»`m Ho$ LSB Ho$ AmZo VH$ H$amoŸ&
example consider following Binary to {ZåZ {MÌ _| ~mBZar go J«o _| n[adV©Z Xem©`m
Gray Conversion.
J`m h¡…
Binary 1 1 0 1 0
Gray 1 0 1 1 1
Now make a table which gives Gray codes A~ EH$ Vm{bH$m ~ZmVo h¢ Omo 0 go 9 VH$ Ho$ {bE
for the decimal digits from 0 to 9: J«o H$moS> Xem©Vr h¡ …
Decimal Binary Gray code
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
Now consider the column of Gray codes. It J«o H$moS> Ho$ ñV§^ H$mo XoIZo go ñnï> h¡ {H$ O~ h_
gives an interesting property of Gray Codes. EH$ Jo« H$moS> go Xygao H$moS> _| OmVo h¢ Vmo h_ XoIVo h¢ {H$
When we move from one Gray code to next
Gray code, there is a change in one bit position EH$ hr {~Q> n[ad{V©V hmoVr h¡Ÿ& Bgr JwU H$s ghm`Vm go
only. Thus, the Gray codes may be defined as J«o H$moS> H$mo n[a^m{fV {H$`m Om gH$Vm h¡Ÿ&
those codes in which each succeeding number
differs from its previous number by one bit
position only.