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?


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.

enter image description here

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.

  • 6
    \$\begingroup\$ +1 for nice disk.. Not sure about the clearly part though... my eyes are doing weird things looking at that ;D \$\endgroup\$ – Trevor_G Dec 27 '17 at 14:22
  • 1
    \$\begingroup\$ Even in normal binary code, each bit has an on-off pattern of 50%. Why is it not cyclic ? \$\endgroup\$ – Rajesh R Dec 27 '17 at 14:29
  • 1
    \$\begingroup\$ The 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. \$\endgroup\$ – Transistor Dec 27 '17 at 14:34
  • \$\begingroup\$ @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% \$\endgroup\$ – Zephyr Dec 27 '17 at 15:05
  • \$\begingroup\$ @Zephyr: I'm not sure why you're asking. Excess-3 is not a Gray code which is the topic in discussion here. \$\endgroup\$ – Transistor Dec 27 '17 at 15:11

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.

enter image description here

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.

enter image description here

  • 4
    \$\begingroup\$ The diagram at the end explains everything. +1. \$\endgroup\$ – Zephyr Dec 27 '17 at 15:39

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.