【正文】
CThermometer resolution is programmable from 9 to 12 bitsConverts 12bit temperature to digital word in 750ms . Userdefinable, nonvolatile temperature alarm settingsAlarm search mand identifies and addresses devices whose temperature is outside of programmed limits temperaturealarm condition Applications include thermostatic controls, industrial systems, consumer products,thermometers, or any thermally sensitivesystemDESCRIPTIONThe DS18B20 Digital Thermometer provides 9 to 12bit configurable temperature readings which indicate the temperature of the device.Information is sent to/from the DS18B20 over a 1Wire interface, so that only one wire and ground needs to be connected 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 source.Because each DS18B20 contains a unique silicon serial number, multiple DS18B20s can exist on the same 1Wire 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 control.DS18B20Z 8pin SOIC and DS18P20P TSOC : All pins not specified in this table are not to be connected.OVERVIEWThe block diagram of Figure 1 shows the major ponents of the DS18B20. The DS18B20 has four main data ponents: 1 64bit lasered ROM, 2 temperature sensor, 3 nonvolatile temperature alarm triggers TH and TL, and 4 a configuration register. The device derives its power from the 1Wire munication line by storing energy on an internal capacitor during periods of time when the signal line is high and continues to operate off this power source during the low times of the 1Wire line until it returns high to replenish the parasite capacitor supply. As an alternative, the DS18B20 may also be powered from an external 3V supply.Communication to the DS18B20 is via a 1Wire port. With the 1Wire 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 mands: 1 Read ROM, 2 Match ROM, 3 Search ROM, 4 Skip ROM, or 5 Alarm Search. These mands operate on the 64bit lasered ROM portion of each device and can single out a specific device if many are present on the 1Wire 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 and control functions are accessible and the master may then provide any one of the six memory and control function mands.One control function mand instructs the DS18B20 to perform a temperature measurement. The result of this measurement will be placed in the DS18B20’s scratchpad memory, and may be read by issuing a memory function mand 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 mand is not applied to the DS18B20, these registers may be used as general purpose user memory. The scratchpad also 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 mand. Read access to these registers is through the scratchpad. All data is read and written least significant bit first.PARASITE POWERThe block diagram Figure 1 shows the parasitepowered circuitry. This circuitry “steals” power whenever the DQ or VDD pins are high. DQ will provide sufficient power as long as the specified timing and voltage requirements are met see the section titled “1Wire Bus System” . The advantages of parasite power are twofold: 1 by parasiting off this pin, no local power source is needed for remote sensing of temperature, and 2 the ROM may be read in absence of normal power.In order for the DS18B20 to be able to perform accurate temperature conversions, sufficient power must be provided over the DQ line when a temperature conversion is taking place. Since the operating current of the DS18B20 is up to mA, the DQ line will not have sufficient drive due to the 5k pullup resistor. This problem is particularly acute if several DS18B20s are on the same DQ and attempting to convertsimultaneously.There are two ways to assure that the DS18B20 has sufficient supply current during its active conversion cyc。C accuracy from 10176。F177。C. Fahrenheit equivalent is 67176。[5] 何立民單片機(jī)應(yīng)用系統(tǒng)設(shè)計(jì)北京航天航空大學(xué)出版社,1990Microcontroller,2001附錄1 英文翻譯原文FEATURESUnique 1WireTM interface requires only one port pin for municationMultidrop capability simplifies distributed temperature sensing applicationsRequires no external ponentsCan be powered from data line. Power supply range is to Zero standby power requiredMeasures temperatures from 55176。[3]謝劍英,賈青編著,微型計(jì)算機(jī)控制技術(shù) 北京:國(guó)防工業(yè)出版社,2001年。 許 浩2006年5月31日于杭州參考文獻(xiàn)[1]肖洪兵,胡輝編著,:北京航空航天大學(xué)出版社,2002年8月。同樣要感謝各科的老師在四年來(lái)的學(xué)習(xí)生活中給予我的精心指導(dǎo)、照顧和鼓勵(lì)。我很慶幸我在這次畢業(yè)設(shè)計(jì)中已經(jīng)盡心盡力,讓我學(xué)到了很多很多意想不到的東西。 這次的設(shè)計(jì),不但讓我感覺(jué)到了獨(dú)立學(xué)習(xí)的能力的重要性,而且從設(shè)計(jì)的文獻(xiàn)資料到元器件的市場(chǎng)采購(gòu),更考驗(yàn)了我的實(shí)際綜合能力。通過(guò)實(shí)踐我還對(duì)自己所學(xué)的各個(gè)方面的知識(shí)進(jìn)行了總結(jié),提高了自我學(xué)習(xí)能力和獲取新知識(shí)的能力。通過(guò)這次設(shè)計(jì),我對(duì)傳感器和單片機(jī)以及相關(guān)的電子電路知識(shí)有了更深的認(rèn)識(shí),也學(xué)到了很重要的一點(diǎn),“硬件及軟件的調(diào)試方法”。 Loop Until InStr 1, Buf, RS 0 Or GetTickCount TT DT If InStr 1, Buf, RS 0 Then WaitRS Buf Else WaitRS End IfEnd Function 5 總 結(jié)經(jīng)過(guò)將近三個(gè)月的努力探索和奮力拼搏,畢業(yè)設(shè)計(jì)已經(jīng)結(jié)束。DT是最長(zhǎng)的等待時(shí)間39。Comm是通信控件名稱39。 TT GetTickCount Do DoEvents Loop Until GetTickCount TT tEnd Sub39。超過(guò)范圍則數(shù)值歸零End SubDeclare Function GetTickCount Lib kernel32 As LongSub TimeDelay t As Long 39。由上一次的位置畫(huà)至此點(diǎn) End If End If PreValue ValueStr NowX NowX + 1 39。若否,則以藍(lán)色繪線 If ValueStr PreValue + Then NowX, ValueStr , RGB 255, 0, 0 39。設(shè)定起點(diǎn) Else 39。顯示在畫(huà)面上 If NowX 0 Then 39。分離出正號(hào)以后的數(shù)值 Format ValueStr, amp。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。將模擬讀值命令送出,再取得返回字符串并判斷。定時(shí)器的Timer事件引發(fā)后,就不斷地執(zhí)行其中的程序。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。39。使用兩個(gè)像素