Appendix D. Gray Codes

Gray, But Not Gloomy

When moving between states in a standard binary sequence, multiple bits may change from 0 to 1 or vice versa; for example, two bits change value when moving from 00102 to 01002. In the physical world there is no way to ensure that both bits will transition at exactly the same time, so this system may actually pass through an intermediate state. That is, our intended state change of 00102 to 01002 might result in the sequence 00102 to 01102 to 01002, or possibly 00102 to 00002 to 01002. And if more bits are changing, we might bounce though a series of intermediate values.

One way to avoid this problem is to use a Gray code,[1] in which only a single bit changes when moving between states (Figure D.1 ...

Get Bebop to the Boolean Boogie, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.