Specifications

FL-MDS-CAB.2
MOD-MDS.1 ***Confidential*** 26 of 28
used as follows:
uint8_t payload[6];
crcReset();
for (i=0; i<5; i++)
crcGenByte(payload[i]); // to be compared to B10 == payload[5]
8.2 CRC2 computation
CRC2 computing is implemented by the crc2() C function.
/*! @brief Compute CRC2
* @param pload The payload array
* @param start The index of the first byte on which the CRC2 is computed
* @param stop The index of the last byte on which the CRC2 is computed
* @return The CRC2 value
*/
uint8_t crc2(uint8_t *pload, int start, int stop)
{
uint8_t crc = 0x84;
uint8_t bMask;
int i;
for (i = start; i <= stop; i++) {
bMask = crc >> 1;
if (crc % 2) {
bMask = bMask | 0x80;
}
crc = pload[i] ^ bMask;
}
return crc;
}