How to get number of parity bits for given number of string length
9 次查看(过去 30 天)
显示 更早的评论
Hello,
Number of parity bits for a given number of string length?
Suppose I am giving '7' as number of string length, the i am looking for
any one can help
thanks
2 个评论
Jan
2019-1-22
Does "number of string length" mean "string length"?
You can define as many parity bits as you want. So it depends on the protocol how many are used.
回答(1 个)
Walter Roberson
2019-1-23
"parity bit" is a family of techniques, not one particular technique.
A parity bit calculation involves the bitwise exclusive "or" of a number of positions in the data, and the parity bit is then set so that when it is included in the calculation, the end result is either 1 ("odd parity") or 0 ("even parity"). But where the parity bits are placed relative to the other bits is up to the implementation, and which bits are taken together to form a particular parity bit is up to the installation, including the possibility that some inputs bits might contribut to multiple output bits.
For example it would be a valid scheme to say that odd parity is to be calculated for the first 9 bits, and even parity is to be calculated for the next 5 bits, and then odd parity is to be calculated on bits 1:2:19 and then even parity is to be calculated on bits 2:2:20 and then those 4 parity bits are to be placed after the 20 input bits to form a 24 bit system in which bits 1:14 contribute to two different parity bits but bits 15:20 contribute to only 1 parity bit.
We therefore cannot answer the question of how many parity bits should be used for a given string length: it depends on what parity pattern you are using.
Historically it has not been uncommon for packet-oriented protocols to have either one octet (8 bits) or one nibble (4 bits) of parity per packet.
Parity is typically only used for basic sanity checks, not for any serious purpose. There are other techniques that work much better for error detection and error correction.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!