// **************************
// * CRC 8 bestimmen *
// **************************
void DoCRC8(unsigned char * ucIn, unsigned int * uicrc)
{
const unsigned int CRC_LOOK_UP[16]={0x00,0x1d,0x3a,0x27,0x74,0x69,0x4e,0x53,
0xe8,0xf5,0xd2,0xcf,0x9c,0x81,0xa6,0xbb};
unsigned int uiNibble1,uiNibble2;
uiNibble1=*ucIn&0x0f; // unteres Nibble Datum speichern
uiNibble2=(*uicrc>>4); // oberes Nibble CRC speichern
*uicrc=((*uicrc<<4|uiNibble1)&0xff)^CRC_LOOK_UP[uiNibble2];
uiNibble1=(*ucIn>>4)&0x0f;
uiNibble2=(*uicrc>>4); // oberes Nibble CRC speichern
*uicrc=((*uicrc<<4|uiNibble1)&0xff)^CRC_LOOK_UP[uiNibble2];
}
|