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.

[参考译文] SIMPLELINK-CC2640R2-SDK:3.30:i2ctmp 示例程序 TMP006转换为摄氏度

Guru**** 2538950 points
Other Parts Discussed in Thread: TMP006, TMP116

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/870183/simplelink-cc2640r2-sdk-3-30-i2ctmp-example-program-tmp006-convert-to-celsius

器件型号:SIMPLELINK-CC2640R2-SDK
主题中讨论的其他器件:TMP116

您好!

如果我将 TMP006或 TMP007与 i2ctmp 驱动程序示例程序一起使用、那么转换为摄氏度的乘法器似乎是错误的、因为根据数据表、每 LSB 摄氏度为0.03125。

/*采集20个样本并将其打印到控制台*/
对于(sample = 0;sample < 20;sample++){
if (I2C_transfer (i2c、&i2cTransaction)){
/*
*从接收到的数据中提取 C 度;
*请参阅 TMP116/006数据表
*
温度=(rxBuffer[0]<< 8)|(rxBuffer[1]);
温度*= 0.0078125;

/*
*如果 MSB 设置为"1"、则我们有二进制补码
*需要符号扩展的负值
*
if (rxBuffer[0]& 0x80){
温度|= 0xF000;
}

Display_printf (display、0、0、"Sample %u:%d (C)"、
采样,温度);
}
否则{
display_printf (display、0、0、"I2C 总线故障");
}

/*睡眠1秒*/
睡眠(1);
} 

-kel

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    代码看起来适用于 TMP116、但不适用于 TMP006。 我将在此上写一个 TT、以更改示例文本以反映此情况。  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    谢谢、我还建议您将示例程序更改为适用于地址为0x40的 TMP007。