Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 11

BINARY TO GRAY CODE

CONVERSION USING PYTHON

Guided by - Mrs.R.Gomathi/ASP/ECE
Presented by - T. Nivetha, III-ECE-B
R. Nesiga, III-ECE-B
OBJECTIVES

• The logical circuit which converts the binary code to equivalent gray


code is known as binary to gray code converter. 

• Binary Numbers is default way to store numbers, but in many applications binary
numbers are difficult to use and a variation of binary numbers is needed. This is
where Gray codes are very useful. 

• Gray code has property that two successive numbers differ in only one bit because
of this property gray code does the cycling through various states with minimal
effort and used in K-maps, error correction, communication etc.
THE GRAY CODE
BINARY TO GRAY CODE CONVERSION

 The MSB in the gray code is the same as the corresponding MSB in the binary
number.
 Going from left to right, add each adjacent pair of binary code bits to get the next
gray code bit. Discard carries.
Convert 10110 to gray code
1+0+1+1+0 binary
| | | | |
1 1 1 0 1 gray
TRUTH TABLE
PROGRAM
def convert_gray(binary):
binary = Int(binary, 2)
binary ^= (binary >> 1)
return bin(binary)[2:]
binary_num = input(“BINARY NUMBER : ”)
gray _code = convert_gray(binary_num)
print(“EQUIVALENT GRAY CODE IS: ”,gray_code)

OUTPUT:
BINARY NUMBER: 101100110
Gray codeword is: 111010101
APPLICATIONS

• It is used in applications in which the normal sequence of binary numbers


generated by the hardware may produce an error or ambiguity during the
transition from one number to the next.

• The gray code eliminates his problem since one bit changes its values during
any transition between two numbers.

• Because of run-time typing, Python’s run time must work harder than Java`s.
Hence, is much better suited as a glue language.
advantages
• The main benefit of using binary code is that it is simply signified through
electronic devices

• Binary data is also very simple to store.

• Very easy to signify & control electronically & mechanically.

• The disparity among representations of symbols can be increased so


error possibility can be reduced
CONCLUSION

 This paper has introduced the review of reversible circuits and


reversible logic gates for realizing different code conveter like binary
to gray code converter.

 To represent digital circuits in SOP or POS form and to


reduce/optimize the digital circuits using expressions we need K-map.
So in K-map the encoding is done through gray coding instead of
binary code.
REFERENCE

[1]ho, H. and Swartzlander, E. E., Adder and multiplier design in binary to gray code conversion,
IEEE Transactions on Computers, 58(6), 2009, 721-727.
http://dx.doi.org/10.1109/TC.2009.21
[2] Lent C.S., Tougaw P.D., Porod W.D., and Bernstein., G.H. Quantum cellular automata,
Nanotechnology, 4(1), 1993, 49–57.
[3] Seminario J.M, Derosa P.A, Cordova L.E and Bozard B.H., A molecular device operating at
terahertz frequencies, IEEE Transactions on Nanotechnology, 3(1), 2004, 215–218.
http://dx.doi.org/ 10.1109/TNANO.2004.824012
[4] Zhang, R., Walus, K., Wang, W., and Jullien, G. A., A method of majority logic reduction for
quantum cellular automata, IEEE Transactions on Nanotechnology, 3(4), 2008, 443-450.
http://dx.doi.org/ 10.1109/TNANO.2004.834177
[5] Hänninen, I. and Takala, J., Binary adders on quantum-dot cellular automata. Journal of Signal
Processing Systems, 58(1), 2010, 87-103. http://dx.doi.org/ 10.1007/s11265-008-0284-5
[6] Kummamuru, R. K et al., Operation of a quantum-dot cellular automata (QCA) shift register
and analysis of errors, IEEE Transactions on Electron Devices, 50(9), 2003, 1906-1913.
http://dx.doi.org/ 10.1109/TED.2003.816522
THANK YOU

You might also like