| ??? 10/16/02 17:10 Read: times |
#30902 - RE: Is It Wise? |
Dave.
You are incorrect. CRCs are not good at data recovery. Only good for pass / fail detection. And the reliability of their ability to detect an error is related to the length of the non-repeating series in the polynomial calculation. For data recovery you actually need something like Hamming Codes or Reed Solomon codes. A reliable Hamming code of 4 bits added to a byte will assure single bit error detection. A 5 bit hamming code added to a byte will assure ability to correct a bad bit. In my ideas for validating a small data set it is most important that the number of combinations available in the stored code be relatively large compared to the number of elements that it is computed across. No scheme like this is perfect and errors in the data set can look good under certain conditions. And as such please do not use this type scheme where lives are at stake. And no I am not talking about using check sum. I have an algoritnm that works better than a checksum becasue it is calculated similar to a CRC. Here is a code snippet for a function to compute the type of check code I am talking about.
;===============
;
; CHECK_CALC
;
; Routine to compute a running check byte value from a string
; of data. This computes the check value from the string
; addressed at the R0 memory pointer for the count of bytes
; specified in the entry R1 register. The resulting check
; byte value is returned in the A register. This simple
; check routine XOR's the new byte with the running value
; and then rotates the result left by one bit and then adds
; one with the rotated carry ignoring the resulting carry.
;
; Entry:
; R0 = Pointer to memory data to compute
; R1 = Count of bytes to compute.
; Exit:
; A = Computed CHECK value.
; R0 & R1 are modified
; Uses:
; B But value is saved
;
CHECK_CALC:
PUSH B ;save this becasue we use it
MOV B, #0 ;init the check value
CHECK_LP:
MOV A, @R0 ;fetch a byte
XRL A, B ;XOR the values
CLR C ;make sure carry is clear
RLC A ;rotate left
ADDC A, #1 ;add 1 plus carry back in
MOV B, A ;update running value
INC R0 ;bump buffer pointer
DJNZ R1, CHECK_LP ;loop till all bytes complete
MOV A, B ;align return value
POP B ;restore reg we used
RET
Hope this helps. Mike |
| Topic | Author | Date |
| Is It Wise? | 01/01/70 00:00 | |
| RE: Is It Wise? | 01/01/70 00:00 | |
| RE: Is It Wise? | 01/01/70 00:00 | |
| RE: Is It Wise? | 01/01/70 00:00 | |
| RE: Is It Wise? | 01/01/70 00:00 | |
| RE: Is It Wise? | 01/01/70 00:00 | |
| RE: Is It Wise? | 01/01/70 00:00 | |
| RE: Is It Wise? | 01/01/70 00:00 | |
| RE: Is It Wise? | 01/01/70 00:00 | |
| RE: Is It Wise? | 01/01/70 00:00 | |
| RE: Is It Wise? | 01/01/70 00:00 | |
| RE: Is It Wise? | 01/01/70 00:00 | |
| RE: Is It Wise? | 01/01/70 00:00 | |
| RE: Is It Wise? | 01/01/70 00:00 | |
| RE: Is It Wise? | 01/01/70 00:00 | |
| RE: Is It Wise? | 01/01/70 00:00 | |
| RE: Is It Wise? | 01/01/70 00:00 | |
| supposed Einstein quote related to above | 01/01/70 00:00 | |
RE: Is It Wise? | 01/01/70 00:00 |



