JCL Help:CheckCrc16@TCrc16Table@array of Byte@Integer@Word

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Checks and, if possible, corrects the data protected by a 16 bit CRC.


Pascal

 function CheckCrc16_P(X: PJclByteArray; N: Integer; Crc: Word): Integer; overload;
function CheckCrc16(var X: array of Byte; N: Integer; Crc: Word): Integer; overload;
function CheckCrc16(const Crc16Table: TCrc16Table; var X: array of Byte; N: Integer; Crc: Word): Integer; overload;
function CheckCrc16_A(const Crc16Table: TCrc16Table; var X: array of Byte; Crc: Word): Integer; overload;


Parameters

Parameters Description
X: PJclByteArray The array which contains the data. With CheckCrc16 and CheckCrc16_A this is an open array parameter, with CheckCrC16_P this is a pointer to the first byte of the array of bytes.
N: Integer The number of elements in X. CheckCrc16_A uses all bytes in the array X.
Crc: Word Transmitted CRC value to check the data against.


Return Value

  • 0 No CRC error.
  • 1 Correctable error. If the false bit was in the data, it has been corrected.
  • -1 Uncorrectable error (more than one false bit).


Description

Checks and, if possible, corrects the data protected by the same 16 bit CRC the function Crc16 uses. With a 16 bit CRC a single bit error in 2^15-16 bit (2^12-2 = 4094 byte) of data can be corrected. Beware that when trying to correct an error in a greater array of bytes, you will not get an error indicator but an unwanted bit might be changed. In arrays small enough, multiple bit errors are not corrected, but by far most multiple bit errors are detected (see CRC16).


See Also

Crc16 InitCrc16 CheckCrc32


About

Unit

JclMath


Donator

Michael Schnell


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page