PANGASINAN
PANGASINANSTATE
STATEUNIVERSITY
UNIVERSITY
URDANETA CITY
URDANETA CITYCAMPUS
CAMPUS
COLLEGEOF
COLLEGE OF ENGINEERING
ENGINEERING AND ARCHITECTURE
AND ARCHITECTURE
DEPARTMENT OF COMPUTER ENGINEERING
DEPARTMENT OF2020-2021,
ACADEMIC YEAR COMPUTER ENGINEERING
FIRST SEMESTER
ACADEMIC YEAR 2021-2022, FIRST SEMESTER
Gray Code
(Binary – Gray Code
Gray Code – Binary)
Submitted by: Submitted to:
Jayvee S. Mortel Engr. Mark Joniel Lopez
ASSIGNMENT: Gray Code BS COMPUTER ENGINEERING
2
LOGIC CIRCUITS AND DESIGN
❖ Gray code is also Reflected Binary Code (RBC)
❖ It was named after Frank Gray
❖ It is also called Unit distance code & maximum error code and
sometimes called cyclic code.
Decimal Binary Gray code
0 0 0 0 0 0 0 0 0
1 0 0 0 1 0 0 0 1
2 0 0 1 0 0 0 1 1
0 0 1 1 0 0 1 0
3
4 0 1 0 0 0 1 1 0
❖ Binary number is converted to Gray code to reduce switching
operation.
Binary to Gray Code Conversion
Steps:
1. Record the Most Significant Bit (MSB) as it is.
2. Add the MSB to the next bit,record the sum and neglect the carry or
simply peform XOR operation.
3. Repeat the process.
PANGASINAN STATE UNIVERSITY REGION’S PREMIER UNIVERSITY OF CHOICE
ASSIGNMENT: Gray Code BS COMPUTER ENGINEERING
2
LOGIC CIRCUITS AND DESIGN
Example :
Convert 1011 to Gray Code
b3 b2 b1 b0
g3 = b3
1 0 1 1 Binary
g2 = b2 b3
g1 = b1 b2
1 1 1 0 Gray Code g0 = b0 b1
g3 g2 g1 g0
Gray Code Conversion to Binary
Steps:
1. Record the Most Significant Bit (MSB) as it is.
2. Add the MSB to the next bit of Gray Code ,record the sum and
neglect the carry or simply peform XOR operation.
3. Repeat the process.
Example :
Convert 1011 to Binary
g3 g2 g1 g0
Gray Code b3 = g3
1 1 1 0
b2 = b3 g2
b1 = b2 g1
1 0 1 1 Binary b0 = b1 g0
b3 b2 b1 b0
PANGASINAN STATE UNIVERSITY REGION’S PREMIER UNIVERSITY OF CHOICE