(1) I have three sensors in series on the bench running for several days using a RaspberryPi and 9600 baud. On one occasion the first sensor came back with 0.1 C while the other two still read ambient around 22 C. This is after processing so I have no further details to add to the equation. They are all running in shutdown and here is my read temperature code. tDLY is only a couple of msec. i.e. 2 x character time
/****** read temperature TMP107s ******/
float readTemp(AA)
int AA ; /* device number */
{
int iTemp ;
float rTemp ;
fprintf(stdout, "\n3: ") ;
serialPutchar (ftmp, cCAL) ; /* calibration byte for write Oneshot */
delay(tDLY);
serialPutchar (ftmp, (AA << 3)) ; /* address device */
delay(tDLY);
serialPutchar (ftmp, 0xA0 + cCONFIG) ; /* temp register */
delay(tDLY);
serialPutchar (ftmp, (cSHUTDOWN + cONESHOT) & 0xFF ) ;/* LSB Oneshot */
delay(tDLY);
serialPutchar (ftmp, ((cSHUTDOWN + cONESHOT) >> 8) & 0xFF) ;/* MSB Shutdown */
serialFlush(ftmp) ;
delay(tDLY) ;
readByte(5) ; /* read expected bytes */
printByte(5) ;
delay(22) ; /**** delay 22 msec ****/
serialPutchar (ftmp, cCAL) ; /* calibration byte for read temp */
delay(tDLY);
serialPutchar (ftmp, cREAD + (AA << 3)) ; /* read device */
delay(tDLY);
serialPutchar (ftmp, 0xA0 + cTEMP) ; /* temp register */
serialFlush(ftmp) ;
delay(22) ; /**** msec ****/
readByte(5) ;
printByte(5) ;
iTemp = (rByte[3] >> 2) + (rByte[4] << 6); /* 20170210 decode temp */
if (iTemp & 0x2000) /* -ve sign set */
{
iTemp = ~iTemp & 0x3FFF ; /* ones complement, zero upper bits */
iTemp = iTemp ^ -1 ; /* exclusive OR with -1 */
}
rTemp = iTemp * tLSB ; /* scale to LSB */
fLog = 1;
return rTemp ; /* degrees C */
I have a 22 msec delays between sending the Oneshot command requesting data and reading the data whixh I'm hoping is sufficient and just wonder whether it's worth throwing out a 0xFF or some such as a wakeup call before the 0x55 hits the wires?
(2) I have assumed that I have to transmit both OS and SD to trigger a one-shot and still leave the device in Shutdown mode. Is this true?
(3) The TMP107 data sheet says OS bit always reads zero (Table 5) yet I appear to be receiving 0x1800 in response to reading the configuration with the following code:
/****** read configuration TMP107s ******/
int readConfig(AA)
int AA ; /* device number */
{
fprintf(stdout, "\n4: ") ;
serialPutchar (ftmp, cCAL) ;
delay(tDLY);
serialPutchar (ftmp, cREAD + (AA << 3)) ; /* device */
delay(tDLY);
serialPutchar (ftmp, 0xA0 + cCONFIG) ; /* configuration register */
serialFlush(ftmp) ;
delay(22) ; /* msec */
readByte(5) ; /* read expected data */
printByte(5) ;
return (rByte[3] & 0xFF) + (rByte[4] << 8) ; /* config */
}
(4) For your interest, my 'lab' stores didn't contain a suitable TxD interface buffer so I used a 4N37 optocoupler. I'm only running 9600 baud but even than I had to ground the transistor base through 100K to improve the signal edge times.
David Whiteley