Electronic Components Datasheet Search |
|
AT42QT1111-MU Datasheet(PDF) 47 Page - ATMEL Corporation |
|
|
AT42QT1111-MU Datasheet(HTML) 47 Page - ATMEL Corporation |
47 / 50 page 47 9571A–AT42–02/10 AT42QT1111-MU/AT42QT1111-AU Appendix A. 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) { unsigned char index; unsigned char fb; index = 8; do { fb = (crc ^ data) & 0x01u; data >>= 1u; crc >>= 1u; if(fb) { crc ^= 0x8c; } } while(--index); return crc; } /* Example Calling Routine */ unsigned char calculate_config_checksum(void) { int i; unsigned char CRC_val = 0; unsigned char setup_data[42] = { 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 }; for(i = 0; i < sizeof(setup_data); i++) { CRC_val = calc_crc(CRC_val, setup_data[i]); } return(CRC_val); } |
Similar Part No. - AT42QT1111-MU |
|
Similar Description - AT42QT1111-MU |
|
|
Link URL |
Privacy Policy |
ALLDATASHEET.NET |
Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
Family Site : ic2ic.com |
icmetro.com |