M of n codes

From Wikipedia, the free encyclopedia

An m of n code is a separable error detection code with a code word length of n bits, where each code word contains exactly m instances of a "one." A single bit error will cause the code word to have either m + 1 or m – 1 "ones." An example m-of-n code is the 2 of 5 code used by the U.S. Post Office.

The simplest implementation is to append a string of ones to the original data until it contains m ones, then append zeros to create a code of length n.

Example:

3 of 6 code
Original 3 data bits Appended bits
000 111
001 110
010 110
011 100
100 110
101 100
110 100
111 000