Hamming Code Cleaned
Hamming Code Cleaned
Alphanumeric code is a system that combines letters (A-Z) and digits (0-9)
represent Information. This is type of code is extremely versatile and widely used in
numerous field for data encoding, identification, and encryption purposes .
Alphanumeric character give a greater range of possible combination compared to a
code using only number or only letters , which enhances it’s utility in fields that
require large set of unique identifiers. Generally the digital system are deals with zero
& one in order to make a system to deal with a both numbers & letters we often use
the alphanumeric codding system. There are numerous codding method have been
invented but most commonly alphanumeric code are :-
ASCII
EBCDIC
ASCII CODE
The term ASCII stands for(American standard code information interchange) and it
was first published in 1967 & after that it’s being changed & updated. It’s widely
used in computer & other electronic devices for encoding text and data. ASCII
assigns each character (letters, digits ,punctuation, etc ) in a unique number
between 0-128 where simply 95 characters are printable which limited severely it’s
scope due to digital systems technical limitations such as computer at invented time.
ASCII Character Set.
The ASCII character set consist of 128 characters, which are divided into several
categories
1. Control characters (0-31 and 127)
These characters are Non printing characters for controlling hardware device (like
printers) or controlling data flow (like carriage return).
Example:- a) 0:Null character (NULL)
b) 9:Horizontal Tab (TAB)
c) 10:Line feed (LF) move to the next line
2. Printable character (32-126)
These character represent text and are ones you usually see in document. They
include :-
32: Space ( )
33: Exclamation mark (!)
48-57:digits (0-9)
32-47, 58-64, 91-96, 123-126: Punctuation marks and special symbol ( eg.
,@, $, %, &, *, (, ), etc)
3. Extended ASCII (128-255)
Extended ASCII includes Additional character, which were added to cover other
languages, symbol & graphics. These are used in extended or Non-standard ASCII
system, as the original ASCII standard only defined 128 characters.
HAMMING CODE
Is the type of error detecting and error correcting code used in digital
systems like computer memory, communication system
This was invented by R.W.Hamming in 1950 for detecting and correcting
single- bit errors in data transmission or storage
Hamming code has two essential elements these are
Data part; is the original data bits that need to be transmitted. These are the
actual bits of information that you want to send.
Parity part; is the additional bits that are added to the data bits to provide
error detection and correction capabilities. These parity bits are calculated
based on the data bits and are used to detect and correct errors that may
occur during transmission.
In a Hamming code, the parity bits are inserted at specific positions among
the data bits, and the resulting code is called a Hamming code . The parity
bits are typically denoted as p1, p2, p3, and so on.
For example, in a (7-bit ) Hamming code, there are 4 data bits (D1, D2, D3,
AND D4) and 3 parity bits (P1, P2, AND P3)
Placement of Parity Bits:
Parity bits are placed at positions that are powers of 2 (e.g., 1, 2, 4, 8, 16,
etc.) within the code word.
The remaining positions are used for the data bits.
Example of 7- bit hamming code with 4 data bit and 3 parity bit will be
placed in a position as
P1 P2 D1 P4 D2 D3 D4
Example 1:
Let x = 4. Find minimum P such that 2^p ≥ 4 + p + 1
Therefore;
P1 covers bits: 1, 3, 5, 7
P2 covers bits: 2, 3, 6, 7
P4 covers bits: 4, 5, 6, 7
Each parity bit is calculated using even parity (unless otherwise stated).
Encode the 4-bit binary word: 1011 using a 7-bit Hamming Code with even parity
position 1 2 3 4 5 6 7
bits 1 0 1 1
P1 P2 D1 P4 D2 D3 D4 Step 2: Calculate parity bits
- P1 (positions 1, 3, 5, 7) → bits:
1, 0, 1 → 2 ones → Even → P1 = 0
- P2 (positions 2, 3, 6, 7) → bits: 1, 1, 1 → 3 ones → Odd → P2 = 1
- P4 (positions 4, 5, 6, 7) → bits: 0, 1, 1 → 2 ones → Even → P4 = 0
A parity bit
A parity bit is an extra bit that is added to the message bits or data-word bits on the
sender side.
Data-word bits along with parity bits is called a codeword.
The parity bit is added to the message bits on the sender side, to help in error
detection at the receiver side.
Parity Bit Method of detecting error
A parity bit is an extra bit included in the binary message to make a total number of
1’s either odd or even.
There are two parity systems
Even parity checks
odd parity checks.
To add an even check, you count the number of 1s in the message. If the count is
odd, you add a 1 to the end of the message. If the count is even, you add a 0. This
way, the total number of 1s in the message (including the added bit) is always even.
to iemploy this,. You count the number of 1s in the message. If the count is even, you
add a 1 to the end of the message. If the count is odd, you add a 0. This way, the total
number of 1s in the message (including the added bit) is always odd.
When the message is received, the receiver checks the parity bit (the added bit) to
make sure it matches the expected pattern (even or odd). If it doesn't match, it
means an error occurred during transmission, and the receiver can request the
message to be resent.
Or other way
Given hamming code 0010011 is received.
Check:
- P1 (positions 1, 3, 5, 7) → bits: 0, 1, 0, 1 → 2 ones → Even → Correct
- P2 (positions 2, 3, 6, 7) → bits: 0, 1, 1, 1 → 3 ones → Odd → Error
- P4 (positions 4, 5, 6, 7) → bits: 0, 0, 1, 1 → 2 ones → Even → Correct
Bit positions:
1(P1), 2(P2), 3(D1), 4(P4), 5(D2), 6(D3), 7(P8), 8(D4), 9(D5)