CalcCCIT16
(FUN)
FUNCTION CalcCCIT16
This function generates a 16 bit CRC for numeric values with “udiByteSize” number of bytes and start address “pbyData”. The function does an automatic swapping for Big Endian systems. “wCRC” is the starting seed value and contains the calculated CRC after calling this function. The CRC generator polynom is: x^16 + x^12 + x^5 + 1 (=CCIT16) For best performance we use a table driven algorithm which uses a constant table containing 256 words (= 512 Byte). IMPORTANT NOTES:
DO NOT USE THIS FUNCTIONS FOR ARRAYS OR STRUCTS. THIS FUNCTION IS ONLY INTENDED FOR NUMERIC VALUES.
2) BEFORE USING THIS FUNCTION IODRVUPDATECONFIGURATION MUST BE CALLED, OR AT LEAST THE GLOBAL VARIABLE g_bSYSTEM_HAS_INTEL_BYTEORDER HAS TO BE SET PROPERLY!
- InOut:
Scope
Name
Type
Comment
Input
pbyData
POINTER TO BYTE
Pointer to numeric data (no structs or arrays!)
udiByteSize
UDINT
number of bytes
Inout
wCRC
WORD
calculated CRC