0% found this document useful (0 votes)
55 views9 pages

DE Experiment 7

This document discusses binary to gray code and gray to binary code conversion. It provides the theory and logic behind the conversions. Truth tables and logic circuits are given for both conversions. The aim is to configure various code converters in both online and offline modes. Screenshots of simulations of the conversions in Virtual Labs and Deldsim are to be pasted.

Uploaded by

fsargath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views9 pages

DE Experiment 7

This document discusses binary to gray code and gray to binary code conversion. It provides the theory and logic behind the conversions. Truth tables and logic circuits are given for both conversions. The aim is to configure various code converters in both online and offline modes. Screenshots of simulations of the conversions in Virtual Labs and Deldsim are to be pasted.

Uploaded by

fsargath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Marwadi University

Faculty of Engineering and Technology


Department of Information and Communication Technology

EXPERIMENT 7

AIM: Configure various code converters.


a) Binary to Gray code b) Gray to Binary code

Mode of Experiment:Online and Offline both

Virtual Lab:
Welcome to Virtual Labs - A MHRD Govt of india Initiative (vlabs.ac.in)

https://www.deldsim.com/simulator/

Theory: 1) Binary to Gray conversion :

1. The Most Significant Bit (MSB) of the gray code is always equal to the MSB
of the given binary code.
2. Other bits of the output gray code can be obtained by Ex-ORing binary code
bit at that index and previous index.

There are four inputs and four outputs. The input variable are defined as B3,
B2, B1, B0 and the output variables are defined as G3, G2, G1, G0. From the
truth table, combinational circuit is designed.The logical expressions are
defined as :

B3 = G3

B2 ⊕ B3 = G2

B1 ⊕ B2 = G1

B0 ⊕B1 =G0

Digital Electronics
Marwadi University
Faculty of Engineering and Technology
Department of Information and Communication Technology

Figure-1: Binary to Gray Code Converter Circuit

Figure-2: Binary to Gray Code Converter Truth Table

2) Gray to binary conversion :


1.The Most Significant Bit (MSB) of the binary code is always equal to the
MSB of the given binary number.
2.Other bits of the output binary code can be obtained by checking gray code
bit at that index. If current gray code bit is 0, then copy previous binary code
bit, else copy invert of previous binary code bit.

There are four inputs and four outputs. The input variable are defined as G3,
G2, G1, G0 and the output variables are defined as B3, B2, B1, B0. From the truth
table, combinational circuit is designed.The logical expressions are defined as
Digital Electronics
Marwadi University
Faculty of Engineering and Technology
Department of Information and Communication Technology

G0 ⊕ G1 ⊕ G2 ⊕ G3 = B0

G1 ⊕ G2 ⊕ G3 = B1

G2 ⊕ G3 = B2
G3 =B3

Figure-3: Gray to Binary Code Converter Circuit

Figure-4: Gray to Binary Code Converter Truth Table

Binary to Gray

Digital Electronics
Marwadi University
Faculty of Engineering and Technology
Department of Information and Communication Technology

Truth Table:
Binary Gray
Serial B3 B2 B1 B0 G3 G2 G1 G0
No. (MSB) (LSB) (MSB) (LSB)
1 0 0 0 0 0 0 0 0
2 0 0 0 1 0 0 0 1
3 0 0 1 0 0 0 1 1
4 0 0 1 1 0 0 1 0
5 0 1 0 0 0 1 1 0
6 0 1 0 1 0 1 1 1
7 0 1 1 0 0 1 0 1
8 0 1 1 1 0 1 0 0
9 1 0 0 0 1 0 0 0
10 1 0 0 1 1 0 0 1
11 1 0 1 0 1 0 1 1
12 1 0 1 1 1 0 1 0
13 1 1 0 0 1 1 1 0
14 1 1 0 1 1 1 1 1
15 1 1 1 0 1 1 0 1
16 1 1 1 1 1 1 0 0

Gray to Binary Code logic circuit:

Truth Table:
Gray Binary
Serial G3 G2 G1 G0 B3 B2 B1 B0
No. (MSB) (LSB) (MSB) (LSB)
1 0 0 0 0 0 0 0 0
2 0 0 0 1 0 0 0 1
3 0 0 1 0 0 0 1 1
4 0 0 1 1 0 0 1 0
5 0 1 0 0 0 1 1 1
6 0 1 0 1 0 1 1 0
7 0 1 1 0 0 1 0 0
8 0 1 1 1 0 1 0 1
9 1 0 0 0 1 1 1 1
10 1 0 0 1 1 1 1 0
11 1 0 1 0 1 1 0 0
12 1 0 1 1 1 1 0 1
13 1 1 0 0 1 0 0 0
14 1 1 0 1 1 0 0 1
15 1 1 1 0 1 0 1 1
16 1 1 1 1 1 0 1 0

Procedure:

Digital Electronics
Marwadi University
Faculty of Engineering and Technology
Department of Information and Communication Technology

Binary to Gray:

Gray to Binary:

Paste your Virtual Lab simulation result screen shot here:


Digital Electronics
Marwadi University
Faculty of Engineering and Technology
Department of Information and Communication Technology

Digital Electronics
Marwadi University
Faculty of Engineering and Technology
Department of Information and Communication Technology

Paste your Deldsim simulation result screen shot here:

Binary to Gray:

Gray to Binary:

Digital Electronics
Marwadi University
Faculty of Engineering and Technology
Department of Information and Communication Technology

Conclusion:

Digital Electronics
Marwadi University
Faculty of Engineering and Technology
Department of Information and Communication Technology

Post Lab Exercise

1. In a Gray code, each number is 3 greater than the binary representation of that
number.
A. True

B. False
2. The primary use for Gray code is:
A. coded representation of a shaft's mechanical position

B. turning on/off software switches

to represent the correct ASCII code to indicate the angular position of a shaft on
C.
rotating machinery

to convert the angular position of a shaft on rotating machinery into hexadecimal


D.
code
3. Why is the Gray code more practical to use when coding the position of a rotating
shaft?
A. All digits change between counts.

B. Two digits change between counts.

C. Only one digit changes between counts.


4. Which of the following is not a weighted value positional numbering system:
A. hexadecimal

B. Grey Code

C. binary

D. octal

Sign: Date:

Digital Electronics

You might also like