AnsweredAssumed Answered

ADT7310: Continuous Read?

Question asked by bugserm on Feb 6, 2012
Latest reply on Feb 9, 2012 by FEB



I want to read the Temperature Register continuously (continuous mode). Below is my code.

The problem is, sometimes i get 0.00000°C because ADT7310 is not finish converting yet.

I even add a delay for 240ms after sending 2 dummy bytes but i still get 0.00000°C sometimes.

I manage to solve this by checking the flag RDY status Register, but i need to resend Command Byte before sending 2 Dummy Bytes.

It is possible to send Command Byte ONLY once, then keep repeating sending 2 dummy bytes to get temperature reading as described in the datasheet?



unsigned int ADT7310_read_Tvalue_continuous(void) {


          unsigned int uiMSB_Traw;

          unsigned int uiLSB_Traw;

          unsigned int uiTraw;


          SPI_MasterTransmit(0x54);           // send CMD BYTE to read Tvalue register continuously


          uiMSB_Traw=( SPI_MasterTransmit(0x00) );   // send dummy byte 0x00 via SPI

                                                                              //  to receive MSByte of Tvalue

          uiMSB_Traw= uiMSB_Traw<<8 ;           //move 8bits Traw to the left =>MSB_Traw


           uiLSB_Traw=( SPI_MasterTransmit(0x00) );    // send dummy byte 0x00 via SPI

                                                                     // to receive LSByte of Tvalue

           uiTraw= uiMSB_Traw | uiLSB_Traw;      // combine MSB & LSB of Traw


           return uiTraw;

} // end of ADT7310_read_Tvalue_continuous