kindly tell me any efficient code for generating CRC for 40 bytes data I am using the modulo 2 division method.
with thanks, karthik.
But the table contain constants, so you can prebuild it and store in the code space.
finally i am using this code....
int Calc_CRC(unsigned char b[], unsigned int CRC,int nBytes) { bit carry; int i,j; for(j=0;j<nBytes;j++) { carry=0; CRC ^= b[j] & 0xFF; for (i=0; i<8; i++) { carry = CRC & 0x0001; CRC>>=1; if (carry) { CRC ^= GP; } } } return CRC; }
How to store the table code space I am new to embedded...kindly help me......
How to store the table code space Please read the manual
I am new to embedded then the first thing you should do is to work through (I did not say 'read') the Getting started Guide.
Erik
"finally i am using this code...."
That code doesn't use a table.
"How to store the table ..."
What table? The code you posted calculates the CRC one bit at a time and does not use or need a table.
He said he's seen methods that use tables...
"He said he's seen methods that use tables..."
I am referring to the code he said he is using, not the code he's seen.
But I think his question about tables was referring to the code he's seen - and wondering how to implement it on his target?
"But I think his question ..."
I think that some means of viewing thread chaining/hierarchy would be high on most people's list of forum enhancements.
Take your code write a PC program that creates a table. Then copy that to your project.
I am assuming you need faster code. How much faster?
An improvement right here
int i,j; // signed 16 bit variable
40 byte and 8 bits
try unsigned char