Questions tagged [parity]

A parity bit, or check bit, is a bit that is added to ensure that the number of bits with the value one in a set of bits is even or odd. Parity bits are used as the simplest form of error detecting code.

A parity bit, or check bit, is a bit that is added to ensure that the number of bits with the value one in a set of bits is even or odd. Parity bits are used as the simplest form of error detecting code.

There are two variants of parity bits: even parity bit and odd parity bit. In case of even parity, the parity bit is set to 1, if the number of ones in a given set of bits (not including the parity bit) is odd, making the number of ones in the entire set of bits (including the parity bit) even. If the number of ones in a given set of bits is already even, it is set to a 0. When using odd parity, the parity bit is set to 1 if the number of ones in a given set of bits (not including the parity bit) is even, keeping the number of ones in the entire set of bits (including the parity bit) odd. when the number of set bits is odd, then the odd parity bit is set to 0.[1]

236 questions
1
vote
1 answer

hamming code parity distribution issue

Can someone please clarify where im going wrong. I'm at this 2 hours... I know that the first parity in the code includes itself and skips every first number after it in a yes and no sequence. the second skips every second set of numbers after…
Ravnica
  • 25
  • 4
1
vote
1 answer

Adding a parity bit in C

I understand parity bits, but in terms of my code, I don't know how to implement it. In my class, this is the code we're working with, and I can't seem to figure out how to add the parity bit to the beginning of the binary number when it's not being…
Jasmine
  • 313
  • 2
  • 23
1
vote
2 answers

Horizontal and Vertical Parity check codes

I was reading about horizontal and vertical parity check codes. One of the properties of these codes is that the final parity check (the lower right bit) is equal to modulo 2 sum of horizontal parity checks and also equal to modulo 2 of sum of…
Chander Shivdasani
  • 9,878
  • 20
  • 76
  • 107
1
vote
1 answer

Decode HEX string

I have this string received by a serial port (HEX): 02 30 31 30 30 3f 50 35 32 0d 0a 02 30 31 30 31 3f 55 35 38 0d 0a 02 30 31 30 32 3f 48 34 43 0d 0a 02 30 31 30 33 3f 45 34 41 0d 0a 02 30 31 30 34 3f 50 35 36 0d 0a 02 30 31 30 35 3f 55 35 43 0d…
andreamarz
  • 25
  • 3
1
vote
2 answers

Black-box counting to 19 with only 2 bits, and only toggleable?

Some student asked this on another site, but got no answers. I had a few stabs at it, but found it pretty tricky. Doing it with just the switches would require a 9:1 compression ratio, so I guess the trick is very much in the rules you assign to…
Lee B
  • 2,137
  • 12
  • 16
1
vote
2 answers

Number of parity bit required

I was reading about error detection and stumbled upon a statement which I didn't quite understand. The statement said "for a k bit string we need lg k parity bits to detect 2 bit errors".where lg is log to the base 2 I couldn't quite understand why…
Chander Shivdasani
  • 9,878
  • 20
  • 76
  • 107
1
vote
0 answers

What's the purpose of parity bit in PS/2 keyboard interface?

So I was reading about mentioned interface and the only thing I didn't get is the parity bit part. Is it used to somehow detect errors in transmission? If so, how?
Disciples
  • 662
  • 1
  • 6
  • 15
1
vote
0 answers

How often are parity checks actually required? (How often do such errors occur?)

I'm aware of various systems put in place to carry out error checks so that corrupted data can be restored or at least identified, however how often do such corruptions take place? Is it common for a parity check to be needed or just a precautionary…
Robbie Coyne
  • 11
  • 1
  • 3
1
vote
1 answer

CASE odd parity checker

I am new to vhdl and am attempting to write vhdl odd parity checker using Case within a process. When I compile there are no errors, but the output vector waveform for the output is flat for some reason. What am I doing wrong? Can someone assist…
Mac
  • 135
  • 1
  • 3
  • 13
1
vote
0 answers

linux serial: reading parity bit for 9bit communication

I need to read the 9th bit off the UART port that send 9bit data communication. Currently I have enabled parity but disable the checking so that I can properly read the data off the uart port. But I need to actually know what the 9th bit is on the…
elmerFudge
  • 11
  • 3
1
vote
1 answer

Porting C++ serial port parity change code from Linux to Windows

I'm not really experienced in programming, but I'm trying to port C++ code from Linux to Windows. It's a function which writes to the serial port and reads the answer, which is then parsed. I could probably put this together, but what I'm not sure…
1
vote
2 answers

bitparity code for odd number of bits

I came across this code while doing research for finding bit parity and have almost no idea why this works. Would anyone be able to enlighten me about its algorithm? x ^= x >> 16 x ^= x >> 8 x ^= x >> 4 x ^= x >> 2 x ^= x >> 1 x &= 1;
user4530199
1
vote
0 answers

Setting Parity Bit in a Transmission Program

I am writing a program that simulate a transmission of characters over the network. I have written the following function: int getCharBit(char c, int bitNum){ return (c & (1 <> bitNum; } // returns the ith bit of the character…
user3055141
  • 109
  • 1
  • 2
  • 8
1
vote
1 answer

Finding characters per sec using asynchronous mode

How many characters per sec(7bits+parity) can be transmitted over 2400bps line in asynchronous mode. I calculated it to be 300 but the book says it is 240....how?
Khan
  • 185
  • 1
  • 4
  • 15
1
vote
1 answer

Windows Serial Communication, Handle Parity bit

I am coding with serial communication in windows. In this communication, in order for program to recognize a start of message, i have to use parity bit. It means that if the byte received with setting parity bit is a start point of a message. For…
SangminKim
  • 8,358
  • 14
  • 69
  • 125