Sunteți pe pagina 1din 4

DIGITAL ELECTRONICS (331102)

PRACTICAL: 08

TO STUDY GRAY CODE


1.0 AIM :

 To study Gray Code and Conversion of Binary code into Gray Code and vice
versa.

2.0 PRIOR CONCEPTS :

 Knowledge of working of AND, OR, NOT and Ex-OR gate..

3.0 INTRODUCTION :

 Gray Code is a form of binary that uses a different method of incrementing from
one number to the next.

 With Gray Code, only one bit changes state from one position to another. This
feature allows a system designer to perform some error checking (i.e. if more
than one bit changes, the data must be incorrect).

 Advantage of Gray code over straight binary sequence: Only one bit in the code
group changes when going from one number to the next.

 Used in applications where the normal sequence of binary numbers may produce
an error or ambiguity during the transition from one number to the next. Ex: for
encoding shaft position data from machines such as computer-controlled lathes.

4.0 BINARY TO GRAY CODE CONVERSION :

 Procedure :
o Write the MSB of the Gray code
same as the corresponding MSB in
the binary number.
o Going from left to right, add each
adjacent pair of binary code bits to
get the next Gray code bit. Discard
the carries if any.

31 | P a g e
SOHIL VOHRA (LECTURER - SHRI K.J. POLYTECHNIC COLLEGE, BHARUCH (C.E. DEPTT))
DIGITAL ELECTRONICS (331102)

o Continue the process till the LSB is reached

5.0 GRAY TO BINARY CODE CONVERSION :


 Procedure:
o Write the MSB of the Binary code, same as
MSB of the given Gray code.
o Add the MSB in the binary result with the
immediate right most bit in the Gray code and
write the result as second binary digit.
o Continue the above process till the LSB is
reached. Discard carries, if any.

32 | P a g e
SOHIL VOHRA (LECTURER - SHRI K.J. POLYTECHNIC COLLEGE, BHARUCH (C.E. DEPTT))
DIGITAL ELECTRONICS (331102)

6.0 EXERCISE :

6.1 Convert following into Gray code:


1. 1000101011

2. 1000110110

3. 0010100101

4. 1100010101

6.2 Convert following into Binary code:


1. 1001010010

2. 0101011001

3. 1001011011

33 | P a g e
SOHIL VOHRA (LECTURER - SHRI K.J. POLYTECHNIC COLLEGE, BHARUCH (C.E. DEPTT))
DIGITAL ELECTRONICS (331102)

4. 1100010100

7.0 ASSIGNMENT :

7.1 Design a 6 bit Binary to Gray Code convertor and convert (100101) 2 into
Gray code and show the conversion.

7.2 Design a 6 bit Gray to Binary Code convertor and convert (100101) gray into
Binary code and show the conversion.

Grades for Exercise: .................................................

Grades for Assignment: .................................................

Signature of Lab Co-ordinators: .................................................

34 | P a g e
SOHIL VOHRA (LECTURER - SHRI K.J. POLYTECHNIC COLLEGE, BHARUCH (C.E. DEPTT))

S-ar putea să vă placă și