
TLE5012B
Interfaces
User’s Manual
42
Rev. 1.2, 2018-02
unsigned char ReducedPoly;
unsigned int message;
unsigned char crc;
unsigned bitindex;
//Only 8 bits are taken
ReducedPoly = (unsigned char)(polynomial&0x00FF);
//For all the possible “message” combinations
for (message=0; message <= 0xFF; +)
{
crc=(unsigned char)message;
//For all the bits of the byte.
for(Bitindex=0; Bitindex<8; B+)
{
//Calculation of the CRC
if((crc&0x80)!=0)
{
crc <<= 1;
crc ^= ReducedPoly;
}
else
crc <<=1;
}
//The value out of the CRC calculation for a certain “message” is saved in the
//position of the “message”.
*(cmessage) = crc;
}
}
Disclaimer
The CRC generation software code provided above shall be used as guidance to the developer of solutions with
the TLE5012B. Infineon is not responsible for malfunctioning of the code provided above. This code was used with
an Infineon's microcontroller XC878.
•
The CRC generation software code is only provided as a hint for the implementation or the use of the Infineon
Technologies components and shall not be regarded as any description or warrant of a certain functionalities,
conditions or quality of the Infineon Technologies component(s).
•
All statements contained in this code, including recommendation or suggestion or methodology, are to be
verified by the user before implementation or use, as operating conditions and environmental factors may
differ. The recipient of this code must verify any function described herein in the real application.
•
Infineon Technologies hereby disclaims any and all warranties and liabilities of any kint (including without
limitation warranties of non-infringement of intellectual property rights of any third party) with respect to any
and all code given in this document.