Xxxxx第1页共7页DS18B20ProgrammableResolution1-WireDigitalThermometer1、DS18B20FEATURES(1)Unique1-WireinterfacerequiresonlyonePortpinforcommunication,requiresnoexternalcomponents(2)Eachdevicehasaunique64-bitserialcodestoredinanonboardROM(3)Canbepoweredformdataline.Powersupplyrangeis3.0Vto5.5V(4)Measurestemperaturesform-55℃to+125℃,±0.5℃accuracyfrom-10℃to+85℃(5)Thermometerresolutionisuser-selectedfrom9to12bits(6)Convertstemperatureto12-bitdigitalwordin750ms(max)(7)Alarmsearchcommandidentifiesandaddressesdeviceswhosetemperatureisoutsideofprogrammedlimits(temperaturealarmcondition)(8)Availablein8-pinSOIC,and3-binTO-92packages2、DS18B20BLOCKDIAFRAMFigure1showsablockdiagramoftheDS18B20,The64-biteROMstoresthedevice’sserialcode.Thescratchpadmemorycontainsthe2-bytetemperatureegisterthatstoresthedigitaloutputfromthetemperaturesensor.Inaddition,thescratchpadprovidesaccesstothe1-byteupperandloweralarmtriggerregister(THandTL),andthe1-byteconfiguratuionregister.Theconfigurationregisterallowstheusertosettheresolutionofthetemperature-to-digitalconversionto9,10,11or12bits.TheTH,TLandconfigurationregistersarenonvolatile(EEPROM),sotheywillretaindatawhenthedeviceispowereddown.Xxxxx第2页共7页Figure1blockdiagramoftheDS18B203、DS18B20ROMCOMMANDS(1)SEARCHROM[0F0H]Whenasystemisinitiallypoweredup,themastermustidentifytheROMcodesofallslavedevicesonthebus,whichallowsthemastertodeterminethenumberofslavesandtheirdevicetypes.ThemasterlearnstheROMcodesthroughaprocessofeliminationthatrequiresthemastertoperformaSearchROMcycleasmanytimesasnecessarytoidentifyalloftheslave’s64-bitROMdevices.(2)READROM[55H]Thiscommandcanonlybeusedwhenthereisoneslaveonthebus.Itallowsthebusmastertoreadtheslave`64-bitROMcodewithoutusingtheSearchROMprocedure.Ifthiscommandisusedwhenthereismorethanoneslavepresentonthebus,adatacollisionwilloccurwhenalltheslavesattempttorespondatthesametime.(3)MATCHROM[55H]ThematchROMcommandfollowedbya64-bitROMcodesequenceallowsthebusmastertoaddressaspecificDS18B20onamultidroporsingle-dropbus.OnlytheDS18B20thatexactlymatchesthe64-bitROMcodesequencewillrespondtotheXxxxx第3页共7页functioncommandissuedbythemaster;allotherslavesonthebuswillwaitforaresetpulse.(4)SKIPROM[0CCH]ThemastercanusethiscommandtoaddressalldevicesonthebussimultaneouslywithoutsendingoutanyROMcodeinformation.NotethattheReadScratchpadcommandcanfollowtheSkipROMcommandonlyifthereisasingleslavedeviceonthebus.Inthiscasetimeissavedbyallowingthemastertoreadfromtheslavewithoutsendingthedevice’s64-bitROMcode.ASkipROMcommandfollowedbyaReadScratchpadcommandwillcauseadatacollisiononthebusifthereismorethanoneslavesincemultipledeviceswillattempttotransmitdatasimultaneously.(5)ALARMSEARCH[0ECH]TheoperationofthiscommandisidenticaltotheoperationoftheSearchROMcommandexceptthatonlyslaveswithasetalarmflagwillrespond.ThiscommandallowsthemasterdevicetodetermineifanyDS18B20sexperiencedanalarmconditionduringthemostrecenttemperatureconversion.RefertotheOPERATION-ALARMSIGNAINGsectionforanexplanationofalarmflagoperation.(6)CONVERTT[44H]Thiscommandinitiatesasingletemperatureconversion.Followingtheconversion,theresultingthermaldataisstoredinthe2-butetemperatureregisterinthescratchpadmemoryandtheDS18B20returnstoitslow-poweridlestate.Ifthedeviceisbeingusedinparasitepowermode,within10usafterthiscommandisissuedthemastermustenableastrongpulluponthe1-WirebusforthedurationoftheconversionasdescribedinthePOWERINGTHEDS18320section.IftheDS18B20ispoweredbyanexternalsupply,themastercanissuereadtimeslotsaftertheConvertTcommandandtheDS18B20willrespondbytransmittinga0whilethetemperatureconversionisinProgressanda1whentheconversionisdone.Inparasitepowermodethisnotificationtechniquecannotbeusedsincethebus1ispulledhighbythestrongpullupduringtheconversion.Xxxxx第4页共7页(7)WRITESCRACHPAD[4EH]Thiscommandallowsthemastertowrite3bytesofthedatatotheDS18B20’sscratchpad.ThefirstdatabyteiswriterintotheTHregister,thesecondbyteiswrittenintotheTLregister,andthethirdbyteiswrittenintotheconfigurationregister.Datamustbetransmittedleastsignificantbitfirst.Allthreebytesmustbewrittenbeforethemasterissuesareset,orthedatamaybecorrupted.(8)READSCRACHPAD[0BEH]Thiscommandallowsthemastertoreadthecontentsofthescratchpad.Thedatatransferstartswiththeleastsignificantbitofbyte0andcontinuesthroughthescratchpaduntil9byte(byte8-CRC)isread.Themastermayissuearesettoterminatereadingatanytimeifonlypartofthescratchpaddataisneeded.(9)COPYSCRATCHPAD[48H]ThiscommandcopiesthecontentsofthescratchpadTH,TLandconfigurationregisterstoEEPROM.Ifthedeviceisbeingusedinparasitepowermode,within10us(max)afterthiscommandisissuedthemastermustenableastrongpulluponthe1-Wirebusforatleast10msasdescribedinthePOWERINGTHEDS18B20section.(10)RECALLE2[B8H]Thiscommandrecallsthealarmtriggervalues(THandTL)andconfigurationdatafromEEPROM,respectively,inthescratchpadmemory.ThemasterdevicecanissuereadtimeslotsfollowingtheRecallE2commandandtheDS18B20willindicatethestatusoftherecallbytransmitting0whiletherecallisinprogressand1whentherecallisdone.Therecalloperationhappensautomaticallyatpower-up,sovaliddataisava