基于单片机DS18B20的数字温度计中英文献翻译.doc

上传人:laozhun 文档编号:4148372 上传时间:2023-04-07 格式:DOC 页数:18 大小:115.50KB
返回 下载 相关 举报
基于单片机DS18B20的数字温度计中英文献翻译.doc_第1页
第1页 / 共18页
基于单片机DS18B20的数字温度计中英文献翻译.doc_第2页
第2页 / 共18页
基于单片机DS18B20的数字温度计中英文献翻译.doc_第3页
第3页 / 共18页
基于单片机DS18B20的数字温度计中英文献翻译.doc_第4页
第4页 / 共18页
基于单片机DS18B20的数字温度计中英文献翻译.doc_第5页
第5页 / 共18页
点击查看更多>>
资源描述

《基于单片机DS18B20的数字温度计中英文献翻译.doc》由会员分享,可在线阅读,更多相关《基于单片机DS18B20的数字温度计中英文献翻译.doc(18页珍藏版)》请在三一办公上搜索。

1、基于单片机DS18B20的数字温度计中英文献翻译 单位代码 学 号 分 类 号 密 级 文献翻译DS18B20 数字温度计 院系名称信息工程学院 专业名称 学生姓名 指导教师年 月 日DS18B20 数字温度计描述DS18B20 数字温度计提供9至12位温度读数指示器件的温度信息经过单线接口送入DS18B20或送出因此从中央处理器到DS18B20仅需连接一条和地读写和完成温度变换所需的电源可以有数据线本身提供而不需要外部电源因为每一个DS18B20有唯一的系列号因此多个DS18B20可以存在于同一条单线总线上这允许在许多不同的地方放置温度灵敏器件此特性的应用范围包括HVAC环境控制建筑物设备或

2、机械内的温度检测以及过程监视和控制中的温度检测特性独特的单线接口只需一个接口引脚即可通信多点能力使分布式温度检测应用得以简化不需要外部元件可用数据线供电com源不需备份电源测量范围从-55C 到125C等效的华氏温标范围是-67F 到257F以9到12位数字值方式读出温度在750毫秒内把12位温度变换为数字用户可定义的非易失性的温度警告设置告警搜索命令识别和寻址温度在编定的极限之外的器件温度告警情况应用范围包括恒温控制工业系统消费类产品温度计或任何热敏系统引脚排列引脚说明GND 地DQ 数字输入输出VDD 可选的VDDNC 不连接详细引脚说明综述图1的方框图表示DS18B20的主要部件DS18

3、B20有三个主要的数据部件164为激光ROM2温度灵敏元件3非易失性温度告警触发器TH和TL器件从单线的通信线取得其电源在信号线为高电平的时间周期内把能量贮存在内部的电容器中在单信号线为低电平的时间期内断开此电源直到信号线变为高电平重新接上寄生电容电源为止作为另一种可供选择的方法DS18B20也用外部5V电源供电与DS18B20的通信经过一个单线接口在单线接口情况下在ROM操作未定建立之前不能使用存贮器和控制操作主机必须首先提供五种ROM操作命令之一1读ROM2符合ROM3搜索ROM4 跳过ROM5 告警搜索这些命令对每一个器件的64位激光ROM部分进行操作如果在单线上有许多器件那么可以挑选出

4、一个特定的器件并给总线上的主机指示存在多少器件及其类型在成功地执行了ROM操作序列之后可使用贮存2器和控制操作然后主机可以提供六种存贮器和操作命令之一一个操作命令指示DS18B20完成温度测量改测量的结果放入DS18B20的高速暂存存贮器通过发出读暂存存储器内容的存储器操作命令可以读出此结果每一温度告警触发器TH和TL构成一个字节的EPROM如果不对DS18B20施加告警搜索命令这些寄存器用作通用用户存储器使用存储器操作命令可以写TH和TL对这些寄存器的读访问通过便簮存储器所以数据均以最低有效位在前的方式被读写单线总线系统单线总线是一种具有一个总线主机和一个或若干个从机的系统DS18B20起从

