What are the users of gray code?

  • Thread starter Thread starter aspsrilanka
  • Start date Start date
  • Tags Tags
    Code
Click For Summary

Discussion Overview

The discussion centers around the practical applications of Gray code, particularly in digital design and hardware contexts. Participants explore various uses of Gray code, including its role in encoders and asynchronous circuits, while also questioning the depth of available information on the topic.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • Some participants note that while Gray codes are commonly discussed in digital design literature, there is often insufficient detail on their practical applications.
  • One participant mentions a specific application of Gray code in Karnaugh mapping logic functions, suggesting there may be uses in communication theory as well.
  • Another participant claims that Gray code is widely used to prevent glitches in fully asynchronous circuits, such as asynchronous FIFOs, due to its property of changing only one bit at a time.
  • A participant describes the use of Gray code in absolute encoders, explaining how it helps avoid misinterpretation of position during transitions between binary states.
  • There is a suggestion that the original question may not have been adequately researched, as one participant implies that basic information about Gray code can be found through a simple web search.

Areas of Agreement / Disagreement

Participants express varying levels of familiarity with Gray code applications, and while some specific uses are mentioned, there is no consensus on a comprehensive list of applications. The discussion remains unresolved regarding the depth of understanding and the extent of Gray code's practical uses.

Contextual Notes

Some participants express limitations in the available literature on Gray code, particularly regarding practical applications in hardware, indicating a potential gap in educational resources.

aspsrilanka
Messages
22
Reaction score
0
what are the users of gray code? (prctical aplications)
 
Engineering news on Phys.org
aspsrilanka said:
what are the users of gray code? (prctical aplications)

For testing wether students listened in the lecture or have read the textbook?
 
mgb_phys said:
For testing wether students listened in the lecture or have read the textbook?

what are you saying.

Most books on digital design & lecturers discuss Gray codes. However, most of the
focus is on generating these codes, rather than detailing their uses.

I read the Wikipedia article: http://en.wikipedia.org/wiki/Gray_code,
but it doesn't provide enough in-depth information of the uses of Gray
code in hardware.
 
aspsrilanka said:
what are you saying.

Most books on digital design & lecturers discuss Gray codes. However, most of the
focus is on generating these codes, rather than detailing their uses.

I read the Wikipedia article: http://en.wikipedia.org/wiki/Gray_code,
but it doesn't provide enough in-depth information of the uses of Gray
code in hardware.

mgb was kidding a bit, but not too far off the mark. I've only seen one practical application of Gray codes, and that's in Karnaugh mapping logic functions. There are probably applications in communication theory as well.
 
It's used everywhere, actually. The most common use is to avoid glitches in fully asynchronous circuits, like async FIFOs. Incrementing a gray-code value involves only a single bit change, so there is no possibility of glitching several bits at once. Multiple-bit glitches in a circuit like an async FIFO can cause the status flags (full, empty, etc.) to be momentarily invalid, and that can lead to all kinds of problems.

- Warren
 
Assuming this is a homework question then typing gray code into wiki/google will give some examples.
Posting here then asking 'so why are gray codes used with an angle encoder' is reasonable. Asking 'what are gray codes for' without doing this is not.
 
In my job, I use a lot of shaft encoders. There are 2 basic types of shaft encoders: incremental and absolute (there are also resolvers, which differ slightly in their implementation). For the sake of simplicity (and trying to stick to the point of the question), I'll use absolute encoders as my example. So from this point, on, when I mention an "encoder," I'll actually be referring to an "absolute encoder."

An encoder tells a computer the approximate position of it's input shaft. It does this via the use of a glass disc with several concentric bands of "blacked out" and "non-blacked out" areas. Each band has a photo diode pair (sender and receiver) placed so that the blacked out areas block the photo diode pair as they pass, thus producing 1's and 0's. Each band correlates to 1 bit of a binary number that the encoder produces; the more bands, the more bits, and therefore, more accuracy.

Imagine an encoder with only one band in which half of the band is blacked out. This would only be able to tell you if the shaft was in the 1st half of rotation, or the 2nd. An encoder with 2 bands would have one band like the one described above, and the other would have 4 sections: 2 blacked out sections opposite each other. If this second band was positioned so that one blacked out section and one clear section aligned with the single blacked out section of the first band, then the encoder would have the capability of producing the following 4 binary numbers: 00, 01, 10, and 11. This encoder would have twice the accuracy of the first encoder and could thus tell the computer it's position to the nearest 90 degrees (rather than 180 degrees, as before).

The problem with this is that the change from 01 to 10 requires both binary bits to change state at the same time. If the alignment of the photo diodes is not exact, then the possibility exists that the computer could misinterpret the position during this transition. For example, if the encoder is on it's way from 01 to 10, a misaligned photo diode pair may cause the computer to see one bit change before the other. This could cause the computer to "think" that the encoder is at either 11 or 00 (incorrectly) rather than at 10.

Gray code prevents this from happening by rearranging the binary code so that only one bit changes at a time when transitioning from one "position" to the next. In this example (with 2 bits), the blacked out areas could be placed so that the binary sequence instead becomes 00, 01, 11, 10. Now, slight misalignment doesn't affect the interpretation of the signal produced because now we only expect one bit to change at a time (we're never worried that another bit has to "catch up").

The more bands (and therefore more bits) that an encoder has, the more potential for this kind of problem exists, thus the need for a gray code.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 25 ·
Replies
25
Views
3K
  • · Replies 5 ·
Replies
5
Views
20K
Replies
10
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 0 ·
Replies
0
Views
3K
Replies
22
Views
3K
Replies
8
Views
8K