|
#1
|
|||
|
|||
|
Can any one tell me how in C to calculate the LRC for a string of data? The data will contain 100 or so characters that was passed to the C program with the last character bing a ETX. After the LCR is calculated I will place STX at the beginning and the LCR at the end and send via SSL.
Thanks Don |
|
#2
|
|||
|
|||
|
Blurbs from the web:
The longitudinal parity byte is created by placing individual bytes of a string in a two-dimensional array and performing a Vertical Redundancy Check vertically and horizontally on the array, creating an extra byte. This is an improvement over the VRC because it will catch an odd number of errors in the individual characters of the string. the vertical one: The resulting parity bit is constructed by XORing the word. The result is a "1" if there is an odd number of 1s, and a "0" if there is an even number of 1s in the word. This method is unreliable because if an odd number of bits are distorted, the check will not detect the error. The Longitudinal Redundancy Check is an improvement. from: http://wwwacs.gantep.edu.tr/foldoc/f...dundancy+Check C and C++ do not have this built in, you may be able to find a lib for free. It looks simple enough to code if not. |
|
#3
|
|||
|
|||
|
Thanks for the reply. I have scanned the web and have yet to find enough details to know how to code this. I will keep looking as my skill set is not string enough to code this from scratch.
Don |
|
#4
|
|||
|
|||
|
I have no idea of the value of this:
http://www.linuxquestions.org/questi...003/08/4/25543 //from a forum char GetLrcChar(char *data, int len) { int i; char tmp = data[0]; for(i = 1; i < len; i++) tmp = tmp^data[i]; return tmp; } ... method posted is sufficient //a comment about the code -- J |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|