This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMP1075: Temperature Conversion

Part Number: TMP1075
Other Parts Discussed in Thread: SYSCONFIG

Hello,

We are using TMP1075 (WSON package) IC to measure ambient air temperature.

 

Can you please suggest Temperature conversion equation.

That how to convert binary/hex data to actual temperature using equation.

Thanks.

  • Hi Kaushal,

    Please check out this example code from Sysconfig.

    dev.ti.com/.../index.html

    /*
     *  ======== TMP1075_toIntCelsius ========
     *  Convert raw temperature register value to degrees Celsius rounded to the
     *  nearest integer
     */
    int32_t TMP1075_toIntCelsius(int32_t x)
    {
        /* Shift raw register value to form a proper Q4 value */
        x >>= 4;
    
        /* Optional: Add bias to round before the final truncation */
        x += (x >= 0) ? (1 << 3) : -(1 << 3);
    
        /* Convert Q4 value to whole number */
        x /= 1 << 4; /* use division so small negative values round to 0 */
    
        return x;
    }
    
    /*
     *  ======== TMP1075_toMilliCelsius ========
     *  Convert raw temperature register value to milli-degrees Celsius
     */
    int32_t TMP1075_toMilliCelsius(int32_t x)
    {
        /* Shift raw register value to form a proper Q4 value */
        x >>= 4;
    
        /* Scale to milli-degrees, convert Q4 value to a whole number */
        return ((1000 * x) >> 4);
    }
    
    /*
     *  ======== TMP1075_toFloatCelsius ========
     *  Convert raw temperature register value to degrees Celsius
     */
    float TMP1075_toFloatCelsius(int32_t x)
    {
        /* Shift raw register value to form a proper Q4 value */
        x >>= 4;
    
        /* Convert Q4 value to a float */
        return ((float)x * 0.0625f);
    }

    Note that the two 8 bit bytes received from TMP1075 were combined into a 16bit signed value (stored in a 32 bit space for code portability) prior to being passed to the above functions. In the case of TMP1075, the high byte can be viewed as signed 8 bit integer temperature without further conversion.

        /* Sign extend and combine MSB with LSB */
        tmp = (((int32_t)(int8_t)rxBuf[0]) << 8) | rxBuf[1];

    thanks,

    ren