As this code it is not applicable in any types of arithmetical operations but it has some applications in analog to digital converters and in some input/output devices. Now let us concentrate on the table of

From this table we can obtain the equivalent gray code of the decimal numbers. There are several steps which will make you understand how the codes are formed. (1) In case of gray code one bit will change from its previous in each steps. One thing must be kept in mind that the change of bit always occurs from the right side i.e from L.S.B towards the M.S.B. At first the first three bits are constant I,e 000 and the fourth bit changes from 0 to 1. We know that for binary digit possible combination is 0 and 1, so keeping first three bit constant the possible combination of 4th bit is over for decimal 0 and 1 respectively.

(2)Now move to the next bit from L.S.B i.e 3rd bit, that changes from 0 to 1 which is the decimal equivalent for 2. Now one more combination is left for the fourth bit keeping the first three constant i.e 001. We can change 4th bit from 1 to 0. Thus the gray code for decimal number 3 is 0010.

(3)Traverse to the next code. Here we can do only one thing i.e we can change the second bit as all possible combinations are over. Question may strike in your mind that why can’t we change the third bit again which will also be a one bit change from its previous. But changing third bit would give the equivalent gray code 0000 which has occurred earlier. So you must remember that a number occurring previously must not be repeated. So the equivalent code for 4 will be 0110. Here only the second bit has changed from the previous code. Now again we will keep first and second bit constant and find the possible combinations of the third and the fourth bit by only changing 1 bit in each steps.
Now for 5 only the fourth bit has changed. Again for 6 only the third bit is changed keeping others constant. Lastly at 7 again the fourth bit has changed from 1 to 0 where all other bits are constant. In 8 you can see that the equivalent gray code is 1100. Here the 1st bit changes from 0 to n1 as all the combination of the 2nd, 3rd and 4th bits are completed keeping the 1st constant at 0. Now in same way the 1st bit is kept constant and all the possible combination changing single bit in each step from right to left is done.

- The M.S.B. of the gray code will be exactly equal to the first bit of the given binary number.
- Now the second bit of the code will be exclusive-or of the first and second bit of the given binary number, i.e if both the bits are same the result will be 0 and if they are different the result will be 1.
- The third bit of gray code will be equal to the exclusive-or of the second and third bit of the given binary number. Thus the
**Binary to gray code conversion**goes on. One example given below can make your idea clear on this type of conversion.

Now concentrate on the example where the M.S.B. of the binary is 0 so for it will be 0 for the most significant gray bit. Next, the XOR of the first and the second bit is done. The bits are different so the resultant gray bit will be 1. Again move to the next step, XOR of second and third bit is again 1 as they are different. Next, XOR of third and fourth bit is 0 as both the bits are same. Lastly the XOR of fourth and fifth bit is 1 as they are different. That is how the result of binary to gray code conversion of 01001 is done whose equivalent gray code is 01101.

- The M.S.B of the binary number will be equal to the M.S.B of the given gray code.
- Now if the second gray bit is 0 the second binary bit will be same as the previous or the first bit. If the gray bit is 1 the second binary bit will alter. If it was 1 it will be 0 and if it was 0 it will be 1.
- This step is continued for all the bits to do
**Gray code to binary conversion**.

New Articles
Series and Parallel Inductors Electric PowerMeasurement of LossShunt ReactorIR MeasurementAmpere's Circuital LawClosely Related Articles
Binary Number SystemBinary Decimal ConversionBinary Coded DecimalBinary Octal ConversionOctal Decimal ConversionBinary Hexadecimal ConversionHexadecimal-Decimal ConversionGray CodeOctal Number SystemLogic Gates2′s Complement1′s ComplementASCII CodeHamming Code2s Complement ArithmeticError Detection and Correction Codes9s complement and 10s complement | SubtractionApplications of Logic GatesKeyboard EncoderAlphanumeric codesDigital ElectronicsBoolean AlgebraDe Morgan TheoremTruth TableBinary Arithmetic Binary AdditionBinary Subtraction Use of K MapBinary DivisionExcess 3 CodesK Map or Karnaugh MapBoolean AlgebraBinary MultiplicationParallel SubtractorBinary AdderBinary SubstractorSeven Segment DisplayBinary Gray Code ConversionBinary to BCD Code ConverterAnalog to Digital ConverterBinary EncoderBinary DecoderBasic Digital CounterDigital ComparatorBCD to Seven Segment DecoderParallel AdderParallel Adder or SubtractorMultiplexerDemultiplexer555 TimerLook Ahead Carry AdderOR OperationAND OperationLogical OR GateLogical AND GateNOT GateUniversal GateNAND GateDTL NAND GateX OR Gate & X NOR GateTransistor Transistor LogicNOR GateFan Out of Logic GatesINHIBIT GateNMOS Logic and PMOS LogicSchmitt GatesLogic Families Flip FlopsS R Flip FlopActive Low S R LatchClocked S R Flip FlopsD Flip FlopJ K Flip FlopMaster Slave Flip FlopRead Only MemoryProgrammable Logic DevicesProgrammable Array LogicApplication of Flip FlopsShift RegistersBuffer RegisterData Transfer in Shift RegistersSISO Shift RegisterSIPO Shift RegisterPISO Shift RegisterPIPO Shift RegisterUniversal Shift RegistersBidirectional Shift RegisterDynamic Shift RegisterApplications of Shift RegistersUPSConversion of Flip FlopsJohnson CounterSequence GeneratorRing Counter
Articles Categories
Basic Electrical Technology
Circuit and Network Theories
Electrical Laws
Engineering Materials
Battery Technologies
Illumination Engineering
Electrical Power Generation
Electrical Power Transmission
Electrical Switchgear
Electrical Protection
Electrical Measurement
Control System
Electrical Transformer
Electrical Motor
Induction Motor
DC Motor
Synchronous Motor
Electrical Generator
Electrical Drives
Electronics Devices
Power Electronics
Digital Electronics
Questions
MCQ