(Added sections for the 8-channel D6T-8L-09)
i n t
D 6 T _ g e t v a l u e ( )
{
I 2 C _ s t a r t ( ) ;
I 2 C _ s e n d ( 0 x 1 4 , 0 x 0 2 , 0 x 0 0 , 0 x 0 1 , 0 x E E ) ;
I 2 C _ s t o p ( ) ;
I 2 C _ s t a r t ( ) ;
I 2 c _ s e n d ( 0 x 1 4 , 0 x 0 5 , 0 x 9 0 , 0 x 3 A , 0 x B 8 ) ;
I 2 C _ s t o p ( ) ;
I 2 C _ s t a r t ( ) ;
I 2 c _ s e n d ( 0 x 1 4 , 0 x 0 3 , 0 x 0 0 , 0 x 0 3 , 0 x 8 B ) ;
I 2 C _ s t o p ( ) ;
I 2 C _ s t a r t ( ) ;
I 2 c _ s e n d ( 0 x 1 4 , 0 x 0 3 , 0 x 0 0 , 0 x 0 7 , 0 x 9 7 ) ;
I 2 C _ s t o p ( ) ;
I 2 C _ s t a r t ( ) ;
I 2 c _ s e n d ( 0 x 1 4 , 0 x 0 2 , 0 x 0 0 , 0 x 0 0 , 0 x E 9 ) ;
I 2 C _ s t o p ( ) ;
I 2 C _ s t a r t ( ) ;
I 2 C _ s e n d ( 0 x 1 4 , 0 x 0 2 ) ;
I 2 C _ r e p e a t s t a r t ( ) ;
I 2 C _ s e n d ( 0 x 1 5 ) ;
I 2 C _ g e t ( 0 x 1 5 , r e a d b u f f , 2 ) ; / / E x p e c t e d v a l u e o f 2 b y t e r e a d i s 0 x 0 0 a n d 0 x 0 0 .
I 2 C _ s t o p ( ) ;
I 2 C _ s t a r t ( ) ;
I 2 c _ s e n d ( 0 x 1 4 , 0 x 0 5 ) ;
I 2 C _ r e p e a t s t a r t ( ) ;
I 2 C _ s e n d ( 0 x 1 5 ) ;
I 2 C _ g e t ( 0 x 1 5 , r e a d b u f f , 2 ) ; / / E x p e c t e d v a l u e o f 2 b y t e r e a d i s 0 x 9 0 a n d 0 x 3 A .
I 2 C _ s t o p ( ) ;
I 2 C _ s t a r t ( ) ;
I 2 C _ s e n d ( 0 x 1 4 , 0 x 0 3 ) ;
I 2 C _ r e p e a t s t a r t ( ) ;
I 2 C _ s e n d ( 0 x 1 5 ) ;
I 2 C _ g e t ( 0 x 1 5 , r e a d b u f f , 2 ) ; / / E x p e c t e d v a l u e o f 2 b y t e r e a d i s 0 x 0 0 a n d 0 x 0 7 .
I 2 C _ s t o p ( ) ;
I 2 C _ s t a r t ( ) ;
I 2 C _ s e n d 1 ( 0 x 1 4 , 0 x 4 C ) ; / / 1 4 h = { 0 A h ( A d d r 7 ) : W r i t e ( 0 b ) }
I 2 C _ r e p e a t s t a r t ( ) ;
I 2 C _ g e t x ( 0 x 1 5 , r e a d b u f f , 1 9 ) ; / / 1 5 h = { 0 A h ( A d d r 7 ) : R e a d } , 1 9 = 2 * ( 1 + 8 ) + 1
I 2 C _ s t o p ( ) ;
I f ( ! D 6 T _ c h e c k P E C ( r e a d b u f f , 1 8 ) ) {
r e t u r n - 1 ; / / e r r o r
}
t P T A T = 2 5 6 * r e a d b u f f [ 1 ] + r e a d b u f f [ 0 ] ;
t P [ 0 ] = 2 5 6 * r e a d b u f f [ 3 ] + r e a d b u f f [ 2 ] ;
t P [ 1 ] = 2 5 6 * r e a d b u f f [ 5 ] + r e a d b u f f [ 4 ] ;
t P [ 2 ] = 2 5 6 * r e a d b u f f [ 7 ] + r e a d b u f f [ 6 ] ;
t P [ 3 ] = 2 5 6 * r e a d b u f f [ 9 ] + r e a d b u f f [ 8 ] ;
t P [ 4 ] = 2 5 6 * r e a d b u f f [ 1 1 ] + r e a d b u f f [ 1 0 ] ;
t P [ 5 ] = 2 5 6 * r e a d b u f f [ 1 3 ] + r e a d b u f f [ 1 2 ] ;
t P [ 6 ] = 2 5 6 * r e a d b u f f [ 1 5 ] + r e a d b u f f [ 1 4 ] ;
t P [ 7 ] = 2 5 6 * r e a d b u f f [ 1 7 ] + r e a d b u f f [ 1 6 ] ;
t P E C = r e a d b u f f [ 1 8 ] ;
r e t u r n 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.
D6T MEMS Thermal Sensors User's Manual (A284)
16