kit_714
Member level 4
crc calculation explanation
Hi all,
i am currently studying the principle of CRC-8 since i am handling the temperature sensor from Maxim (DS18S20).
Can anyone kindly explain the principle of this checking system?
The polynomial of CRC is x^8 + x^5 + x^4 + 1
and also, i found a source code about generating CRC-8 as follows:
BYTE by_ACRC8 ( BYTE byIn , BYTE bycrc)
{
BYTE i ;
for ( i = 0 , i < 8 , i++)
{
if ( ( byIn & 1) ^ ( bycrc & 0x 80 ) == 0 )
{
bycrc <<= 1 ;
}
else
{
bycrc = bycrc ^0x 18 ;
bycrc <<=1 ;
bycrc | = 1 ;
}
bycrc >>= 1 ;
}
return bycrc ;
}
2 questions for the coding...
1. bycrc = bycrc ^0x 18 .....what;s the operation for this line of coding?
2. Can anyone briefly explain the coding with CRC-8 operation principles?
Thanks in advanced.
Kit
Hi all,
i am currently studying the principle of CRC-8 since i am handling the temperature sensor from Maxim (DS18S20).
Can anyone kindly explain the principle of this checking system?
The polynomial of CRC is x^8 + x^5 + x^4 + 1
and also, i found a source code about generating CRC-8 as follows:
BYTE by_ACRC8 ( BYTE byIn , BYTE bycrc)
{
BYTE i ;
for ( i = 0 , i < 8 , i++)
{
if ( ( byIn & 1) ^ ( bycrc & 0x 80 ) == 0 )
{
bycrc <<= 1 ;
}
else
{
bycrc = bycrc ^0x 18 ;
bycrc <<=1 ;
bycrc | = 1 ;
}
bycrc >>= 1 ;
}
return bycrc ;
}
2 questions for the coding...
1. bycrc = bycrc ^0x 18 .....what;s the operation for this line of coding?
2. Can anyone briefly explain the coding with CRC-8 operation principles?
Thanks in advanced.
Kit