Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Parity bit
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Error detection== [[File:RS232 Oscilloscope Trace K-7E1.svg|thumb|Diagrammatic oscilloscope trace of voltage levels for a RS232 transmission of a 7 bit [[ASCII]] "K" character (4Bh = 1001011b) framed as 1 start bit, 7 data bits (least significant bit first), even parity, and 1 stop bit: 7E1.]] If an odd number of bits (including the parity bit) are [[Transmission (telecommunications)|transmitted]] incorrectly, the parity bit will be incorrect, thus indicating that a '''parity error''' occurred in the transmission. The parity bit is suitable only for detecting errors; it cannot [[Error correction code|correct]] any errors, as there is no way to determine the particular bit that is corrupted. The data must be discarded entirely, and [[automatic repeat-request|retransmitted from scratch]]. On a noisy transmission medium, successful transmission can therefore take a long time or even never occur. However, parity has the advantage that it uses only a single bit and requires only a number of [[XOR gate]]s to generate. See [[Hamming code]] for an example of an error-correcting code. Parity bit checking is used occasionally for transmitting [[ASCII]] characters, which have 7 bits, leaving the 8th bit as a parity bit. For example, the parity bit can be computed as follows. Assume [[Alice and Bob]] are communicating and Alice wants to send Bob the simple 4-bit message 1001. {| class="wikitable" |- ! Type of bit parity !! Successful transmission scenario |- | Even parity || Alice wants to transmit: 1001 and 1011 Alice computes parity bit value: <br>1+0+0+1 (mod 2) = 0 <br>1+0+1+1 (mod 2) = 1 Alice adds parity bit and sends: <br>1001'''0''' and 1011'''1''' Bob receives: 10010 and 10111 Bob computes parity: <br>1+0+0+1+0 (mod 2) = 0 <br>1+0+1+1+1 (mod 2) = 0 Bob reports correct transmission after observing expected even result. |- | Odd parity || Alice wants to transmit: 1001 and 1011 Alice computes parity bit value: <br>1+0+0+1 (+ 1 mod 2) = 1 <br>1+0+1+1 (+ 1 mod 2) = 0 Alice adds parity bit and sends: <br>1001'''1''' and 1011'''0''' Bob receives: 10011 and 10110 Bob computes overall parity: <br>1+0+0+1+1 (mod 2) = 1 <br>1+0+1+1+0 (mod 2) = 1 Bob reports correct transmission after observing expected odd result. |} This mechanism enables the detection of single bit errors, because if one bit gets flipped due to line noise, there will be an incorrect number of ones in the received data. In the two examples above, Bob's calculated parity value matches the parity bit in its received value, indicating there are no single bit errors. Consider the following example with a transmission error in the second bit using XOR: {| class="wikitable" |- ! Type of bit parity error !! Failed transmission scenario |- | Even parity Error in the second bit || Alice wants to transmit: 1001 Alice computes parity bit value: 1^0^0^1 = 0 Alice adds parity bit and sends: 10010 '''...TRANSMISSION ERROR...''' Bob receives: 1'''1'''010 Bob computes overall parity: 1^1^0^1^0 = 1 Bob reports incorrect transmission after observing unexpected odd result. |- | Even parity Error in the parity bit ||Alice wants to transmit: 1001 Alice computes even parity value: 1^0^0^1 = 0 Alice sends: 10010 '''...TRANSMISSION ERROR...''' Bob receives: 1001'''1''' Bob computes overall parity: 1^0^0^1^1 = 1 Bob reports incorrect transmission after observing unexpected odd result. |} There is a limitation to parity schemes. A parity bit is guaranteed to detect only an odd number of bit errors. If an even number of bits have errors, the parity bit records the correct number of ones even though the data is corrupt. (See also [[error detection and correction]].) Consider the same example as before but with an even number of corrupted bits: {| class="wikitable" |- ! Type of bit parity error !! Failed transmission scenario |- | Even parity Two corrupted bits || Alice wants to transmit: 1001 Alice computes even parity value: 1^0^0^1 = 0 Alice sends: 10010 '''...TRANSMISSION ERROR...''' Bob receives: 1'''1'''01'''1''' Bob computes overall parity: 1^1^0^1^1 = 0 Bob reports correct transmission though actually incorrect. |} Bob observes even parity, as expected, thereby failing to catch the two bit errors.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)