TSEV01S01C05
SENSOR SOLUTIONS ///TSEV01S01C05 9/2015
SAMPLE CODE
Sample Code for sending 8 bits and reading 8 bits while sending 8 clocks.
// Setting directions
TRISC4 = 1; // SDI = Input
TRISC5 = 0; // SDO = Output
TRISC3 = 0; // SCL = Output
// Reset SPI Lines
RC5 = 0; // SDO
RC3 = 0; // SCL
for (c = 0; c < 8; c++)
{
cReceive = cReceive << 1; // Shift Receive Register
RC3 = 0; // SCL = 0
RC5 = (cTransmit >> (7 - c)); // Outupt next Bit on SDO
RC3 = 1; // SCL = 1
cReceive = cReceive | RC4; // Input next Bit on SDI
}
RC3 = 0;
RC5 = 0;
return cReceive;
AMBIENT AND OBJECT TEMPERATUREMEASUREMENT
Please refer following table for SPI commands to read object temperature and ambient
temperature. Both values are transmitted in hundredth of degrees.
Sensor temperature in hundredth of degrees Celsius
Object temperature in hundredth of degrees Celsius
SEQUENCE OF TRANSMISSION
Enable SCE (SCE=0) before transmission of “Command”. Release SCE (SCE=1) after reading
last byte.
Command (0xA0 or 0xA1)
???
0x00
Temperature High Byte
0x00
Temperature Low Byte
MASTER
Sensor
First Transmission
8 Clocks
8 Bits Write
8 Bits Read
Second Transmission
8 Clocks
8 Bits Write
8 Bits Read
Third Transmission
8 Clocks
8 Bits Write
8 Bits Read
8 bits
8 bits
8 bits
8 bits
8 bits
8 bits