| Electronic Components Datasheet Search |
|
ENS210 Datasheet(PDF) 19 Page - ams AG |
|
|
|||||||||||||||||||||||||||||
ENS210 Datasheet(HTML) 19 Page - ams AG |
|
19 / 43 page ![]() ams Datasheet Page 19 [v1-02] 2018-Feb-19 Document Feedback ENS210 − Functional Description Computing CRC-7 CRC algorithm uses a 7 bit polynomial (see lines 4, 5, and 6), and a 17 bit payload. The crc7() function below uses the following constants defining the CRC width, (the coefficients of the) polynomial and the initial vector (start value of the CRC), and some constants describing the payload data size. // 7654 3210 // Polynomial 0b 1000 1001 ~ x^7+x^3+x^0 // 0x 8 9 #define CRC7WIDTH 7 // 7 bits CRC has polynomial of 7th order (has 8 terms) #define CRC7POLY 0x89 // The 8 coefficients of the polynomial #define CRC7IVEC 0x7F // Initial vector has all 7 bits high // Payload data #define DATA7WIDTH 17 #define DATA7MASK ((1UL<<DATA7WIDTH)-1) // 0b 0 1111 1111 1111 1111 #define DATA7MSB (1UL<<(DATA7WIDTH-1)) // 0b 1 0000 0000 0000 0000 The crc7(val) function returns the CRC-7 of a 17 bits value val. // Compute the CRC-7 of 'val' (should only have 17 bits) uint32_t crc7( uint32_t val ) { // Setup polynomial uint32_t pol= CRC7POLY; // Align polynomial with data pol = pol << (DATA7WIDTH-CRC7WIDTH-1); // Loop variable (indicates which bit to test, start with highest) uint32_t bit = DATA7MSB; // Make room for CRC value val = val << CRC7WIDTH; bit = bit << CRC7WIDTH; pol = pol << CRC7WIDTH; // Insert initial vector val |= CRC7IVEC; // Apply division until all bits done while( bit & (DATA7MASK<<CRC7WIDTH) ) { if( bit & val ) val ^= pol; bit >>= 1; pol >>= 1; } return val; } |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | 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 |