5、机的作用这种总线系统的讨论分为三个题目硬件接法处理顺序以及单线信号信号类型与定时硬件接法根据定义单线总线只有一根线这一点很重要的即线上的第一个器件能在适当的时间驱动该总线为了做到这一点第一个连接到总线上的器件必须具有漏极开路或三态输出DS18B20的单线接口多站总线由单线总线和多个与之相连的从属器件组成单线总线要求近似等于5 k单线总线的空闲状态是高电平不管任何原因如果执行需要被挂起那么若要重新恢复执行总线必须保持在空闲状态如果不满足这一点且总线保持在低电平时间大于480微秒那么总线上所有的器件均被复位硬件连接图处理顺序经过单线总线接口访问DS18B20的协议如下初始化ROM操作命令存贮器操作

6、命令处理数据初始化单线总线上的所有处理均从初始化序列开始初始化序列包括总线主机发出一复位脉冲接着由从属器件送出存在脉冲ROM操作命令一旦总线主机检测到从属器件的存在他便可以发出器件ROM操作命令之一所有ROM操作命令均由8位长这些命令列表如下读ROM 33H此命令允许总线主机读DS18B20的8位产品系列编码唯一的48位序列号以及8位的CRC此命令只能在总线上仅有一个DS18B20得情况下可以使用如果总线上存在多于一个得从属器件那么所有从片企图同时发送时将发生数据冲突的现象符合ROM 55h符合ROM命令后继以64位的ROM数据序列允许总线主机对多点总线上的DS18B20寻址只有与64位ROM

7、序列严格相符的DS18B20才能对后继的存贮器操作命令作出响应所有与64位ROM序列不符的从片将等待复位脉冲此命令在总线数据上有单个或多个器件的情况下均可使用跳过ROMCCh在单点总线系统中此命令通过允许总线主机不提供64位ROM编码而访问存储器操作来节省时间如果在总线上存在多于一个得从属器件而且在跳过ROM命令之后发出读命令那么由于多个从片同时发送数据会在总线上发生数据冲突搜索ROMF0h当系统开始工作时总线主机可能不知道单线总线上的器件个数或者不知道其64位ROM编码搜索ROM命令允许总线主机使用一种消去处理来识别总线上的所有从片的64位ROM编码告警搜索ECh此命令的流程与搜索ROM命令

8、相同但是仅在最近一次温度测量出现告警的情况下DS18B20才对此命令作出响应告警的条件定义为温度高于TH或低于TL只要DS18B20一上电告警条件就保持在设置状态直到另一次温度测量告警ROM搜索举例ROM搜索过程是简单三步过程的重复读一位读核位的补码然后写所需的那一位的值总线主机在ROM的每一位上完成这一简单的三步过程在全部过程完成之后总线主机便知道一个器件中ROM的内容器件中其余的数以及他们的ROM编码可以游另外一个过程来识别以下ROM搜索过程的例子假设四个不同的器件连接到同一条单线总线上四个器件的ROM数据如下所示 ROM1 00110101 ROM2 10101010 ROM3 1111

9、0101 ROM4 00010001搜索过程如下1总线主机通过发出复位脉冲开始初始化序列从属器件通过发出同时的存在脉冲作出响应2然后总线主机在单线总线上发出搜索人ROM命令3总线主机从单线过程中读一位每一器件通过把他们各自ROM数据的第一位的值放到单线总线上来作出响应ROM1和ROM4将把一个0放在单线总线上即把它拉至低电平ROM2和3通过使总线停留在高电平而把1放在单线总线上结果是线上所有器件的逻辑与因此总线主机接收到一个0总线主机读另一位因此搜索ROM数据命令正在执行所以单线总线上所有器件通过把各自ROM数据第一位的补码放到单线总线上来对这第二个读作出响应ROM1和ROM2把1放在单总线上

