# Help, 2 in 5 digital error detecting question (M in N)

1. Sep 1, 2010

### Tek1Atom

Help, "2 in 5" digital error detecting question (M in N)

1. The problem statement, all variables and given/known data

Explain how a "2 in 5" code can detect all single bit errors but only some double errors in the 5-bit coding of a single digit.

give an example where, in one 5-bit code of a single decimal digit

a) Two errors can be detected
b) Two errors cannot be detected

2. Relevant equations

"m in n" error detection codes in Digital Design

3. The attempt at a solution

if 4 bits are set to 1 and in the total 5 bits, than this can cause confusion when processing.

a) 10101
b) 01111

2. Sep 1, 2010

### Staff: Mentor

Re: Help, "2 in 5" digital error detecting question (M in N)

Might help to tell us what a "2 in 5" error detection code is...

3. Sep 1, 2010

### Tek1Atom

Re: Help, "2 in 5" digital error detecting question (M in N)

" m out of n " codes

An alternative method of detecting errors is to use an " m out of n " code where n represents the total number of bits in a binary word, of which m must be set to.

1. if more or less than n bits are set to 1 then errors are present. The error detection circuitry has to count the number of bits set to 1 in a word and compare it with m. This is a relatively simple operation.

e.g.

devise a " 2 in 5 " code to represent the decimal digits 0 to 9. Each codeword must have 2 bits set and be 5 bits long. Valid codewords can be identified by counting in pure binary and using only those words that have 2 bits set.

Count | Action
00000 | Ignore
00001 | Ignore
00010 | Ignore
00011 | Valid code equivalent to 0 (decimal)
00100 | Ignore
00101 | Valid code equivalent to 1 (decimal)

Solution

The full code is

"2 in 5"| Decimal
00011 | 0
00101 | 1
00110 | 2
01001 | 3
01010 | 4
01100 | 5
10001 | 6
10010 | 7
10100 | 8
11000 | 9

________________________________________________________________
Information Source: Digital Logic Techniques by T.J. Stonham (Third Edition)

4. Sep 1, 2010

### Tek1Atom

Re: Help, "2 in 5" digital error detecting question (M in N)

Any ideas Mark44?

5. Sep 2, 2010

### Staff: Mentor

Re: Help, "2 in 5" digital error detecting question (M in N)

In the above, I think you mean "if more or less than m bits are set to 1". You can't have more than n bits in a word of n bits.
Why is the first column labelled Count? Aren't these just example words?
There are 5C2 (5 choose 2) ways of setting exactly two bits in a 5-bit word. 5C2 = 5!/(3! * 2!).

I don't know if this is much help, but that's all I can think of. I don't understand how this ties into what you're being asked in the first post.