crc-8 dow table generation problem

Sep 04, 2006 4 Replies

Hi to all, I have a problem with crc-8 dow algoritmic. x^8+x^5+x^4+1 CRC_DOW



The problem is: I want implement the fast calculation but My CRC_table is different from the CRC_DOWN table reported in the web



description: looking at the web I've founf the CRC table to calculate CRC_DOW (below an extract ... 0-15)



CRC_DOWN right table (decimal format):



0, 94, 188, 226, 97, 63, 221, 131, 194, 156, 126, 32, 163, 253, 31,
65, ................

My WRONG table is (decimal format):



0, 49, 98, 83, 196, 245 .........


In order to generate the CRC table I use the code below:


#define CRC8_POLYNOMIAL 0x131 // x^8+x^5+x^4+1 0001 0011 0001 CRC_DOW int i, j; unsigned int crc8; for(i = 0 ; i < 256; i++){ crc8 = i; for(j = 8; j > 0; j--){ if(crc8 & 0x80){ crc8 = (crc8


===SNIP===

Yes, try the other way around:

#include

#define POLY 0x8C

void main(void) { int index; int i; unsigned x; unsigned temp;

for (index = 0; index < 256; ++index) { temp = index;

for (i = 0; i < 8; ++i) { x = temp & 1; temp >>= 1;

if (x != 0) temp ^= POLY; }

printf("0x%02X, ", temp); if ((index & 7) == 7) putchar('\n'); } }

Dan Henry

thanks for your support Dan

Dan Henry ha scritto:

Please, ignore the "void main" stuff if you can. The important part is the POLY and inner "for" loop.

Dan Henry

...

Maybe this list of crc code can help:

formatting link

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required