10、使之处于高电平ROM2和ROM3把0放在单线上因此他将被拉至低电平对于第一个ROM数据位的补码总线主机观察到得仍是一个0总线主机便可决定单线总线上有一些第一位为0的器件和一些第一位为1的器件com索过程的其余部分将不选择ROM2和ROM3仅留下连接到单线总线的ROM1和ROM45总线主机再执行两次读并在一个1位之后接收到一个0位这表示所有还连接在总线上的器件的第二个ROM数据位为06总线主机接着写一个0使ROM1和ROM4二者保持连接7总线主机执行两次连读并接收到两次0数据位这表示连接着的器件ROM数据的第三位都是1数据位和0数据位8总线主机写一个数据位这将不选择ROM1而把ROM4作为唯一仍

11、连接着的器件加以保留9总线主机读ROM4的ROM数据位的剩余部分而且访问需要的部件这就完成了第一个过程并且唯一的识别单线总线上的部件10总线主机通过重复步骤1至7开始一个新的ROM搜索序列11总线主机写一个1这将不与ROM4发生联系而唯一的与ROM1仍保持着联系12总线主机对于ROM1读出ROM位的剩余部分而且如果需要的话与内部逻辑通信这就完成了第二个ROM搜索过程在其中ROM中的另一个被找到13总线主机通过重复步骤1至3开始一次新的ROM搜索注意下述内容在第一次ROM搜索过程中总线主机知道一个单线器件的唯一的ID号取得部件唯一ROM编码的时间为960us 8364 us 1316ms因此总线

12、主机每秒钟能够识别75个不同的单线器件DS18B20 Digital ThermometerDESCRIPTIONThe DS18B20 Digital Thermometer provides 9 to 12-bit configurable temperature readings which indicate the temperature of the deviceInformation is sent tofrom the DS18B20 over a 1-Wire interface so that only one wire and ground needs to be conn

13、ected from a central microprocessor to a DS18B20 Power for reading writing and performing temperature conversions can be derived from the data line itself with no need for an external power sourceBecause each DS18B20 contains a unique silicon serial number multiple DS18B20s can exist on the same 1-W

14、ire bus This allows for placing temperature sensors in many different places Applications where this feature is useful include HVAC environmental controls sensing temperatures inside buildings equipment or machinery and process monitoring and controlFEATURESUnique 1-Wire interface requires only one

15、port pin for communicationMultidrop capability simplifies distributed temperature sensing applicationsRequires no external componentsCan be powered from data line Power supply range is 30V to 55VZero standby power requiredMeasures temperatures from -55C to125C Fahrenheit equivalent is -67F to 257FTh

16、ermometer resolution is programmable from 9 to 12 bitsConverts 12-bit temperature to digital word in 750 ms User-definable nonvolatile temperature alarm settingsAlarm search command identifies and addresses devices whose temperature is outside of programmed limits temperature alarm condition Applica

17、tions include thermostatic controls industrial systems consumer productsthermometers or any thermally sensitivesystemPIN ASSIGNMENTPIN DESCRIPTIONGND - GroundDQ - Data InOutVDD - Power Supply VoltageNC - No ConnectDETAILED PIN DESCRIPTION OVERVIEWThe block diagram of Figure 1 shows the major compone

18、nts of the DS18B20 The DS18B20 has four main data components 1 64-bit lasered ROM 2 temperature sensor 3 nonvolatile temperature alarm triggers TH and TL The device derives its power from the 1-Wire communication line by storing energy on an internal capacitor during periods of time when the signal

19、line is high and continues to operate off this power source during the low times of the 1-Wire line until it returns high to replenish the parasite capacitor supply As an alternative the DS18B20 may also be powered from an external 3 volt - 55 volt supplyDS18B20 BLOCK DIAGRAM Figure 1Communication t

