kindly tell me any efficient code for generating CRC for 40 bytes data I am using the modulo 2 division method.
with thanks, karthik.
Any particular CRC? CRC8, CRC16, CRC32. Any specific polynomial? Size efficient? or Speed efficient? Tables are faster and bigger. Full calculations the slowest. ASM would speed that up a little.
Any pre- and/or post-conditioning?
Small table or medium table or large table?
i am using CRC16(modulo2).But table method how to implement it..In net I have seen table they have created for 256 bytes.But my internal memory size is 256...
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.
That's not (necessarily) true.
The truth is that a skilled and experienced assembler programmer could probably speed it up a little.
In inexperiences and/or unskilled hands, assembler may well be worse than 'C'!
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