I understand why it is called reflexive and a unit distance code. I don't see any cyclic pattern which is repeating in the code. Why is it called a cyclic code?
3 Answers
cyclic
ˈsʌɪklɪk,ˈsɪklɪk/
adjective
1. occurring in cycles; regularly repeated.
You haven't given a reference for the 'cyclic code' terminology but there is certainly a cyclic patter. This is most obvious in an encoder disc.
Figure 1. The cyclic pattern of each bit is clearly visible on this optical absolute encoder disc.
Each bit has a repeating on-off pattern with a 50% mark-space ratio. The bits are arranged so that only one bit changes at a time. This prevents errors on transitions from one code to the adjacent one due to misalignment of sensors, etc.
There's a generic definition about the cyclic nature of the Gray code further down the Wikipedia Gray code article mentioned in altai's answer: "The last entry in Gn differs by only one bit from the first entry. (The code is cyclic.)". That is it can wrap while still maintaining only one-bit change.
It would be possible to generate a Gray-ish code that didn't have this property if, for example, the number of steps was not even or a power of 2. This might be acceptable in a linear encoder which wouldn't need to wrap.

- 168,990
- 12
- 186
- 385
-
6+1 for nice disk.. Not sure about the clearly part though... my eyes are doing weird things looking at that ;D – Trevor_G Dec 27 '17 at 14:22
-
1Even in normal binary code, each bit has an on-off pattern of 50%. Why is it not cyclic ? – Ramesh Dec 27 '17 at 14:29
-
1The binary code is cyclic too but not suitable for encoder applications. I presume you understand why we use the Gray code in the first place. If not, let me know and I can expand my answer later. – Transistor Dec 27 '17 at 14:34
-
@Transistor What about excess-3 code ? Why is not cyclic ? Except for the first number, even in excess 3 code every bit has on-off ratio of 50% – Zephyr Dec 27 '17 at 15:05
-
@Zephyr: I'm not sure why you're asking. Excess-3 is not a Gray code which is the topic in discussion here. – Transistor Dec 27 '17 at 15:11
-
@Transistor Yes I know it's bit off topic. But your definition of on-off ratio confused me a bit. So I asked it here. – Zephyr Dec 27 '17 at 15:12
-
@Zephyr: Fair enough. I'm not a subject matter expert so I started with the dictionary definition of cyclic and the encoder disc shows a cyclic pattern for each bit. Then I looked at the Gray code article (not) referenced by altai and reckoned that the *cyclic* term refers to the roll-over and that the one-bit-change-per-step still applies at that point. I suspect that that feature means that for a binary encoder it must have \$ 2^n \$ steps where *n* is an integer. I am not in a position to provide a proof for that. – Transistor Dec 27 '17 at 15:25
-
@Transistor: Excess-3 __is__ a Gray code. It's used when you want to transmit a 1-of-10 choice (a decimal digit, perhaps): the regular Gray code does not have the desired "only one bit changes" property when wrapping between 9 and 0, so we use 3..12 instead. – jasonharper Dec 27 '17 at 16:24
-
@jasonharper: A straight binary excess-3 code would have hex values 3 4 5 6 7 8 9 A B C in sequence, with all four bits changing between 7-8 and C-3. On the other hand, if one xors each bit with the preceding one, then the sequence would be 2 6 7 5 4 C D F E A, with bit changes 4 1 2 1 8 1 2 1 4 8 (making it a cyclic Gray code). – supercat Dec 27 '17 at 19:45
-
That's a pretty awesome looking encoder disk... Any idea what the resolution of that would be? – Matt Clark Dec 28 '17 at 17:41
-
@MattClark: Can you not work it out from the answer? How many bits does it have? How many steps does that give you? – Transistor Dec 28 '17 at 17:42
Take the four bit Gray code sequence below and print it out then cut it out with scissors. Then wrap the ends round and tape them together so you have a Gray-code band.
As you rotate the band notice there is only one bit change between every spot that is facing you, even when you cross the tape.
That is, it is a cyclic code that has no start and no end.
This is why Gray Code, named after it's inventor Frank Gray, is used for encoders where single bit transitions removes the uncertainty of having two bits changing at the same time.

- 46,364
- 8
- 68
- 151
The Gray code for decimal 15 rolls over to decimal 0 with only one switch change. This is called the "cyclic" property of a Gray code.
Straight from the Wikipedia article.

- 476
- 2
- 5