| 数据搜索系统,热门电子元器件搜索 |
|
SCD40-D-R1 数据表(PDF) 18 Page - Sensirion AG Switzerland |
|
|
|||||||||||||||||||||||||||||
SCD40-D-R1 数据表(HTML) 18 Page - Sensirion AG Switzerland |
|
18 / 22 page ![]() www.sensirion.com Version 1.1 – April 2021 18/22 3.11 Checksum Calculation The 8-bit CRC checksum transmitted after each data word is generated by a CRC algorithm. Its properties are displayed in Table 30. The CRC covers the contents of the two previously transmitted data bytes. To calculate the checksum only these two previously transmitted data bytes are used. Note that command words are not followed by CRC. Property Value Example code (C/C++) Name CRC-8 #define CRC8_POLYNOMIAL 0x31 #define CRC8_INIT 0xFF uint8_t sensirion_common_generate_crc(const uint8_t* data, uint16_t count) { uint16_t current_byte; uint8_t crc = CRC8_INIT; uint8_t crc_bit; /* calculates 8-Bit checksum with given polynomial */ for (current_byte = 0; current_byte < count; ++current_byte) { crc ^= (data[current_byte]); for (crc_bit = 8; crc_bit > 0; --crc_bit) { if (crc & 0x80) crc = (crc << 1) ^ CRC8_POLYNOMIAL; else crc = (crc << 1); } } return crc; } Width 8 bit Protected Data read and/or write data Polynomial 0x31 (x8 + x5 + x4 + 1) Initialization 0xFF Reflect input False Reflect output False Final XOR 0x00 Examples CRC (0xBEEF) = 0x92 Table 30 I2C CRC properties. |
|
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 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 |