AT42QT1111MU ATMEL [ATMEL Corporation], AT42QT1111MU Datasheet - Page 47

no-image

AT42QT1111MU

Manufacturer Part Number
AT42QT1111MU
Description
Manufacturer
ATMEL [ATMEL Corporation]
Datasheet
Appendix A.
9571A–AT42–02/10
CRC Calculation
If the use of a cyclic redundancy check (CRC) during data transmission is enabled, the host
must generate a valid CRC so that this can be correctly compared to the corresponding CRC
generated by the QT1111. This appendix gives example C code to show how the CRC can be
generated by the host.
/*=======================================================================
unsigned char calc_crc(unsigned char crc, unsigned char data)
---------------------------------------------------------------------------
Purpose: Calculate CRC for data packets
Input : CRC, Data
Output : Updated CRC
Notes : -
=========================================================================*/
unsigned char calc_crc(unsigned char crc, unsigned char data)
{
return crc;
}
/* Example Calling Routine */
unsigned char calculate_config_checksum(void)
{
}
unsigned char index;
unsigned char fb;
index = 8;
do
{
} while(--index);
int i;
unsigned char CRC_val = 0;
unsigned char setup_data[42] =
{
};
{
}
return(CRC_val);
for(i = 0; i < sizeof(setup_data); i++)
fb = (crc ^ data) & 0x01u;
data >>= 1u;
crc >>= 1u;
if(fb)
{
}
0xB2, 0x00, 0x38, 0x12, 0x06, 0x06, 0x12, 0x07, 0xFF, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x32, 0xFF, 0x00, 0x29,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0X00, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A,
0x7A, 0x7A
CRC_val = calc_crc(CRC_val, setup_data[i]);
crc ^= 0x8c;
AT42QT1111-MU/AT42QT1111-AU
47

Related parts for AT42QT1111MU