20、o the DS18B20 is via a 1-Wire port With the 1-Wire port the memory and control functions will not be available before the ROM function protocol has been established The master must first provide one of five ROM function commands 1 Read ROM 2 Match ROM 3 Search ROM 4 Skip ROM or 5 Alarm Search These

21、commands operate on the 64-bit lasered ROM portion of eachdevice and can single out a specific device if many are present on the 1-Wire line as well as indicate to the bus master how many and what types of devices are present After a ROM function sequence has been successfully executed the memory an

22、d control functions are accessible and the master may then provide any one of the six memory and control function commands One control function command instructs the DS18B20 to perform a temperature measurement The result of this measurement will be placed in the DS18B20s scratch-pad memory and may

23、be read by issuing a memory function command which reads the contents of the scratchpad memory The temperature alarm triggers TH and TL consist of 1 byte EEPROM each If the alarm search command is not applied to the DS18B20 these registers may be used as general purpose user memory The scratchpad al

24、so contains a configuration byte to set the desired resolution of the temperature to digital conversion Writing TH TL and the configuration byte is done using a memory function command Read access to these registers is through the scratchpad All data is read and written least significant bit first1-

25、WIRE BUS SYSTEMThe 1-Wire bus is a system which has a single bus master and one or more slaves The DS18B20 behaves as a slave The discussion of this bus system is broken down into three topics hardware configuration transaction sequence and 1-Wire signaling signal types and timing HARDWARE CONFIGURA

26、TIONThe 1-Wire bus has only a single line by definition it is important that each device on the bus be able to drive it at the appropriate time To facilitate this each device attached to the 1-Wire bus must have open drain or 3-state outputs The 1-Wire port of the DS18B20 DQ pin is open drain with a

27、n internal circuit equivalent to that shown in Figure 9 A multidrop bus consists of a 1-Wire bus with multiple slaves attached The 1-Wire bus requires a pullup resistor of approximately 5 kThe idle state for the 1-Wire bus is high If for any reason a transaction needs to be suspended the bus MUST be

28、 left in the idle state if the transaction is to resume Infinite recovery time can occur between bits so long as the 1-Wire bus is in the inactive high state during the recovery period If this does not occur and the bus is left low for more than 480 s all components on the bus will be resetHARDWARE

29、CONFIGURATION TRANSACTION SEQUENCEThe protocol for accessing the DS18B20 via the 1-Wire port is as follows_ Initialization_ ROM Function Command_ Memory Function Command_ TransactionDataINITIALIZATIONAll transactions on the 1-Wire bus begin with an initialization sequence The initialization sequence

30、 consists of a reset pulse transmitted by the bus master followed by presence pulse s transmitted by the slave s The presence pulse lets the bus master know that the DS18B20 is on the bus and is ready to operate For more details see the 1-Wire Signaling sectionROM FUNCTION COMMANDSOnce the bus maste

31、r has detected a presence it can issue one of the five ROM function commands All ROM function commands are 8 bits long A list of these commands follows refer to flowchart in Figure 5 Read ROM 33hThis command allows the bus master to read the DS18B20s 8-bit family code unique 48-bit serial number and

32、 8-bit CRC This command can only be used if there is a single DS18B20 on the bus If more than one slave is present on the bus a data collision will occur when all slaves try to transmit at the same time open drain will produce a wired AND result Match ROM 55hThe match ROM command followed by a 64-bi

33、t ROM sequence allows the bus master to address a specific DS18B20 on a multidrop bus Only the DS18B20 that exactly matches the 64-bit ROM sequence will respond to the following memory function command All slaves that do not match the 64-bit ROM sequence will wait for a reset pulse This command can

34、be used with a single or multiple devices on the busSkip ROM CChThis command can save time in a single drop bus system by allowing the bus master to access the memory functions without providing the 64-bit ROM code If more than one slave is present on the bus and a Read command is issued following t

