我在学习DS18B20温度传感器,不知道温度上限TH跟下限TL的数值应该怎么设置?数值代表的温度是什么?
3个回答
展开全部
我这两天也在学习使用这个芯片,温度上下限TH/TL是用来设定报警功能的,如果温度超过上限或者低于下限就会发出报警信号,如果你不使用温度报警功能的话应该可以不用专门设置这两个寄存器。至于数值代表的温度,我觉得应该是结合当前设定的温度分辨率。但是这样有一个问题,因为TH和TL都只有一个字节,就存在一个表示范围问题。我查了芯片的英文版pdf,里面好像也没专门解释这个问题。个人理解,我再看看,共同学习
补充:
下面这段话是DS18B20pdf手册里面的,说明我之前的理解是对的,嘻嘻。确实存在表示范围的问题。至于这个问题的解决,可能就要如书生说的,读完之后处理、因为芯片的设计要兼顾功能和复杂性各个方面,不大可能设计的太完美。
OPERATION - ALARM SIGNALING
After the DS18B20 has performed a temperature conversion, the temperature value is compared to the trigger values stored in TH and TL. Since these registers are 8-bit only, bits 9-12 are ignored for comparison. The most significant bit of TH or TL directly corresponds to the sign bit of the 16-bit temperature register. If the result of a temperature measurement is higher than TH or lower than TL, an alarm flag inside the device is set. This flag is updated with every temperature measurement. As long as the alarm flag is set, the DS18B20 will respond to the alarm search command. This allows many
DS18B20s to be connected in parallel doing simultaneous temperature measurements. If somewhere the temperature exceeds the limits, the alarming device(s) can be identified and read immediately without having to read non-alarming devices.
补充:
下面这段话是DS18B20pdf手册里面的,说明我之前的理解是对的,嘻嘻。确实存在表示范围的问题。至于这个问题的解决,可能就要如书生说的,读完之后处理、因为芯片的设计要兼顾功能和复杂性各个方面,不大可能设计的太完美。
OPERATION - ALARM SIGNALING
After the DS18B20 has performed a temperature conversion, the temperature value is compared to the trigger values stored in TH and TL. Since these registers are 8-bit only, bits 9-12 are ignored for comparison. The most significant bit of TH or TL directly corresponds to the sign bit of the 16-bit temperature register. If the result of a temperature measurement is higher than TH or lower than TL, an alarm flag inside the device is set. This flag is updated with every temperature measurement. As long as the alarm flag is set, the DS18B20 will respond to the alarm search command. This allows many
DS18B20s to be connected in parallel doing simultaneous temperature measurements. If somewhere the temperature exceeds the limits, the alarming device(s) can be identified and read immediately without having to read non-alarming devices.
展开全部
是温度上线和温度下线 是用来做报警的。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
为什么设置它呢?既然温度都读出来了,在外面处理上、下限,岂不更好吗?
追问
现在学习确实是可以不用,但是以后就说不定了,多了解有好处。我的理解是:测温范围是
-55~125度,如果只取整数部分,那么TH跟TL就可以一个字节char型数据表示上限跟下限。不知这种理解是否正确?
追答
确实比较细心呀,呵呵。我用18B20都若干年了,从来没有考虑过那两寄存器。我认为你的理解是对的(仅仅是我个人认为啊,没有实践)。但是你可以做试验试一下吗,设置一下TH或TL,然后加温或降温检验一下是否会报警。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询