1、毕业设计(论文)英 文 翻 译DS18B20 单线温度传感器一 特征:ucts DS18B20 data sheet 2012 独特的单线接口,只需 1 个接口引脚即可通信 每个设备都有一个唯一的64位串行代码存储在ROM上 多点能力使分布式温度检测应用得以简化 不需要外部部件 可以从数据线供电,电源电压范围为3.0V至5.5V 测量范围从-55 C 至+125 C(-67 F至257 F),从-10至+85 C的精度为0.5 C 温度计分辨率是用户可选择的9至12位 转换12位数字的最长时间是750ms 用户可定义的非易失性的温度告警设置 告警搜索命令识别和寻址温度在编定的极限之外的器件 (
2、温度告警情况) 采用8引脚SO(150mil),8引脚SOP和3引脚TO - 92封装 软件与DS1822兼容 应用范围包括恒温控制工业系统消费类产品温度计或任何热敏系统二 简介该DS18B20的数字温度计提供9至12位的摄氏温度测量,并具有与非易失性用户可编程上限和下限报警功能。信息单线接口送入DS18B20或从DS18B20 送出,因此按照定义只需要一条数据线与中央微处理器进行通信。它的测温范围从-55C到 +125C,其中从-10 C至+85 C可以精确到0.5C 。此外,DS18B20可以从数据线直接供电(“寄生电源”),从而消除了供应需要一个外部电源。每个 DS18B20 的有一个唯
3、一的64位序列码,它允许多个DS18B20的功能在同一总线。因此,用一个微处理器控制大面积分布的许多DS18B20是非常简单的。此特性的应用范围包括 HVAC、环境控制、建筑物、设备或机械内的温度检测以及过程监视和控制系统。三 综述64位ROM存储设备的独特序号。存贮器包含2个字节的温度寄存器,它存储来自温度传感器的数字输出。此外,暂存器可以访问的1个字节的上下限温度告警触发器(TH和TL)和1个字节的配置寄存器。配置寄存器允许用户设置的温度到数字转换的分辨率为9,10,11或12位。TH,TL和配置寄存器是非易失性的,因此掉电时依然可以保存数据。该DS18B20使用Dallas的单总线协议,
4、总线之间的通信用一个控制信号就可以实现。控制线需要一个弱上拉电阻,因为所有的设备都是通过3线或开漏端口连接(在DS18B20中用DQ引脚)到总线的。在这种总线系统中,微处理器(主设备)和地址标识上使用其独有的64位代码。因为每个设备都有一个唯一的代码,一个总线上连接设备的数量几乎是无限的。单总线协议,包括详细的解释命令和“时间槽”,此资料的单总线系统部分包括这些内容。DS18B20的另一个特点是:没有外部电源供电仍然可以工作。当DQ引脚为高电平时,电压是单总线上拉电阻通过DQ引脚供应的。高电平信号也可以充当外部电源,当总线是低电平时供应给设备电压。这种从但总线提供动力的方法被称为“寄生电源“。
5、作为替代电源,该DS18B20也可以使用连接到 VDD 引脚的外部电源供电。四 运用 测量温度该DS18B20的核心功能是它是直接输出数字信号的温度传感器。该温度传感器的分辨率为用户配置至9,10,11或12位,相当于0.5 C,0.25 C,0.125 C和0.0625 C的增量。其中传感器默认为12位。该DS18B20在低功耗空闲状态;启动温度测量和模数转换,主机必须发出一个转换命令。转换后,所产生的数据存储在内存中的2比特温度寄存器中,DS18B20返回其空闲状态。如果DS18B20是由外部电源供电的,主机可以发出“读时隙”,转换后,通过发送低电平T命令和DS18B20将响应,同时温度转
6、换继续进行,当转换完成时变为高电平。如果DS18B20的是寄生电源供电的,在整个温度转换过程中此通知技术不能使用,因为总线必须变为高电平。总线需要寄生电源供电将在此资料的DS18B20驱动部分将详细介绍。 DS18B20的输出温度数据为标准摄氏度;对于华氏温度的应用,必须通过查表或运用转换方法。温度数据在温度寄存器存储为一个16位符号扩展位和2位的补码。该标志位(S)表示温度的正负符号位:为正数时S = 0,为负数时S = 1。如果是DS18B20配置为12位分辨率,在温度寄存器的所有位将包含有效数据。对于11位分辨率,位0是未定义的。对于10位分辨率,位1和0是未定义的。对于9位分辨率,位2
7、,1和0是未定义的。表2给出了输出数字数据和相应的12位分辨率温度读数转换例子。五 运用报警信号DS18B20温度转换完成后,温度值与用户定义的2个报警触发值存储在1个字节的TH和TL寄存器。符号位(S)表示温度值的正负: S = 0时为正值, S = 1为负值。TH和TL寄存器是非易失(EEPROM),因此他们将保留设备掉电时的数据。TH和TL可通过暂存器中字节2和3获得,此内容在本数据表内存部分解释。六 TH和TL寄存器格式只有温度寄存器4中的11位用于和TL的比较中,由于TH和TL都是 8位寄存器。如果测量温度低于或等于TL或超过TH,报警情况存在而且报警标志将设置在DS18B20的内部
8、。每个温度测量后,这个标志位将被更新,因此,如果报警条件消失,下一个温度转换后,该标志位将被关闭。主设备可以通过搜索ECH命令检查总线上所有DS18B20报警标志位的状态。任何有设置报警标志位的DS18B20将响应命令,所以主设备可以决定到底是哪个DS18B20在经历一个报警条件。如果报警的情况存在,TH和TL设置已经改变了,另一个温度转换应该去验证报警条件。七 DS18B20的驱动该传感器DS18B20可以用外部电源接VDD端供电,或者它可以工作在“寄生电源”模式下,这种模式允许DS18B20在没有外部电源下工作。寄生电源在远程或者空间受限情况下感温是非常有用的。寄生功率控制电路,其中当总线
9、引脚为高电平时,力部门宿舍从DS18B20通过连接单总线的DQ端“偷”电。当总线是高电平或者总线是低电平,而一些能量存贮在CPP中来提供电源,“偷”来的电位DS18B20提供驱动。当DS18B20在寄生电源模式下使用时,VDD引脚必须接地。在寄生电源模式下,单总线和CPP可以提供足够的电流给DS18B20的大部分操作,只要指定的时间和电压的要求得到满足(参考本数据手册DC电气特性和AC电气特性章节)。 然而,当DS18B20温度转换或复制暂存器的数据到EEPROM时,工作电流可高达1.5毫安。这个电流会导致无法接受的电压下降,整个单总线电阻压降减小,更多的电流可以由寄生电源供应。为了确保DS1
10、8B20有足够的电流供应,无论正在发生温度转换或复制暂存器的数据到EEPROM,单总线都必须接一个强上拉电阻。这可以通过使用一个MOSFET以直接把总线电压下降到如图4所示。单总线必须在转换T44h或暂存器复制48H命令发出后,10秒内(最大)转换到强上拉状态,而且总线必须在转换(tconv)或数据传输(twr = 10ms)期间通过上拉保持高电平。在单总线上拉使能时,其他活动不能发生。该DS18B20的也可以采用的连接外部电源到VDD脚上的传统方法。这种方法的优点是不需要MOSFET的上拉, 而且单总线可以在进行温度转换时间自由地进行其他操作。在+100以上的高温时不推荐使用寄生电源,因为在
11、这些温度下存在较高泄漏电流,DS18B20可能无法维持通信。对于像在这种高温下的使用,强烈建议由一个DS18B20的外部电源供电。在某些情况下,总线主机可能不知道DS18B20是外部电源还是寄生电源供电。主机需要这些信息来确定是否强大的总线上拉应在温度转换时使用。要获得这些信息,主机可以在 “阅读时段” 一个读取电源B4h命令后,发出一个跳过ROMCCh命令。在读时隙,寄生电源给DS18B20供电将把总线电平拉低,外部供电时DS18B20将会让总线仍然保持高电平。如果总线拉低,主机知道在温度转换期间它必须提供单总线强上拉。八 64位激光ROM每一 DS18B20 包括一个唯一的 64 位长的
12、ROM 编码。开绐的 8 位是单线产品系列编码:28h,接着的 48 位是唯一的系列号。最重要的8位是开始 56 位 CRC位,从56位的ROM端计算而来。CRC比特的详细内容将在CRC概述一章中介绍。64位ROM代码和相关ROM功能控制逻辑使DS18B20作为使用协议的单线设备的运作,单总线系统的数据表部分详细介绍了这个协议。九 存贮器DS18B20的存贮器那样被组织 存贮器由一个高速暂存 便笺式 RAM、一个存贮高温度和低温度和触发器 TH 和 TL的非易失性电可擦除 E2RAM和存储配置寄存器组成。请注意,如果DS18B20的报警功能不使用,TH和TL寄存器可以作为通用存储器。 DS18
13、B20的功能命令部分详细叙述了所有内存的命令。暂存器的字节0和字节1分别包含LSB和MSB温度寄存器。这些字节是只读的。字节2和3提供是提供接入的TH和TL寄存器。字节4包含配置寄存器数据,数据表配置寄存器部分详细解释了它的内容。字节5,6和7是保留供内部使用的设备,不能被覆盖,当被读到时,这些字节将返回1秒。8字节暂存器是只读的,并且包含了循环冗余校验码,通过暂存器的0到7字节。DS18B20使用在CRC生成一节中描述的方法生成该CRC。数据写入字节2,3,暂存器4使用写入暂存4Eh指令;数据必须传输到DS18B20以最低有效位开始的第2字节。为了验证数据的完整性,数据被写入后暂存器可以读取
14、(使用数据读取暂存器与Beh命令)。当读取暂存器,数据是从最低有效位的0字节开始的。要传送的TH,TL和配置数据从暂存器到EEPROM,主机必须发起复制暂存 48h命令。设备关机时,在EEPROM寄存器的数据将被保留,上电时EEPROM中的数据到相应的位置暂存器重新加载。数据也可以使用召回E2 B8h命令在任何时间从EEPROM中重新加载向暂存器。主机可以在召回E2命令后发出读时隙后,DS18B20的将通过传输0表明处在召回状态,当召回完成时将传输1。十 配置寄存器暂存存储器的第四字节包含配置寄存器。用户可以使用该寄存器的R0和R1的位设置DS18B20的转换分辨率。这些位默认是R0和R1都等
15、于1(12位)的分辨率。请注意,两者之间是有直接的分辨率和转换时间的对比。第7位,并在配置寄存器0至4位是保留供内部使用的设备,不能被覆盖,这些位被读出时将返回1秒。十一 CRC生成CRC字节是DS18B20的64位ROM代码的一部分,在暂存器的第9比特。CRC的代码是由前56位的ROM代码计算出的,并处在ROM中最重要的字节。暂存器中的CRC代码是由储存器中的数据计算出来的,因此它变化时,在暂存器中的数据也会变化。CRCs提供总线主机数据验证方法,当主机从DS18B20读取数据时。为了验证数据已被正确读取,总线主机必须从接收到的数据中重新计算CRC,然后比较此值无论是ROM代码(为ROM读)
16、或暂存器的CRC(为暂存器读取)。如果计算出的CRC与读到的CRC匹配,说明已收到的数据准确无误。 CRC的值比较,是否继续运作完全由总线主机决定。如果DS18B20的CR(ROM或暂存器)与由总线主机产生的值不匹配,DS18B20中没有任何电路阻止命令序列的进程。由总线主机产生的价值电路。CRC的同等多项式函数(ROM或暂存器)是: CRC = X8+ X5 + X4+ 1总线主机可以重新计算CRC,然后使用多项式发生器与从DS18B20得到用的CRC值进行比较。该电路由一个移位寄存器和XOR门组成,移位寄存器初始化为0。从暂存器最低有效位或0字节的最低有效位的开始,每次一比特应该移入移位寄
17、存器。从ROM或从暂存器中最重要的第7字节转移到第56比特后,多项式发生器将包含重新计算的CRC校验码。接下来,8位ROM代码或暂存器从DS18B20的CRC必须转移到电路。此时,如果重新计算的CRC是正确的,移位寄存器将包含所有0。对达拉斯的单总线循环冗余校验的更多信息在应用笔记27:理解和使用触摸与达拉斯半导体存储器产品的循环冗余校验中有详细介绍。 DS18B20 Single - wire temperature sensorI. FEATURES Unique 1-Wireinterface requires only one port pin for communication Ea
18、ch device has a unique 64-bit serial code stored in an onboard ROM Multidrop capability simplifies distributed temperature sensing applications Requires no external components Can be powered from data line. Power supply range is 3.0V to 5.5V Measures temperatures from 55C to +125C (67F to +257F) 0.5
19、C accuracy from 10C to +85C Thermometer resolution is user-selectable from 9 to 12 bits Converts temperature to 12-bit digital word in 750ms (max.) User-definable nonvolatile (NV) alarm settings Alarm search command identifies and addresses devices whose temperature is outside of programmed limits (
20、temperature alarm condition) Available in 8-pin SO (150mil), 8-pin SOP, and 3-pin TO-92 packages Software compatible with the DS1822 Applications include thermostatic controls, industrial systems, consumer products, thermometers, or any thermally sensitiveII. DESCRIPTION The DS18B20 Digital Thermome
21、ter provides 9 to 12bit centigrade temperature measurements and has an alarm function with nonvolatile user-programmable upper and lower trigger points. The DS18B20 communicates over a 1-Wire bus that by definition requires only one data line (and ground) for communication with a central microproces
22、sor. It has an operating temperature range of 55C to +125Cand is accurate to 0.5C over the range of 10C to +85C. In addition, the DS18B20 can derive power directly from the data line (“parasite power”), eliminating the need for an external power supply. Each DS18B20 has a unique 64-bit serial code,
23、which allows multiple DS18B20s to function on the same 1wire bus; thus, it is simple to use one microprocessor to control many DS18B20s distributed over a large area. Applications that can benefit from this feature include HVAC environmental controls, temperature monitoring systems inside buildings,
24、 equipment or machinery, and process monitoring and control systems.III. OVERVIEWFigure 1 shows a block diagram of the DS18B20, and pin descriptions are given in Table 1. The 64-bit ROM stores the devices unique serial code. The scratchpad memory contains the 2-byte temperature register that stores
25、the digital output from the temperature sensor. In addition, the scratchpad provides access to the 1-byte upper and lower alarm trigger registers (TH and TL), and the 1-byte configuration register. The configuration register allows the user to set the resolution of the temperature-to-digital convers
26、ion to 9, 10, 11, or 12 bits. The TH, TL and configuration registers are nonvolatile (EEPROM), so they will retain data when the device is powered down.The DS18B20 uses Dallas exclusive 1-Wire bus protocol that implements bus communication using one control signal. The control line requires a weak p
27、ullup resistor since all devices are linked to the bus via a 3-state or open-drain port (the DQ pin in the case of the DS18B20). In this bus system, the microprocessor (the master device) identifies and addresses devices on the bus using each devices unique 64-bit code. Because each device has a uni
28、que code, the number of devices that can be addressed on one bus is virtually unlimited. The 1-Wire bus protocol, including detailed explanations of the commands and “time slots” is covered in the 1-WIRE BUS SYSTEM section of this datasheet. Another feature of the DS18B20 is the ability to operate w
29、ithout an external power supply. Power is instead supplied through the 1-Wire pullup resistor via the DQ pin when the bus is high. The high bus signal also charges an internal capacitor (CPP), which then supplies power to the device when the bus is low. This method of deriving power from the 1-Wire
30、bus is referred to as “parasite power.” As an alternative, the DS18B20 may also be powered by an external supply on VDD.IV. OPERATION MEASURING TEMPERATURE The core functionality of the DS18B20 is its direct-to-digital temperature sensor. The resolution of the temperature sensor is user-configurable
31、 to 9, 10, 11, or 12 bits, corresponding to increments of 0.5 C, 0.25 C, 0.125 C, and 0.0625 C, respectively. The default resolution at power-up is 12-bit. The DS18B20 powers-up in a low-power idle state; to initiate a temperature measurement and A-to-D conversion, the master must issue a Convert T
32、44h command. Following the conversion, the resulting thermal data is stored in the 2-byte temperature register in the scratchpad memory and the DS18B20 returns to its idle state. If the DS18B20 is powered by an external supply, the master can issue “read time slots” (see the 1-WIRE BUS SYSTEM sectio
33、n) after the Convert T command and the DS18B20 will respond by transmitting 0 while the temperature conversion is in progress and 1 when the conversion is done. If the DS18B20 is powered with parasite power, this notification technique cannot be used since the bus must be pulled high by a strong pul
34、lup during the entire temperature conversion. The bus requirements for parasite power are explained in detail in the POWERING THE DS18B20 section of this datasheet. The DS18B20 output temperature data is calibrated in degrees centigrade; for Fahrenheit applications, a lookup table or conversion rout
35、ine must be used. The temperature data is stored as a 16-bit sign-extended twos complement number in the temperature register (see Figure 2). The sign bits (S) indicate if the temperature is positive or negative: for positive numbers S = 0 and for negative numbers S = 1. If the DS18B20 is configured
36、 for 12-bit resolution, all bits in the temperature register will contain valid data. For 11-bit resolution, bit 0 is undefined. For 10-bit resolution, bits 1 and 0 are undefined, and for 9-bit resolution bits 2, 1 and 0 are undefined. Table 2 gives examples of digital output data and the correspond
37、ing temperature reading for 12-bit resolution conversions.V OPERATION ALARM SIGNALINGAfter the DS18B20 performs a temperature conversion, the temperature value is compared to the user-defined twos complement alarm trigger values stored in the 1-byte TH and TL registers (see Figure 3). The sign bit (
38、S) indicates if the value is positive or negative: for positive numbers S = 0 and for negative numbers S = 1. The TH and TL registers are nonvolatile (EEPROM) so they will retain data when the device is powered down. TH and TL can be accessed through bytes 2 and 3 of the scratchpad as explained in t
39、he MEMORY section of this datasheet.VI. TH AND TL REGISTER FORMAT Figure 3Only bits 11 through 4 of the temperature register are used in the TH and TL comparison since TH and TL are 8-bit registers. If the measured temperature is lower than or equal to TL or higher than TH, an alarm condition exists
40、 and an alarm flag is set inside the DS18B20. This flag is updated after every temperature measurement; therefore, if the alarm condition goes away, the flag will be turned off after the next temperature conversion. The master device can check the alarm flag status of all DS18B20s on the bus by issu
41、ing an Alarm Search ECh command. Any DS18B20s with a set alarm flag will respond to the command, so the master can determine exactly which DS18B20s have experienced an alarm condition. If an alarm condition exists and the TH or TL settings have changed, another temperature conversion should be done
42、to validate the alarm condition.VII. POWERING THE DS18B20 The DS18B20 can be powered by an external supply on the VDD pin, or it can operate in “parasite power” mode, which allows the DS18B20 to function without a local external supply. Parasite power is very useful for applications that require rem
43、ote temperature sensing or that are very space constrained. Figure 1 shows the DS18B20s parasite-power control circuitry, which “steals” power from the 1-Wire bus via the DQ pin when the bus is high. The stolen charge powers the DS18B20 while the bus is high, and some of the charge is stored on the
44、parasite power capacitor (CPP) to provide power when the bus is low. When the DS18B20 is used in parasite power mode, the VDD pin must be connected to ground. In parasite power mode, the 1-Wire bus and CPP can provide sufficient current to the DS18B20 for most operations as long as the specified tim
45、ing and voltage requirements are met (refer to the DC ELECTRICAL CHARACTERISTICS and the AC ELECTRICAL CHARACTERISTICS sections of this data sheet).However, when the DS18B20 is performing temperature conversions or copying data from the scratchpad memory to EEPROM, the operating current can be as hi
46、gh as 1.5mA. This current can cause an unacceptable voltage drop across the weak 1-Wire pullup resistor and is more current than can be supplied by CPP. To assure that the DS18B20 has sufficient supply current, it is necessary to provide a strong pullup on the 1-Wire bus whenever temperature convers
47、ions are taking place or data is being copied from the scratchpad to EEPROM. This can be accomplished by using a MOSFET to pull the bus directly to the rail as shown in Figure 4. The 1-Wire bus must be switched to the strong pullup within 10s (max) after a Convert T 44h or Copy Scratchpad 48h comman
48、d is issued, and the bus must be held high by the pullup for the duration of the conversion (tconv) or data transfer (twr = 10ms). No other activity can take place on the 1-Wire bus while the pullup is enabled. The DS18B20 can also be powered by the conventional method of connecting an external power supply to the VDD pin, as shown in Figure 5. The advantage of this method is that the MOSFET pullup is not re
版权声明:以上文章中所选用的图片及文字来源于网络以及用户投稿,由于未联系到知识产权人或未发现有关知识产权的登记,如有知识产权人并不愿意我们使用,如有侵权请立即联系:2622162128@qq.com ,我们立即下架或删除。
Copyright© 2022-2024 www.wodocx.com ,All Rights Reserved |陕ICP备19002583号-1
陕公网安备 61072602000132号 违法和不良信息举报:0916-4228922