abstract: the ds1847 and ds1848 have an on-chip direct-to-digital temperature sensor. the temperature is stored in address locations e2h and e3h. this application note explains how to convert the digital temperature data into a decimal degrees celsius value.
translating temperatures from hex to decimalthe procedure for converting temperature values for the ds1847 and ds1848 begins with reading the hex values stored in bytes e2h (the msb of the temperature) and e3h (the lsb of the temperature). these two bytes contain the most recent temperature reading. once the two bytes have been read, they can be translated into binary. the bit weights are shown in table 1.
table 1. bit weight from page 5 of the ds1847 and ds1848 data sheets
e2h (temperature msb)
e3h (temperature lsb)
s
27
26
25
24
23
22
21
20
2-1
2-2
2-3
2-4
0
0
0
the temperature is stored in the 13 msbs of the binary data. the msb is the sign bit and indicates whether or not the 2's complement binary number is positive or negative. if the msb is 0, then the value is positive. if the msb is 1, then the value is negative. the next 12 bits contain the value of the temperature and are translated into decimal by different methods for positive and negative values.
positive temperature translationthe following is an example of how to translate a positive temperature. in this example, address locations e2h and e3h contain 2ah and 88h, respectively. combine these two bytes to get 2a88h. next, translate the hex data into binary. the binary equivalent of 2a88h is 0010 1010 1000 1000. since the msb is 0, the temperature is positive. the lower 3 bits of the binary data are ignored, so they are masked with 0s. table 2 shows the translation from hex to binary and the masking of the lower 3 bits.
table 2. positive number (msb = 0) translation
hexidecimal data
binary data
masked binary data
2a88h
0010 1010 1000 1000
0010 1010 1000 1000
because the temperature is positive, no 2's complement transformation is required. the data can be translated directly into a decimal number using a calculator. the binary number 0010 1010 1000 1000 is equal to the decimal value of 10888. because the data contains a fractional component, the decimal value has to be divided to attain the true temperature. the decimal value must be divided by 128 (or multiplied by 2-7) to calculate the correct decimal temperature value. dividing the decimal value 10888 by 128 results in a decimal temperature value of 85.0625°c.
negative temperature translationconverting a negative temperature value (msb = 1) is a little more involved. as an example, addresses e2h and e3h contain the data f8h and 08h. the first step would be to convert the hex values into binary. again, the lower 3 bits are ignored, so they will be masked with 0s. table 3 shows the translation from hex to binary and the masking of the 3 lower bits.
table 3. negative number (msb = 1) translation
hexidecimal data
binary data
masked binary data
f808h
1111 1000 0000 1000
1111 1000 0000 1000
the next step is to take the 2's complement of the masked binary value. this is done by first inverting the masked binary number, then adding 1 to it. inverting the binary number 1111 1000 0000 1000 results in the binary number 0000 0111 1111 0111. adding 1 gives the binary number 0000 0111 1111 1000. this value is equal to the decimal number 2040. like in the positive temperature example, the translated decimal value is divided by 128, but is also made negative because the temperature is negative as indicated by the msb. so, when the decimal value 2040 is divided by -128, the result is a decimal temperature value of -15.9375°c.
conclusionthis application note demonstrates the two methods of translating the hex data found in addresses e2h and e3h into a decimal degrees celsius temperature value. any questions about this document can be directed to the mixed-signal applications group at
mixedsignal.apps@dalsemi.com.
2021年全球5G手机出货量或将超6亿部
笔记本AGP插槽标准
TK3030C:三相电能表检定装置
墨奇科技非接触3D指纹采集仪获认定证书
DC电源模块保护内外部电路至关重要
如何解释DS1847/DS1848温度读数-How to I
LCD常用术语对照表
中控智慧科技智能云考勤机FU100简介
纳芯微推出高可靠、高精度和低功耗的温湿度传感器NSHT30
烧向互联网平台企业的“反垄断之火”,会烧到通信企业吗
超声波气象传感器型号以及特点
密钥加密方法大全
MAX8922L 30V Li+电池线性充电器,提供GSM测
求一种车载GMSL/FPD-LINK总线测试挑战及解决方案
推挽放大电路工作流程
为什么制造业最近两年开始频繁的“逃离”苏州呢?
芯原图像信号处理器IP获得汽车功能安全标准ISO 26262认证
魅族pro7什么时候上市?魅族pro7最新消息:千元王者无人敌,又发新机争前线,小米6、荣耀9宿敌魅族pro7来临
Xilinx VCU低延时方案和使用PS DP Live video接口来实现PS和PL的视频数据交换达到节约PL逻辑资源的目的
谷歌为Firefox上架Lighthouse扩展