| 数据搜索系统,热门电子元器件搜索 |
|
M24LR64-R-DW6T/2 数据表(PDF) 122 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
M24LR64-R-DW6T/2 数据表(HTML) 122 Page - STMicroelectronics |
|
122 / 126 page ![]() CRC (informative) M24LR64-R 122/126 Doc ID 15170 Rev 8 Appendix B CRC (informative) B.1 CRC error detection method The cyclic redundancy check (CRC) is calculated on all data contained in a message, from the start of the flags through to the end of Data. The CRC is used from VCD to M24LR64-R and from M24LR64-R to VCD. To add extra protection against shifting errors, a further transformation on the calculated CRC is made. The One’s Complement of the calculated CRC is the value attached to the message for transmission. To check received messages the 2 CRC bytes are often also included in the re-calculation, for ease of use. In this case, the expected value for the generated CRC is the residue F0B8h. B.2 CRC calculation example This example in C language illustrates one method of calculating the CRC on a given set of bytes comprising a message. C-example to calculate or check the CRC16 according to ISO/IEC 13239 #define POLYNOMIAL0x8408// x^16 + x^12 + x^5 + 1 #define PRESET_VALUE0xFFFF #define CHECK_VALUE0xF0B8 #define NUMBER_OF_BYTES4// Example: 4 data bytes #define CALC_CRC1 #define CHECK_CRC0 void main() { unsigned int current_crc_value; unsigned char array_of_databytes[NUMBER_OF_BYTES + 2] = {1, 2, 3, 4, 0x91, 0x39}; int number_of_databytes = NUMBER_OF_BYTES; int calculate_or_check_crc; int i, j; calculate_or_check_crc = CALC_CRC; // calculate_or_check_crc = CHECK_CRC;// This could be an other example if (calculate_or_check_crc == CALC_CRC) { Table 112. CRC definition CRC definition CRC type Length Polynomial Direction Preset Residue ISO/IEC 13239 16 bits X16 + X12 + X5 + 1 = 8408h Backward FFFFh F0B8h |
|
链接网址 |
| 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 |