Hamming Code Encoder
๐ Hamming Code Basics
๐น Definition
Hamming codes are a type of error-detecting and error-correcting code that allows the detection and correction of single-bit errors in data transmission or storage. They add extra parity bits to data to ensure accuracy.
๐น Formula
To find number of parity bits (p):
2p โฅ m + p + 1
Where:
p = parity bits,
m = data bits
๐น Important Points
- Two main types: Even Parity and Odd Parity
- Parity bits are placed at positions that are powers of 2 (1, 2, 4, 8, ...)
- Each parity bit checks a specific set of bits, based on binary positions.
- Can correct single-bit errors and detect two-bit errors.
- Widely used in computer memory (ECC RAM) and communication systems.
๐น Process
- Determine p using the formula.
- Place parity bits at positions: 1, 2, 4, 8, etc.
- Fill remaining positions with data bits.
- Calculate each parity bit value by checking specific positions.
- Transmit the full codeword (data + parity bits).
๐น Example
Data: 1011 (Even Parity)
Step 1: m = 4 โ Find p using 2p โฅ m + p + 1
Step 2: p = 3 โ Total bits = 7 โ Positions (reverse view): P1, P2, D1, P4, D2, D3, D4 โ shown as bit 7 to bit 1.
Step 3: Fill data bits (7โ1): 1 0 1 _ 1 _ _
Step 4: Calculate parity bits:
- P1 (bit 1) = ?
- P2 (bit 2) = ?
- P4 (bit 4) = ?
Final Hamming Code (7โ1): 1 0 1 P4 1 P2 P1
Hamming Code Error Detector
๐ Concept: Hamming Code Error Detection
Definition: Hamming Code is an error-detecting and error-correcting code that can detect up to two-bit errors and correct one-bit errors in data transmission.
Formula for Parity Bits:
2^p โฅ m + p + 1 Where: p = number of parity bits m = number of data bits
๐ Concept:
Hamming code error detection works by using parity bits placed at specific positions in the data. Each parity bit is responsible for checking certain positions (including itself) to ensure the total number of 1s matches the chosen parity (even or odd). If a bit is flipped due to transmission errors, one or more parity checks will fail. By combining the positions of failed parity bits, we can find the exact location of the error and correct it.
๐ How Detection Works (Step-by-step):
- Number the bit positions starting from 1 (left to right or right to left, depending on convention).
- Identify parity bit positions (powers of 2 โ 1, 2, 4, 8, ...).
- Each parity bit checks a group of positions following its pattern:
- P1 checks positions 1, 3, 5, 7, 9, ...
- P2 checks positions 2, 3, 6, 7, 10, ...
- P4 checks positions 4โ7, 12โ15, ...
- If a parity check fails, note down its position value.
- Add up the values of failed parity bits โ this sum gives the exact position of the error.
- Flip the bit at that position to correct the code.
๐ก Example (Even Parity):
Received code: 0 1 0 0 0 1 1 Position index: 1 2 3 4 5 6 7 Parity type: Even Step 1: Check P1 โ bits 1, 3, 5, 7 โ (0, 0, 0, 1) โ 1 one โ FAIL Step 2: Check P2 โ bits 2, 3, 6, 7 โ (1, 0, 1, 1) โ 3 ones โ FAIL Step 3: Check P4 โ bits 4, 5, 6, 7 โ (0, 0, 1, 1) โ 2 ones โ PASS Failed parity bits: P1 (1), P2 (2) โ Sum = 1 + 2 = 3 โ Error is in position 3. Step 4: Flip bit 3 โ Corrected code: 0 1 1 0 0 1 1
โ Key Points:
- Position numbers are important for locating the error.
- Only one-bit errors can be detected and corrected with basic Hamming code.
- Multiple-bit errors may go undetected or be incorrectly corrected.
Number System Converter
Concept of Number System Conversion
Number systems are ways of representing numbers using different bases:
- Binary (Base 2): Uses only 0 and 1. Example:
1011โ= 11 in decimal. - Octal (Base 8): Uses digits 0โ7. Example:
17โ= 15 in decimal. - Decimal (Base 10): Standard number system with digits 0โ9.
- Hexadecimal (Base 16): Uses digits 0โ9 and AโF. Example:
1Aโโ= 26 in decimal.
How Conversion Works:
- To Decimal: Multiply each digit by its base power and sum them up.
Example:1011โ= (1ร2ยณ) + (0ร2ยฒ) + (1ร2ยน) + (1ร2โฐ) = 8 + 0 + 2 + 1 = 11 - From Decimal: Keep dividing by the target base and take remainders in reverse order.
Example: 26 โ divide by 16 โ quotient=1, remainder=10 (A) โ result: 1Aโโ - Direct Conversion: For binary โ octal/hex, group bits in sets of 3 (octal) or 4 (hex) and convert directly.
Gray Code Converter
What is Gray Code?
Gray code is a binary numeral system where two successive values differ by only one bit.
It is often used in digital communication and error correction to minimize errors during transitions.
Binary โ Gray: The first bit remains the same; each next bit is the XOR of the previous binary bit and the current binary bit.
Gray โ Binary: The first bit remains the same; each next binary bit is the XOR of the previous binary bit and the current Gray bit.
Example:
Binary: 1011 โ Gray: 1110
About Bit Code Converter
Bit Code Converter is your all-in-one solution to encode data with Hamming codes, detect transmission errors, and convert between binary, gray, decimal, octal, and hexadecimal formats.
Built for learners, students, and engineers seeking fast, accurate, and interactive tools in one suite.
Contact Us
๐ฌ Email: learnwithhraghava@gmail.com
๐ฌ We'd love your feedback and suggestions to improve Bit Code Converter!
Privacy Policy
We do not collect or store any personal information unless you choose to sign up. Your data stays yours.
All tools operate locally in your browser for speed and security.
Terms & Conditions
This tool is for educational and learning purposes only.
We provide no guarantee for correctness in mission-critical applications.