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

determine parity of a bit representation of a number in MIPS

Is there some instruction in MIPS that will determine the parity of a certain bit representation? I know to determine whether a "number" has an even parity or an odd parity is to XOR the individual bits of the binary representation together, but…
Hristo
  • 45,559
  • 65
  • 163
  • 230
1
vote
1 answer

compute parity by unsetting right most bit

The first approach to computing parity is doing xor operation on every bit. - This was simple to understand. An enhancement to that is to drop the lower bit and keep inverting parity till the number becomes 0 ie While loop till number is greater…
Sandy
  • 313
  • 1
  • 4
  • 13
1
vote
2 answers

Disable Parity Bit for serial Communication does not work

I have a problem with sending bytes through my comport. It sends a parity bit, although it is explicitly turned off (i need the byte without parity to communicate with some hardware). My code is really simple: Process p =…
modmoto
  • 2,901
  • 7
  • 29
  • 54
1
vote
2 answers

ASCII with odd parity

Consider a data communications system that represents characters using ASCII with odd parity. Each 7-bit ASCII character is followed by a parity bit. Specify the resulting 8-bit code word for each of the characters in the following message that is…
k_rollo
  • 5,304
  • 16
  • 63
  • 95
1
vote
1 answer

XOR parity check with PHP

My client's PHP web application imports CSV data from a 3rd party, and I've been tasked with validating the incoming data by using a checksum to perform a parity check on each line of CSV data. An example line from the 3rd party CSV looks like…
njyunis
  • 261
  • 1
  • 3
  • 9
1
vote
2 answers

Parity checking in decimal

I want to use parity check function in a loop to make an event that happens every second times. But all the functions I found to watch parity don't work. Even the most simple ones, like this: unsigned int v; bool parity = false; while…
Zoltán Schmidt
  • 1,286
  • 2
  • 28
  • 48
1
vote
2 answers

Missing "126" on parity error

I have a COM port that I know receive invalid parity bits and I'm using the following program, however I never seem to get the trailing 126 byte that the documentation mentions. In the following program the console prints lots of !!!!! but no ?????,…
ronag
  • 49,529
  • 25
  • 126
  • 221
1
vote
2 answers

Do we add the parity bit to the front or the back of bit set

Do we add the parity bit to the front or the back of the bit set? A bit that acts as a check on a set of binary values, calculated in such a way that the number of 1s in the set plus the parity bit should always be even (or occasionally, should…
underscore
  • 6,495
  • 6
  • 39
  • 78
1
vote
4 answers

Strip parity bits in C from 8 bits of data followed by 1 parity bit

I have a buffer of bits with 8 bits of data followed by 1 parity bit. This pattern repeats itself. The buffer is currently stored as an array of octets. Example (p are parity bits): 0001 0001 p000 0100 0p00 0001 00p01 1100 ... should become 0001…
dubnde
  • 4,359
  • 9
  • 43
  • 63
1
vote
1 answer

Block Check Character (BCC) error burst detection

Disclaimer: Not homework! Problem I've been reading up on BCC error detection for my networks course and have got a bit confused over one particular explanation in some of the slides. Given Information We are provided the following explanation: …
Pete Hamilton
  • 7,730
  • 6
  • 33
  • 58
1
vote
1 answer

Generate Parity digit in php

I have a row of data which contains numbers and splits by '-', sth like this: 2012-421-020-120407 Now I want to generate a parity digit (0 or 1) at the end of this string in my php code. But I have no idea how to do it. Thanks in advance
Matt Stone
  • 291
  • 2
  • 4
  • 15
0
votes
3 answers

Repairing damaged bits using parity data

Here is a brainteaser! Let us say we have 64 bytes, each byte is eight bits plus one parity bit Let us say there is a further LRC check byte (formed by bit wise XOR ing all 64 bytes) So we can visualise this as a 8+1 by 64*1 grid If one bit is…
P i
  • 29,020
  • 36
  • 159
  • 267
0
votes
1 answer

How to determine whether the minimum number of adjacent swaps required for sorting is odd or even?

I don't know if bubble sort is optimal under the condition that only adjacent swaps are allowed? Is there a more optimal algorithm that can directly determine the parity of the minimum number of swaps without performing the actual sorting? Note that…
0
votes
1 answer

Given an array, check that the pattern of even then odd is upheld

I'm stumped on this problem: Given an array, check that every number switches from even to odd. All numbers in the array are positive integers. If there is a number that breaks the pattern, return the index of that number. If there aren't any…
codingsea
  • 3
  • 1
0
votes
0 answers

Why eflags register need a PF flag to record even or odd ones in the data?

I understand the purpose of the pf flag, which is to indicate whether there are an even or odd number of ones in the resulting data after certain instructions manipulate the register. However, It is certainly not just for programming tricks such as…