

These codes are also known as unit-distance, single-distance, single-step, monostrophic or syncopic codes, in reference to the Hamming distance of 1 between adjacent codes.įor decimal 15 the code rolls over to decimal 0 with only one switch change.

This problem can be solved by changing only one switch at a time, so there is never any ambiguity of position, resulting in codes assigning to each of a contiguous set of integers, or to each member of a circular list, a word of symbols such that no two code words are identical and each two adjacent code words differ by exactly one symbol. If the output feeds into a sequential system, possibly via combinational logic, then the sequential system may store a false value. When the switches appear to be in position 001, the observer cannot tell if that is the "real" position 1, or a transitional state between two other positions. Even without keybounce, the transition might look like 011 - 001 - 101 - 100. In the brief period while all are changing, the switches will read some spurious position. In the transition between the two states shown above, all three switches change state. The problem with natural binary codes is that physical switches are not ideal: it is very unlikely that physical switches will change states exactly in synchrony. If that device uses natural binary codes, positions 3 and 4 are next to each other but all three bits of the binary representation differ: Many devices indicate position by closing and opening switches.


Ordering of binary values, used for positioning and error correction
