0% found this document useful (0 votes)
44 views2 pages

Application Note #5412: Gray Code Encoders

This document provides information about gray code encoders and how to convert between gray code and binary code. Gray code is a binary code where only one bit differs between adjacent numbers. The document explains the process to convert gray code to binary code and binary code to gray code through a series of steps. For each conversion, an example is provided using the decimal value 141. Contact Galil for more information on implementing gray code, which is not a standard interface for their controllers.

Uploaded by

rezakaihani
Copyright
© Attribution Non-Commercial (BY-NC)
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)
44 views2 pages

Application Note #5412: Gray Code Encoders

This document provides information about gray code encoders and how to convert between gray code and binary code. Gray code is a binary code where only one bit differs between adjacent numbers. The document explains the process to convert gray code to binary code and binary code to gray code through a series of steps. For each conversion, an example is provided using the decimal value 141. Contact Galil for more information on implementing gray code, which is not a standard interface for their controllers.

Uploaded by

rezakaihani
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 2

Application Note #5412

Gray Code Encoders


Background Absolute encoders provide parallel absolute position information in a binary format. Some absolute encoders use a special binary code known as gray code. The main characteristic of gray code is that only one bit differs from any adjacent numbers. To understand the difference between gray code and standard binary, this application note explains the conversion from one to the other. Gray code is not a standard interface for Galil controllers but can be implemented. For further information, please contact Galil. Converting Gray Code to Binary Code: This method converts gray code to natural binary. At each step, an example shows the conversion process for the decimal value 141. STEP 1. Begin with the highest order gray code logical one in the Gray code. The corresponding bit in the natural binary word will also be a logical one. Example: Decimal Gray Code Intermediate Binary 141 11001011 1------STEP 2. Complement the next digit in the Gray Code word to obtain the corresponding digit for the equivalent binary word. Example: Decimal Gray Code Intermediate Binary 141 11001011 10 - - - - - STEP 3. If the binary digit obtained in previous step is a logic zero, the following binary digit will be the same as its corresponding Gray code digit. If the binary digit is a logical one the following binary digit will be the complement of its corresponding Gray code digit. Example: Decimal Gray Code Intermediate Binary 141 11001011 100 - - - - STEP 4. Repeat Step 3 for each successive lower order digit.

-1Galil Motion Control, Inc. 3750 Atherton Road Rocklin, CA 95765 USA 800-377-6329 Ph: 916-626-0101 Fax: 916-626-0102 www.galilmc.com

FINAL RESULT: Decimal 141

Gray Code Intermediate Binary 11001011 1000 - - - 10001 - - 100011 - 1000110 10001101 Binary Value

Converting Binary Code to Gray Code: STEP 1. Start from the least significant bit of the natural binary. The corresponding gray code bit will be the same if the next significant digit in the binary word is a logical zero. The Gray code digit will be the complement of the corresponding natural binary bit if the next significant digit in the natural binary is a logical one. FINAL RESULT: Decimal Natural Binary 141 10001101 Intermediate Code -------1 - - - - - 011 - - - - 1011 - - - 01011 - - 001011 - 1001011 11001011 Gray Code

-2Galil Motion Control, Inc. 3750 Atherton Road Rocklin, CA 95765 USA 800-377-6329 Ph: 916-626-0101 Fax: 916-626-0102 www.galilmc.com

You might also like