AnsweredAssumed Answered

ADT7310 occasional dropped data

Question asked by kjlarkin on Feb 16, 2013
Latest reply on Feb 17, 2013 by kjlarkin

Hello,

 

I am working on a continuous read with the ADT7310, and i have it reporting back correct temperatures for the most part.  However,  every once in a while (there is no set number of times, it seems random) the temp sensor will send me back a number like 114 (other small numbers as well) as opposed to the more regular values in the range of 2490 (or 2690, depending on how warm the area surrounding my workstation is).

 

I was wondering why i was getting these anomalies and if there is any solution?

 

Here is my current code to read a value and where i get the values:

 

    while(SPI2STATbits.SPITBF);         //Wait for buffer empty.

    SPI2BUF = 0x00;                       // Send 8 bits of dummy data

    while(SPI2STATbits.SPITBF);         //Wait for buffer empty.

    SPI2BUF = 0x00;                       // Send 8 bits of dummy data

 

 

    while(!SPI2STATbits.SPIRBF);         //Wait for recieve buffer data

    temp = SPI2BUF;                     // Store 8 bits of temperature data

 

 

    while(!SPI2STATbits.SPIRBF);         //wait for recieve buffer data

    temp1 = SPI2BUF;                    // Store next 8 bits of temperature data

 

 

    temp2 = (temp1<<8)+temp;

 

 

    return temp2;                       // Return  latest temperature

Outcomes