EasyManuals Logo

Omron D6T Series User Manual

Omron D6T Series
24 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #18 background imageLoading...
Page #18 background image
17 D6T MEMS Thermal Sensors User’s Manual (A284)
6.5 Example PEC Check Routine
PEC represents CRC-8 error check data. This data is appended to the end of communication
output. The user can use the PEC value to detect communication errors and improve data
reliability.
(Refer to SMBus specifications for more information)
unsigned char calc_crc( unsigned char data )
{
int index;
unsigned char temp;
for(index=0;index<8;index++){
temp = data;
data <<= 1;
if(temp & 0x80) data ^= 0x07;
}
return data;
}
int D6T_checkPEC( char buf , int pPEC );
{
unsigned char crc;
int i;
crc = calc_crc( 0x14 );
crc = calc_crc( 0x4C ^ crc );
crc = calc_crc( 0x15 ^ crc );
for(i=0;i<pPEC;i++){
crc = calc_crc( readbuff[i] ^ crc );
}
return (crc == readbuff[pPEC]);
}
Only the PEC read command is executed when using Stop-Start reads without the use of
RepeatStart.
int D6T_checkPEC( char buf , int pPEC );
{
unsigned char crc;
int i;
crc = calc_crc( 0x15 );
for(i=0;i<pPEC;i++){
crc = calc_crc( readbuff[i] ^ crc );
}
return (crc == readbuff[pPEC]);
}

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Omron D6T Series and is the answer not in the manual?

Omron D6T Series Specifications

General IconGeneral
BrandOmron
ModelD6T Series
CategoryAccessories
LanguageEnglish

Related product manuals