EasyManua.ls Logo

Omron D6T Series - PEC Error Checking Routine; CRC Calculation Function; PEC Check for Specific I2 C Reads

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
Loading...
D6T MEMS Thermal Sensors User’s Manual (A284) 16
(Added sections for the 8-channel D6T-8L-09)
int D6T_getvalue()
{
I2C_start();
I2C_send( 0x14 , 0x02 , 0x00 , 0x01 , 0xEE );
I2C_stop();
I2C_start();
I2c_send ( 0x14 , 0x05 , 0x90 , 0x3A , 0xB8 ) ;
I2C_stop();
I2C_start();
I2c_send ( 0x14 , 0x03 , 0x00 , 0x03 , 0x8B ) ;
I2C_stop();
I2C_start();
I2c_send ( 0x14 , 0x03 , 0x00 , 0x07 , 0x97 ) ;
I2C_stop();
I2C_start();
I2c_send ( 0x14 , 0x02 , 0x00 , 0x00 , 0xE9 ) ;
I2C_stop();
I2C_start();
I2C_send( 0x14 , 0x02 );
I2C_repeatstart();
I2C_send( 0x15 );
I2C_get( 0x15 , readbuff , 2 ); // Expected value of 2 byte read is 0x00 and 0x00.
I2C_stop();
I2C_start();
I2c_send( 0x14 , 0x05 );
I2C_repeatstart();
I2C_send( 0x15 );
I2C_get( 0x15 , readbuff , 2 ); // Expected value of 2 byte read is 0x90 and 0x3A.
I2C_stop();
I2C_start();
I2C_send( 0x14 , 0x03 );
I2C_repeatstart();
I2C_send( 0x15 );
I2C_get( 0x15 , readbuff , 2); // Expected value of 2 byte read is 0x00 and 0x07.
I2C_stop();
I2C_start();
I2C_send1( 0x14 , 0x4C ); // 14h = { 0Ah(Addr7) : Write(0b) }
I2C_repeatstart();
I2C_getx( 0x15 , readbuff , 19 ); // 15h = { 0Ah(Addr7):Read },19 = 2*(1+8)+1
I2C_stop();
If(!D6T_checkPEC(readbuff,18)){
return - 1; // error
}
tPTAT = 256*readbuff[1] + readbuff[0];
tP[0] = 256*readbuff[3] + readbuff[2];
tP[1] = 256*readbuff[5] + readbuff[4];
tP[2] = 256*readbuff[7] + readbuff[6];
tP[3] = 256*readbuff[9] + readbuff[8];
tP[4] = 256*readbuff[11] + readbuff[10];
tP[5] = 256*readbuff[13] + readbuff[12];
tP[6] = 256*readbuff[15] + readbuff[14];
tP[7] = 256*readbuff[17] + readbuff[16];
tPEC = readbuff[18];
return 1;
}
* With this example temperature program, only one set of measurements are retrieved.
* In the case of standard specifications, this sensor updates temperature data every 250 ms
or less. This operation is independent of any communication processing. Temperature
update timing cannot be controlled externally.

Related product manuals