35、he Skip ROM command data collision will occur on the bus as multiple slaves transmit simultaneously open drain pulldowns will produce a wired AND result Search ROM F0hWhen a system is initially brought up the bus master might not know the number of devices on the 1-Wire bus or their 64-bit ROM codes

36、 The search ROM command allows the bus master to use a process of elimination to identify the 64-bit ROM codes of all slave devices on the busAlarm Search EChThe flowchart of this command is identical to the Search ROM command However the DS18B20 will respond to this command only if an alarm conditi

37、on has been encountered at the last temperature measurement An alarm condition is defined as a temperature higher than TH or lower than TL The alarm condition remains set as long as the DS18B20 is powered up or until another temperature measurement reveals a non-alarming value For alarming the trigg

38、er values stored in EEPROM are taken into account If an alarm condition exists and the TH or TL settings are changed another temperature conversion should be done to validate any alarm conditionsExample of a ROM SearchThe ROM search process is the repetition of a simple three-step routine read a bit

39、 read the complement of the bit then write the desired value of that bit The bus master performs this simple three-step routine on each bit of the ROM After one complete pass the bus master knows the contents of the ROM in one device The remaining number of devices and their ROM codes may be identif

40、ied by additional passesThe following example of the ROM search process assumes four different devices are connected to the same 1-Wire bus The ROM data of the four devices is as shownROM1 00110101ROM2 10101010ROM3 11110101ROM4 00010001The search process is as follows1 The bus master begins the init

41、ialization sequence by issuing a reset pulse The slave devices respond by issuing simultaneous presence pulses2 The bus master will then issue the Search ROM command on the 1-Wire bus3 The bus master reads a bit from the 1-Wire bus Each device will respond by placing the value of the first bit of th

42、eir respective ROM data onto the 1-Wire bus ROM1 and ROM4 will place a 0 onto the 1-Wire bus ie pull it low ROM2 and ROM3 will place a 1 onto the 1-Wire bus by allowing the line to stay high The result is the logical AND of all devices on the line therefore the bus master sees a 0 The bus master rea

43、ds another bit Since the Search ROM data command is being executedall of the devices on the 1-Wire bus respond to this second read by placing the complement of the first bit of their respective ROM data onto the 1-Wire bus ROM1 and ROM4 will place a 1 onto the 1-Wire allowing the line to stay high R

44、OM2 and ROM3 will place a 0 onto the 1-Wire thus it will be pulled low The bus master again observes a 0 for the complement of the first ROM data bit The bus master has determined that there are some devices on the 1-Wire bus that have a 0 in the first position and others that have a 1 The data obta

45、ined from the two reads of the three-step routine have the following interpretations4 The bus master writes a 0 This deselects ROM2 and ROM3 for the remainder of this search passleaving only ROM1 and ROM4 connected to the 1-Wire bus5 The bus master performs two more reads and receives a 0-bit follow

46、ed by a 1-bit This indicates that all devices still coupled to the bus have 0s as their second ROM data bit6 The bus master then writes a 0 to keep both ROM1 and ROM4 coupled7 The bus master executes two reads and receives two 0-bits This indicates that both 1-bits and 0-bits exist as the 3rd bit of

47、 the ROM data of the attached devices8 The bus master writes a 0-bit This deselects ROM1 leaving ROM4 as the only device stillconnected9 The bus master reads the remainder of the ROM bits for ROM4 and continues to access the part ifdesired This completes the first pass and uniquely identifies one pa

48、rt on the 1-Wire bus10 The bus master starts a new ROM search sequence by repeating steps 1 through 711 The bus master writes a 1-bit This decouples ROM4 leaving only ROM1 still coupled12 The bus master reads the remainder of the ROM bits for ROM1 and communicates to the underlying logic if desired This completes the second ROM search pass in which another of the ROMs was found13 The bus master starts a new ROM sea

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 办公文档 > 其他范文


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号