Error Detection
The ASCII (American Standard Code for Information Interchange) TABLE
3 most sb\4 least sb |
0000 |
0001 |
0010 |
0011 |
0100 |
0101 |
0110 |
0111 |
1000 |
1001 |
1010 |
1011 |
1100 |
1101 |
1110 |
1111 |
000 |
NUL |
SOH |
STX |
ETX |
EOT |
ENQ |
ACK |
BEL |
BS |
HT |
LF |
VT |
FF |
CR |
SO |
SI |
001 |
DLE |
DC1 |
DC2 |
DC3 |
DC4 |
NAK |
SYN |
ETB |
CAN |
EM |
SUB |
ESC |
FS |
GS |
RS |
US |
010 |
SP |
! |
" |
# |
$ |
% |
& |
' |
( |
) |
* |
+ |
, |
- |
. |
/ |
011 |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
: |
; |
< |
= |
> |
? |
100 |
@ |
A |
B |
C |
D |
E |
F |
G |
H |
I |
J |
K |
L |
M |
N |
O |
101 |
P |
Q |
R |
S |
T |
U |
V |
W |
X |
Y |
Z |
[ |
\ |
] |
^ |
_ |
110 |
' |
a |
b |
c |
d |
e |
f |
g |
h |
i |
j |
k |
l |
m |
n |
o |
111 |
p |
q |
r |
s |
t |
u |
v |
w |
x |
y |
z |
{ |
| |
} |
~ |
DEL |
Parity Bits and Error Detection
Since ASCII consists of 7 bits we can add a "parity" bit. So that the sum of the bits is always odd (or even). If the
convention is agreed to by the sender and receiver, as long as there is only a one bit error, the error can be detected.
Example:
Symbol | ASCII | ASCII+odd parity | Bit Count |
B | 1000010 | 11000010 | 3 |
C | 1000011 | 01000011 | 3 |
Issues
- A single bit error can be detected but it cannot be corrected.
- Parity Checks do not work if there are are an even number of errors
____________________________________________________________________________________________________________________________
CheckSum Error Detection:
A slightly more robust technique is called the Checksum.
Assume that the message is a sequence of bytes. Before transmission, a Checksum byte or fixed number of bytes is computed and appended to the message.
The receiver performs the same calculation on the received message minus the Checksum byte or bytes. This result is checked against the
received Checksum and if they agree then it is assumed that the message is error free.
Example:
The Checksum will be one byte. The Checksum calculation will be,
Sum the bytes in the message mod 256.
For example, writing the bytes in decimal form:
The Message | 5 9 17 2 |
With Checksum | 5 9 17 2 33 |
Message Received | 7 9 18 2 33 |
5 + 9 + 17 +2 = 33
but
7 + 9 + 18 +2 = 36 ≠ 33
Some Issues:
- If there is an error in the Checksum itself but not in the message. The message would be seen as an error
- Two errors might cancel each other. 5 + 9 + 17 +2 = 5 + 8 + 18 + 2 = 33