配色: 字号:
18b20
2012-03-04 | 阅:  转:  |  分享 
  
1of26020100

FEATURES

elevenoclockUnique1-Wire

TM

interfacerequiresonlyone

portpinforcommunication

elevenoclockMultidropcapabilitysimplifiesdistributed

temperaturesensingapplications

elevenoclockRequiresnoexternalcomponents

elevenoclockCanbepoweredfromdataline.Powersupply

rangeis3.0Vto5.5V

elevenoclockZerostandbypowerrequired

elevenoclockMeasurestemperaturesfrom-55°Cto

+125°C.Fahrenheitequivalentis-67°Fto

+257°F

elevenoclock±0.5°Caccuracyfrom-10°Cto+85°C

elevenoclockThermometerresolutionisprogrammable

from9to12bits

elevenoclockConverts12-bittemperaturetodigitalwordin

750ms(max.)

elevenoclockUser-definable,nonvolatiletemperaturealarm

settings

elevenoclockAlarmsearchcommandidentifiesand

addressesdeviceswhosetemperatureis

outsideofprogrammedlimits(temperature

alarmcondition)

elevenoclockApplicationsincludethermostaticcontrols,

industrialsystems,consumerproducts,

thermometers,oranythermallysensitive

system

PINASSIGNMENT

PINDESCRIPTION

GND-Ground

DQ-DataIn/Out

V

DD

-PowerSupplyVoltage

NC-NoConnect

DESCRIPTION

TheDS18B20DigitalThermometerprovides9to12-bit(configurable)temperaturereadingswhich

indicatethetemperatureofthedevice.

Informationissentto/fromtheDS18B20overa1-Wireinterface,sothatonlyonewire(andground)

needstobeconnectedfromacentralmicroprocessortoaDS18B20.Powerforreading,writing,and

performingtemperatureconversionscanbederivedfromthedatalineitselfwithnoneedforanexternal

powersource.

BecauseeachDS18B20containsauniquesiliconserialnumber,multipleDS18B20scanexistonthe

same1-Wirebus.Thisallowsforplacingtemperaturesensorsinmanydifferentplaces.Applications

wherethisfeatureisusefulincludeHVACenvironmentalcontrols,sensingtemperaturesinsidebuildings,

equipmentormachinery,andprocessmonitoringandcontrol.

DS18B20

ProgrammableResolution

1-WireDigitalThermometer

www.dalsemi.com

PRELIMINARY

DALLAS

DS1820

123

GND

DQVD

123

BOTTOMVIEW

DS18B20TO-92

PACKAGE

1

2

3

4

8

7

6

5

NC

NC

NC

GN

NC

NC

V

DD

DQ

DS18B20Z

8-PINSOIC(150-MIL)

DS18B20P

TSOC

NC

DQ

V

DD

1

2

34

6

5

GND

NC

NC

DS18B20

2of26

DETAILEDPINDESCRIPTIONTable1

PIN

TSOC

PIN

8PINSOIC

PIN

TO92SYMBOLDESCRIPTION

151GNDGround.

242DQDataInput/Outputpin.For1-Wireoperation:Open

drain.(See“ParasitePower”section.)

333V

DD

OptionalV

DD

pin.See“ParasitePower”sectionfor

detailsofconnection.V

DD

mustbegroundedfor

operationinparasitepowermode.

DS18B20Z(8-pinSOIC)andDS18P20P(TSOC):Allpinsnotspecifiedinthistablearenottobe

connected.

OVERVIEW

TheblockdiagramofFigure1showsthemajorcomponentsoftheDS18B20.TheDS18B20hasfour

maindatacomponents:1)64-bitlaseredROM,2)temperaturesensor,3)nonvolatiletemperaturealarm

triggersTHandTL,and4)aconfigurationregister.Thedevicederivesitspowerfromthe1-Wire

communicationlinebystoringenergyonaninternalcapacitorduringperiodsoftimewhenthesignalline

ishighandcontinuestooperateoffthispowersourceduringthelowtimesofthe1-Wirelineuntilit

returnshightoreplenishtheparasite(capacitor)supply.Asanalternative,theDS18B20mayalsobe

poweredfromanexternal3V-5.5Vsupply.

CommunicationtotheDS18B20isviaa1-Wireport.Withthe1-Wireport,thememoryandcontrol

functionswillnotbeavailablebeforetheROMfunctionprotocolhasbeenestablished.Themastermust

firstprovideoneoffiveROMfunctioncommands:1)ReadROM,2)MatchROM,3)SearchROM,4)

SkipROM,or5)AlarmSearch.Thesecommandsoperateonthe64-bitlaseredROMportionofeach

deviceandcansingleoutaspecificdeviceifmanyarepresentonthe1-Wirelineaswellasindicateto

thebusmasterhowmanyandwhattypesofdevicesarepresent.AfteraROMfunctionsequencehasbeen

successfullyexecuted,thememoryandcontrolfunctionsareaccessibleandthemastermaythenprovide

anyoneofthesixmemoryandcontrolfunctioncommands.

OnecontrolfunctioncommandinstructstheDS18B20toperformatemperaturemeasurement.Theresult

ofthismeasurementwillbeplacedintheDS18B20’sscratch-padmemory,andmaybereadbyissuinga

memoryfunctioncommandwhichreadsthecontentsofthescratchpadmemory.Thetemperaturealarm

triggersTHandTLconsistof1byteEEPROMeach.Ifthealarmsearchcommandisnotappliedtothe

DS18B20,theseregistersmaybeusedasgeneralpurposeusermemory.Thescratchpadalsocontainsa

configurationbytetosetthedesiredresolutionofthetemperaturetodigitalconversion.WritingTH,TL,

andtheconfigurationbyteisdoneusingamemoryfunctioncommand.Readaccesstotheseregistersis

throughthescratchpad.Alldataisreadandwrittenleastsignificantbitfirst.

DS18B20

3of26

DS18B20BLOCKDIAGRAMFigure1

PARASITEPOWER

Theblockdiagram(Figure1)showstheparasite-poweredcircuitry.Thiscircuitry“steals”power

whenevertheDQorV

DD

pinsarehigh.DQwillprovidesufficientpoweraslongasthespecifiedtiming

andvoltagerequirementsaremet(seethesectiontitled“1-WireBusSystem”).Theadvantagesof

parasitepoweraretwofold:1)byparasitingoffthispin,nolocalpowersourceisneededforremote

sensingoftemperature,and2)theROMmaybereadinabsenceofnormalpower.

InorderfortheDS18B20tobeabletoperformaccuratetemperatureconversions,sufficientpowermust

beprovidedovertheDQlinewhenatemperatureconversionistakingplace.Sincetheoperatingcurrent

oftheDS18B20isupto1.5mA,theDQlinewillnothavesufficientdriveduetothe5kpullupresistor.

ThisproblemisparticularlyacuteifseveralDS18B20sareonthesameDQandattemptingtoconvert

simultaneously.

TherearetwowaystoassurethattheDS18B20hassufficientsupplycurrentduringitsactiveconversion

cycle.ThefirstistoprovideastrongpullupontheDQlinewhenevertemperatureconversionsorcopies

totheE

2

memoryaretakingplace.ThismaybeaccomplishedbyusingaMOSFETtopulltheDQline

directlytothepowersupplyasshowninFigure2.TheDQlinemustbeswitchedovertothestrongpull-

upwithin10μsmaximumafterissuinganyprotocolthatinvolvescopyingtotheE

2

memoryorinitiates

temperatureconversions.Whenusingtheparasitepowermode,theV

DD

pinmustbetiedtoground.

AnothermethodofsupplyingcurrenttotheDS18B20isthroughtheuseofanexternalpowersupplytied

totheV

DD

pin,asshowninFigure3.Theadvantagetothisisthatthestrongpullupisnotrequiredonthe

DQline,andthebusmasterneednotbetiedupholdingthatlinehighduringtemperatureconversions.

Thisallowsotherdatatrafficonthe1-Wirebusduringtheconversiontime.Inaddition,anynumberof

DS18B20smaybeplacedonthe1-Wirebus,andiftheyalluseexternalpower,theymayall

simultaneouslyperformtemperatureconversionsbyissuingtheSkipROMcommandandthenissuingthe

ConvertTcommand.Notethataslongastheexternalpowersupplyisactive,theGNDpinmaynotbe

floating.

Theuseofparasitepowerisnotrecommendedabove100°C,sinceitmaynotbeabletosustain

communicationsgiventhehigherleakagecurrentstheDS18B20exhibitsatthesetemperatures.For

64-BITROM

AND

1-WIREPORT

MEMORYAND

CONTROLLOGIC

SCRATCHPAD

8-BITCRC

GENERATOR

TEMPERATURESENSOR

HIGHTEMPERATURE

TRIGGER,TH

LOWTEMPERATURE

TRIGGER,TL

CONFIGURATION

REGISTER

POWER

SUPPLY

SENSE

INTERNALV

DD

DQ

V

DD

DS18B20

4of26

applicationsinwhichsuchtemperaturesarelikely,itisstronglyrecommendedthatV

DD

beappliedtothe

DS18B20.

ForsituationswherethebusmasterdoesnotknowwhethertheDS18B20sonthebusareparasite

poweredorsuppliedwithexternalV

DD

,aprovisionismadeintheDS18B20tosignalthepowersupply

schemeused.ThebusmastercandetermineifanyDS18B20sareonthebuswhichrequirethestrong

pullupbysendingaSkipROMprotocol,thenissuingthereadpowersupplycommand.Afterthis

commandisissued,themasterthenissuesreadtimeslots.TheDS18B20willsendback“0”onthe1-

Wirebusifitisparasitepowered;itwillsendbacka“1”ifitispoweredfromtheV

DD

pin.Ifthemaster

receivesa“0,”itknowsthatitmustsupplythestrongpullupontheDQlineduringtemperature

conversions.See“MemoryCommandFunctions”sectionformoredetailonthiscommandprotocol.

STRONGPULLUPFORSUPPLYINGDS18B20DURINGTEMPERATURE

CONVERSIONFigure2

USINGV

DD

TOSUPPLYTEMPERATURECONVERSIONCURRENTFigure3

μP

+3V-+5.5V

+3V-+5.5V

DS18B20

GND

V

DD

I/O

4.7K

μP

DS18B20

V

DD

I/O

+3V-+5.5V

4.7K

EXTERNAL

+3V-+5.5V

SUPPLY

TOOTHER

1-WIRE

DEVICES

DS18B20

5of26

OPERATION-MEASURINGTEMPERATURE

ThecorefunctionalityoftheDS18B20isitsdirect-to-digitaltemperaturesensor.Theresolutionofthe

DS18B20isconfigurable(9,10,11,or12bits),with12-bitreadingsthefactorydefaultstate.This

equatestoatemperatureresolutionof0.5°C,0.25°C,0.125°C,or0.0625°C.Followingtheissuanceof

theConvertT[44h]command,atemperatureconversionisperformedandthethermaldataisstoredin

thescratchpadmemoryina16-bit,sign-extendedtwo’scomplementformat.Thetemperature

informationcanberetrievedoverthe1-Wire?interfacebyissuingaReadScratchpad[BEh]command

oncetheconversionhasbeenperformed.Thedataistransferredoverthe1-Wire?bus,LSBfirst.The

MSBofthetemperatureregistercontainsthe“sign”(S)bit,denotingwhetherthetemperatureispositive

ornegative.

Table2describestheexactrelationshipofoutputdatatomeasuredtemperature.Thetableassumes12-bit

resolution.IftheDS18B20isconfiguredforalowerresolution,insignificantbitswillcontainzeros.For

Fahrenheitusage,alookuptableorconversionroutinemustbeused.

Temperature/DataRelationshipsTable2

2

3

2

2

2

1

2

0

2

-1

2

-2

2

-3

2

-4

LSB

MSb

(unit=°C)

LSb

SSSSS2

6

2

5

2

4

MSB

TEMPERATUREDIGITALOUTPUT

(Binary)

DIGITAL

OUTPUT

(Hex)

+125°C000001111101000007D0h

+85°C00000101010100000550h

+25.0625°C00000001100100010191h

+10.125°C000000001010001000A2h

+0.5°C00000000000010000008h

0°C00000000000000000000h

-0.5°C1111111111111000FFF8h

-10.125°C1111111101011110FF5Eh

-25.0625°C1111111001101111FF6Fh

-55°C1111110010010000FC90h

Thepoweronresetregistervalueis+85°C.

OPERATION-ALARMSIGNALING

AftertheDS18B20hasperformedatemperatureconversion,thetemperaturevalueiscomparedtothe

triggervaluesstoredinTHandTL.Sincetheseregistersare8-bitonly,bits9-12areignoredfor

comparison.ThemostsignificantbitofTHorTLdirectlycorrespondstothesignbitofthe16-bit

temperatureregister.IftheresultofatemperaturemeasurementishigherthanTHorlowerthanTL,an

alarmflaginsidethedeviceisset.Thisflagisupdatedwitheverytemperaturemeasurement.Aslongas

thealarmflagisset,theDS18B20willrespondtothealarmsearchcommand.Thisallowsmany

DS18B20stobeconnectedinparalleldoingsimultaneoustemperaturemeasurements.Ifsomewherethe

temperatureexceedsthelimits,thealarmingdevice(s)canbeidentifiedandreadimmediatelywithout

havingtoreadnon-alarmingdevices.

DS18B20

6of26

64-BITLASEREDROM

EachDS18B20containsauniqueROMcodethatis64-bitslong.Thefirst8bitsarea1-Wirefamilycode

(DS18B20codeis28h).Thenext48bitsareauniqueserialnumber.Thelast8bitsareaCRCofthefirst

56bits.(SeeFigure4.)The64-bitROMandROMFunctionControlsectionallowtheDS18B20to

operateasa1-Wiredeviceandfollowthe1-Wireprotocoldetailedinthesection“1-WireBusSystem.”

ThefunctionsrequiredtocontrolsectionsoftheDS18B20arenotaccessibleuntiltheROMfunction

protocolhasbeensatisfied.ThisprotocolisdescribedintheROMfunctionprotocolflowchart(Figure5).

The1-WirebusmastermustfirstprovideoneoffiveROMfunctioncommands:1)ReadROM,2)Match

ROM,3)SearchROM,4)SkipROM,or5)AlarmSearch.AfteraROMfunctionsequencehasbeen

successfullyexecuted,thefunctionsspecifictotheDS18B20areaccessibleandthebusmastermaythen

provideoneofthesixmemoryandcontrolfunctioncommands.

CRCGENERATION

TheDS18B20hasan8-bitCRCstoredinthemostsignificantbyteofthe64-bitROM.Thebusmaster

cancomputeaCRCvaluefromthefirst56-bitsofthe64-bitROMandcompareittothevaluestored

withintheDS18B20todetermineiftheROMdatahasbeenreceivederror-freebythebusmaster.The

equivalentpolynomialfunctionofthisCRCis:

CRC=X

8

+X

5

+X

4

+1

TheDS18B20alsogeneratesan8-bitCRCvalueusingthesamepolynomialfunctionshownaboveand

providesthisvaluetothebusmastertovalidatethetransferofdatabytes.IneachcasewhereaCRCis

usedfordatatransfervalidation,thebusmastermustcalculateaCRCvalueusingthepolynomial

functiongivenaboveandcomparethecalculatedvaluetoeitherthe8-bitCRCvaluestoredinthe64-bit

ROMportionoftheDS18B20(forROMreads)orthe8-bitCRCvaluecomputedwithintheDS18B20

(whichisreadasaninthbytewhenthescratchpadisread).ThecomparisonofCRCvaluesanddecision

tocontinuewithanoperationaredeterminedentirelybythebusmaster.Thereisnocircuitryinsidethe

DS18B20thatpreventsacommandsequencefromproceedingiftheCRCstoredinorcalculatedbythe

DS18B20doesnotmatchthevaluegeneratedbythebusmaster.

The1-WireCRCcanbegeneratedusingapolynomialgeneratorconsistingofashiftregisterandXOR

gatesasshowninFigure6.AdditionalinformationabouttheDallas1-WireCyclicRedundancyCheckis

availableinApplicationNote27entitled“UnderstandingandUsingCyclicRedundancyCheckswith

DallasSemiconductorTouchMemoryProducts.”

Theshiftregisterbitsareinitializedto0.Thenstartingwiththeleastsignificantbitofthefamilycode,1

bitatatimeisshiftedin.Aftertheeighthbitofthefamilycodehasbeenentered,thentheserialnumber

isentered.Afterthe48

th

bitoftheserialnumberhasbeenentered,theshiftregistercontainstheCRC

value.Shiftinginthe8bitsofCRCshouldreturntheshiftregistertoall0s.

64-BITLASEREDROMFigure4

8-BITCRCCODE48-BITSERIALNUMBER

8-BITFAMILYCODE

(28h)

MSBLSBMSBLSBMSBLSB

DS18B20

7of26

ROMFUNCTIONSFLOWCHARTFigure5

DS18B20

8of26

1-WIRECRCCODEFigure6

MEMORY

TheDS18B20’smemoryisorganizedasshowninFigure8.ThememoryconsistsofascratchpadRAM

andanonvolatile,electricallyerasable(E

2

)RAM,whichstoresthehighandlowtemperaturetriggersTH

andTL,andtheconfigurationregister.Thescratchpadhelpsinsuredataintegritywhencommunicating

overthe1-Wirebus.DataisfirstwrittentothescratchpadusingtheWriteScratchpad[4Eh]command.

ItcanthenbeverifiedbyusingtheReadScratchpad[BEh]command.Afterthedatahasbeenverified,a

CopyScratchpad[48h]commandwilltransferthedatatothenonvolatile(E

2

)RAM.Thisprocessinsures

dataintegritywhenmodifyingmemory.

Thescratchpadisorganizedaseightbytesofmemory.ThefirsttwobytescontaintheLSBandtheMSB

ofthemeasuredtemperatureinformation,respectively.Thethirdandfourthbytesarevolatilecopiesof

THandTLandarerefreshedwitheverypower-onreset.Thefifthbyteisavolatilecopyofthe

configurationregisterandisrefreshedwitheverypower-onreset.Theconfigurationregisterwillbe

explainedinmoredetaillaterinthissectionofthedatasheet.Thesixth,seventh,andeighthbytesare

usedforinternalcomputations,andthuswillnotreadoutanypredictablepattern.

ItisimperativethatonewritesTH,TL,andconfiginsuccession;i.e.awriteisnotvalidifonewrites

onlytoTHandTL,forexample,andthenissuesareset.Ifanyofthesebytesmustbewritten,allthree

mustbewrittenbeforearesetisissued.

ThereisaninthbytewhichmaybereadwithaReadScratchpad[BEh]command.Thisbytecontainsa

cyclicredundancycheck(CRC)bytewhichistheCRCoveralloftheeightpreviousbytes.ThisCRCis

implementedinthefashiondescribedinthesectiontitled“CRCGeneration”.

ConfigurationRegister

Thefifthbyteofthescratchpadmemoryistheconfigurationregister.

Itcontainsinformationwhichwillbeusedbythedevicetodeterminetheresolutionofthetemperatureto

digitalconversion.ThebitsareorganizedasshowninFigure7.

DS18B20CONFIGURATIONREGISTERFigure7

0R1R011111

MSbLSb

Bits0-4aredon’tcaresonawritebutwillalwaysreadout“1”.

Bit7isadon’tcareonawritebutwillalwaysreadout“0”.

(MSB)

XORXORXOR

(LSB)

INPUT

DS18B20

9of26

R0,R1:Thermometerresolutionbits.Table3belowdefinestheresolutionofthedigitalthermometer,

basedonthesettingsofthesetwobits.Thereisadirecttradeoffbetweenresolutionandconversiontime,

asdepictedintheACElectricalCharacteristics.ThefactorydefaultoftheseEEPROMbitsisR0=1and

R1=1(12-bitconversions).

ThermometerResolutionConfigurationTable3

R1R0Thermometer

Resolution

MaxConversion

Time

009-bit93.75ms(t

conv

/8)

0110-bit187.5ms(t

conv

/4)

1011-bit375ms(t

conv

/2)

1112-bit750ms(t

conv

)

DS18B20MEMORYMAPFigure8

TEMPERATURELSB

TEMPERATUREMSB

TH/USERBYTE1

TL/USERBYTE2

CONFIG

RESERVED

RESERVED

CRC

TH/USERBYTE1

TL/USERBYTE2

RESERVED

SCRATCHPAD

BYTE

0

1

2

3

4

5

6

7

8

E

2

RAM

CONFIG

DS18B20

10of26

1-WIREBUSSYSTEM

The1-Wirebusisasystemwhichhasasinglebusmasterandoneormoreslaves.TheDS18B20behaves

asaslave.Thediscussionofthisbussystemisbrokendownintothreetopics:hardwareconfiguration,

transactionsequence,and1-Wiresignaling(signaltypesandtiming).

HARDWARECONFIGURATION

The1-Wirebushasonlyasinglelinebydefinition;itisimportantthateachdeviceonthebusbeableto

driveitattheappropriatetime.Tofacilitatethis,eachdeviceattachedtothe1-Wirebusmusthaveopen

drainor3-stateoutputs.The1-WireportoftheDS18B20(DQpin)isopendrainwithaninternalcircuit

equivalenttothatshowninFigure9.Amultidropbusconsistsofa1-Wirebuswithmultipleslaves

attached.The1-Wirebusrequiresapullupresistorofapproximately5k?.

HARDWARECONFIGURATIONFigure9

Theidlestateforthe1-Wirebusishigh.Ifforanyreasonatransactionneedstobesuspended,thebus

MUSTbeleftintheidlestateifthetransactionistoresume.Infiniterecoverytimecanoccurbetween

bitssolongasthe1-Wirebusisintheinactive(high)stateduringtherecoveryperiod.Ifthisdoesnot

occurandthebusisleftlowformorethan480μs,allcomponentsonthebuswillbereset.

TRANSACTIONSEQUENCE

TheprotocolforaccessingtheDS18B20viathe1-Wireportisasfollows:

elevenoclockInitialization

elevenoclockROMFunctionCommand

elevenoclockMemoryFunctionCommand

elevenoclockTransaction/Data

+3V-+5V

4.7K

BUSMASTER

R

X

T

X

DS18B201-WIREPORT

5μA

Typ.

R

X

T

X

100OHM

MOSFET

R

X

=RECEIVE

T

X

=TRANSMIT

DS18B20

11of26

INITIALIZATION

Alltransactionsonthe1-Wirebusbeginwithaninitializationsequence.Theinitializationsequence

consistsofaresetpulsetransmittedbythebusmasterfollowedbypresencepulse(s)transmittedbythe

slave(s).

ThepresencepulseletsthebusmasterknowthattheDS18B20isonthebusandisreadytooperate.For

moredetails,seethe“1-WireSignaling”section.

ROMFUNCTIONCOMMANDS

Oncethebusmasterhasdetectedapresence,itcanissueoneofthefiveROMfunctioncommands.All

ROMfunctioncommandsare8bitslong.Alistofthesecommandsfollows(refertoflowchartin

Figure5):

ReadROM[33h]

ThiscommandallowsthebusmastertoreadtheDS18B20’s8-bitfamilycode,unique48-bitserial

number,and8-bitCRC.ThiscommandcanonlybeusedifthereisasingleDS18B20onthebus.Ifmore

thanoneslaveispresentonthebus,adatacollisionwilloccurwhenallslavestrytotransmitatthesame

time(opendrainwillproduceawiredANDresult).

MatchROM[55h]

ThematchROMcommand,followedbya64-bitROMsequence,allowsthebusmastertoaddressa

specificDS18B20onamultidropbus.OnlytheDS18B20thatexactlymatchesthe64-bitROMsequence

willrespondtothefollowingmemoryfunctioncommand.Allslavesthatdonotmatchthe64-bitROM

sequencewillwaitforaresetpulse.Thiscommandcanbeusedwithasingleormultipledevicesonthe

bus.

SkipROM[CCh]

Thiscommandcansavetimeinasingledropbussystembyallowingthebusmastertoaccessthe

memoryfunctionswithoutprovidingthe64-bitROMcode.Ifmorethanoneslaveispresentonthebus

andaReadcommandisissuedfollowingtheSkipROMcommand,datacollisionwilloccuronthebusas

multipleslavestransmitsimultaneously(opendrainpulldownswillproduceawiredANDresult).

SearchROM[F0h]

Whenasystemisinitiallybroughtup,thebusmastermightnotknowthenumberofdevicesonthe1-

Wirebusortheir64-bitROMcodes.ThesearchROMcommandallowsthebusmastertouseaprocess

ofeliminationtoidentifythe64-bitROMcodesofallslavedevicesonthebus.

AlarmSearch[ECh]

TheflowchartofthiscommandisidenticaltotheSearchROMcommand.However,theDS18B20will

respondtothiscommandonlyifanalarmconditionhasbeenencounteredatthelasttemperature

measurement.AnalarmconditionisdefinedasatemperaturehigherthanTHorlowerthanTL.The

alarmconditionremainssetaslongastheDS18B20ispoweredup,oruntilanothertemperature

measurementrevealsanon-alarmingvalue.Foralarming,thetriggervaluesstoredinEEPROMaretaken

intoaccount.IfanalarmconditionexistsandtheTHorTLsettingsarechanged,anothertemperature

conversionshouldbedonetovalidateanyalarmconditions.

DS18B20

12of26

ExampleofaROMSearch

TheROMsearchprocessistherepetitionofasimplethree-steproutine:readabit,readthecomplement

ofthebit,thenwritethedesiredvalueofthatbit.Thebusmasterperformsthissimple,three-steproutine

oneachbitoftheROM.Afteronecompletepass,thebusmasterknowsthecontentsoftheROMinone

device.TheremainingnumberofdevicesandtheirROMcodesmaybeidentifiedbyadditionalpasses.

ThefollowingexampleoftheROMsearchprocessassumesfourdifferentdevicesareconnectedtothe

same1-Wirebus.TheROMdataofthefourdevicesisasshown:

ROM100110101...

ROM210101010...

ROM311110101...

ROM400010001...

Thesearchprocessisasfollows:

1.Thebusmasterbeginstheinitializationsequencebyissuingaresetpulse.Theslavedevicesrespond

byissuingsimultaneouspresencepulses.

2.ThebusmasterwillthenissuetheSearchROMcommandonthe1-Wirebus.

3.Thebusmasterreadsabitfromthe1-Wirebus.Eachdevicewillrespondbyplacingthevalueofthe

firstbitoftheirrespectiveROMdataontothe1-Wirebus.ROM1andROM4willplacea0ontothe

1-Wirebus,i.e.,pullitlow.ROM2andROM3willplacea1ontothe1-Wirebusbyallowingtheline

tostayhigh.TheresultisthelogicalANDofalldevicesontheline,thereforethebusmasterseesa0.

Thebusmasterreadsanotherbit.SincetheSearchROMdatacommandisbeingexecuted,allofthe

devicesonthe1-Wirebusrespondtothissecondreadbyplacingthecomplementofthefirstbitof

theirrespectiveROMdataontothe1-Wirebus.ROM1andROM4willplacea1ontothe1-Wire,

allowingthelinetostayhigh.ROM2andROM3willplacea0ontothe1-Wire,thusitwillbepulled

low.Thebusmasteragainobservesa0forthecomplementofthefirstROMdatabit.Thebusmaster

hasdeterminedthattherearesomedevicesonthe1-Wirebusthathavea0inthefirstpositionand

othersthathavea1.

Thedataobtainedfromthetworeadsofthethree-steproutinehavethefollowinginterpretations:

00Therearestilldevicesattachedwhichhaveconflictingbitsinthisposition.

01Alldevicesstillcoupledhavea0-bitinthisbitposition.

10Alldevicesstillcoupledhavea1-bitinthisbitposition.

11Therearenodevicesattachedtothe1-Wirebus.

4.Thebusmasterwritesa0.ThisdeselectsROM2andROM3fortheremainderofthissearchpass,

leavingonlyROM1andROM4connectedtothe1-Wirebus.

5.Thebusmasterperformstwomorereadsandreceivesa0-bitfollowedbya1-bit.Thisindicatesthat

alldevicesstillcoupledtothebushave0sastheirsecondROMdatabit.

6.Thebusmasterthenwritesa0tokeepbothROM1andROM4coupled.

7.Thebusmasterexecutestworeadsandreceivestwo0-bits.Thisindicatesthatboth1-bitsand0-bits

existasthethirdbitoftheROMdataoftheattacheddevices.

DS18B20

13of26

8.Thebusmasterwritesa0-bit.ThisdeselectsROM1,leavingROM4astheonlydevicestill

connected.

9.ThebusmasterreadstheremainderoftheROMbitsforROM4andcontinuestoaccessthepartif

desired.Thiscompletesthefirstpassanduniquelyidentifiesonepartonthe1-Wirebus.

10.ThebusmasterstartsanewROMsearchsequencebyrepeatingsteps1through7.

11.Thebusmasterwritesa1-bit.ThisdecouplesROM4,leavingonlyROM1stillcoupled.

12.ThebusmasterreadstheremainderoftheROMbitsforROM1andcommunicatestotheunderlying

logicifdesired.ThiscompletesthesecondROMsearchpass,inwhichanotheroftheROMswas

found.

13.ThebusmasterstartsanewROMsearchbyrepeatingsteps1through3.

14.Thebusmasterwritesa1-bit.ThisdeselectsROM1andROM4fortheremainderofthissearchpass,

leavingonlyROM2andROM3coupledtothesystem.

15.ThebusmasterexecutestwoReadtimeslotsandreceivestwo0s.

16.Thebusmasterwritesa0-bit.ThisdecouplesROM3leavingonlyROM2.

17.ThebusmasterreadstheremainderoftheROMbitsforROM2andcommunicatestotheunderlying

logicifdesired.ThiscompletesthethirdROMsearchpass,inwhichanotheroftheROMswasfound.

18.ThebusmasterstartsanewROMsearchbyrepeatingsteps13through15.

19.Thebusmasterwritesa1-bit.ThisdecouplesROM2,leavingonlyROM3.

20.ThebusmasterreadstheremainderoftheROMbitsforROM3andcommunicatestotheunderlying

logicifdesired.ThiscompletesthefourthROMsearchpass,inwhichanotheroftheROMswas

found.

Notethefollowing:

ThebusmasterlearnstheuniqueIDnumber(ROMdatapattern)ofone1-WiredeviceoneachROM

Searchoperation.Thetimerequiredtoderivethepart’suniqueROMcodeis:

960μs+(8+3x64)61μs=13.16ms

Thebusmasteristhereforecapableofidentifying75different1-Wiredevicespersecond.

I/OSIGNALING

TheDS18B20requiresstrictprotocolstoinsuredataintegrity.Theprotocolconsistsofseveraltypesof

signalingononeline:resetpulse,presencepulse,write0,write1,read0,andread1.Allofthesesignals,

withtheexceptionofthepresencepulse,areinitiatedbythebusmaster.

TheinitializationsequencerequiredtobeginanycommunicationwiththeDS18B20isshowninFigure

11.AresetpulsefollowedbyapresencepulseindicatestheDS18B20isreadytosendorreceivedata

giventhecorrectROMcommandandmemoryfunctioncommand.

DS18B20

14of26

Thebusmastertransmits(TX)aresetpulse(alowsignalforaminimumof480μs).Thebusmasterthen

releasesthelineandgoesintoareceivemode(RX).The1-Wirebusispulledtoahighstateviathe5K

pullupresistor.AfterdetectingtherisingedgeontheDQpin,theDS18B20waits15-60μsandthen

transmitsthepresencepulse(alowsignalfor60-240μs).

MEMORYCOMMANDFUNCTIONS

ThefollowingcommandprotocolsaresummarizedinTable4,andbytheflowchartofFigure10.

WriteScratchpad[4Eh]

ThiscommandwritestothescratchpadoftheDS18B20,startingattheTHregister.Thenextthreebytes

writtenwillbesavedinscratchpadmemoryataddresslocations2through4.Allthreebytesmustbe

writtenbeforearesetisissued.

ReadScratchpad[BEh]

Thiscommandreadsthecontentsofthescratchpad.Readingwillcommenceatbyte0andwillcontinue

throughthescratchpaduntilthe9

th

(byte8,CRC)byteisread.Ifnotalllocationsaretoberead,the

mastermayissuearesettoterminatereadingatanytime.

CopyScratchpad[48h]

ThiscommandcopiesthescratchpadintotheE

2

memoryoftheDS18B20,storingthetemperaturetrigger

bytesinnonvolatilememory.Ifthebusmasterissuesreadtimeslotsfollowingthiscommand,the

DS18B20willoutput0onthebusaslongasitisbusycopyingthescratchpadtoE

2

;itwillreturna1

whenthecopyprocessiscomplete.Ifparasite-powered,thebusmasterhastoenableastrongpullupfor

atleast10msimmediatelyafterissuingthiscommand.

ConvertT[44h]

Thiscommandbeginsatemperatureconversion.Nofurtherdataisrequired.Thetemperatureconversion

willbeperformedandthentheDS18B20willremainidle.Ifthebusmasterissuesreadtimeslots

followingthiscommand,theDS18B20willoutput0onthebusaslongasitisbusymakingatemperature

conversion;itwillreturna1whenthetemperatureconversioniscomplete.Ifparasite-powered,thebus

masterhastoenableastrongpullupforaperiodgreaterthant

conv

immediatelyafterissuingthis

command.

RecallE2[B8h]

ThiscommandrecallsthetemperaturetriggervaluesandconfigurationregisterstoredinE

2

tothe

scratchpad.Thisrecalloperationhappensautomaticallyuponpower-uptotheDS18B20aswell,sovalid

dataisavailableinthescratchpadassoonasthedevicehaspowerapplied.Witheveryreaddatatimeslot

issuedafterthiscommandhasbeensent,thedevicewilloutputitstemperatureconverterbusyflag:

0=busy,1=ready.

ReadPowerSupply[B4h]

WitheveryreaddatatimeslotissuedafterthiscommandhasbeensenttotheDS18B20,thedevicewill

signalitspowermode:0=parasitepower,1=externalpowersupplyprovided.

DS18B20

15of26

MEMORYFUNCTIONSFLOWCHARTFigure10

DS18B20

16of26

MEMORYFUNCTIONSFLOWCHARTFigure10(cont’d)

DS18B20

17of26

MEMORYFUNCTIONSFLOWCHARTFigure10(cont’d)

DS18B20

18of26

INITIALIZATIONPROCEDURE“RESETANDPRESENCEPULSES”Figure11

DS18B20COMMANDSETTable4

INSTRUCTIONDESCRIPTIONPROTOCOL

1-WIREBUS

AFTERISSUING

PROTOCOLNOTES

TEMPERATURECONVERSIONCOMMANDS

ConvertTInitiatestemperature

conversion.

44h
status>

1

MEMORYCOMMANDS

ReadScratchpadReadsbytesfrom

scratchpadandreads

CRCbyte.

BEh

WriteScratchpadWritesbytesinto

scratchpadataddresses2

through4(THandTL

temperaturetriggersand

config).

4Eh
ataddr.2through.4>

3

CopyScratchpadCopiesscratchpadinto

nonvolatilememory

(addresses2through4

only).

48h2

RecallE

2

Recallsvaluesstoredin

nonvolatilememoryinto

scratchpad(temperature

triggers).

B8h
status>

ReadPowerSupplySignalsthemodeof

DS18B20powersupply

tothemaster.

B4h

DS18B20

19of26

NOTES:

1.Temperatureconversiontakesupto750ms.AfterreceivingtheConvertTprotocol,ifthepartdoes

notreceivepowerfromtheV

DD

pin,theDQlinefortheDS18B20mustbeheldhighforatleasta

periodgreaterthant

conv

toprovidepowerduringtheconversionprocess.Assuch,nootheractivity

maytakeplaceonthe1-WirebusforatleastthisperiodafteraConvertTcommandhasbeenissued.

2.AfterreceivingtheCopyScratchpadprotocol,ifthepartdoesnotreceivepowerfromtheV

DD

pin,the

DQlinefortheDS18B20mustbeheldhighforatleast10mstoprovidepowerduringthecopy

process.Assuch,nootheractivitymaytakeplaceonthe1-Wirebusforatleastthisperiodaftera

CopyScratchpadcommandhasbeenissued.

3.Allthreebytesmustbewrittenbeforearesetisissued.

READ/WRITETIMESLOTS

DS18B20dataisreadandwrittenthroughtheuseoftimeslotstomanipulatebitsandacommandwordto

specifythetransaction.

WriteTimeSlots

Awritetimeslotisinitiatedwhenthehostpullsthedatalinefromahighlogicleveltoalowlogiclevel.

Therearetwotypesofwritetimeslots:Write1timeslotsandWrite0timeslots.Allwritetimeslots

mustbeaminimumof60μsindurationwithaminimumofa1-μsrecoverytimebetweenindividual

writecycles.

TheDS18B20samplestheDQlineinawindowof15μsto60μsaftertheDQlinefalls.Ifthelineis

high,aWrite1occurs.Ifthelineislow,aWrite0occurs(seeFigure12).

ForthehosttogenerateaWrite1timeslot,thedatalinemustbepulledtoalogiclowlevelandthen

released,allowingthedatalinetopulluptoahighlevelwithin15μsafterthestartofthewritetimeslot.

ForthehosttogenerateaWrite0timeslot,thedatalinemustbepulledtoalogiclowlevelandremain

lowfor60μs.

ReadTimeSlots

ThehostgeneratesreadtimeslotswhendataistobereadfromtheDS18B20.Areadtimeslotisinitiated

whenthehostpullsthedatalinefromalogichighleveltologiclowlevel.Thedatalinemustremainata

lowlogiclevelforaminimumof1μs;outputdatafromtheDS18B20isvalidfor15μsafterthefalling

edgeofthereadtimeslot.ThehostthereforemuststopdrivingtheDQpinlowinordertoreaditsstate

15μsfromthestartofthereadslot(seeFigure12).Bytheendofthereadtimeslot,theDQpinwillpull

backhighviatheexternalpullupresistor.Allreadtimeslotsmustbeaminimumof60μsinduration

withaminimumofa1-μsrecoverytimebetweenindividualreadslots.

Figure12showsthatthesumofT

INIT

,T

RC

,andT

SAMPLE

mustbelessthan15μs.Figure14showsthat

systemtimingmarginismaximizedbykeepingT

INIT

andT

RC

assmallaspossibleandbylocatingthe

mastersampletimetowardstheendofthe15-μsperiod.

DS18B20

20of26

READ/WRITETIMINGDIAGRAMFigure12

DS18B20

21of26

DETAILEDMASTERREAD1TIMINGFigure13

RECOMMENDEDMASTERREAD1TIMINGFigure14

DS18B20

22of26

RelatedApplicationNotes

ThefollowingApplicationNotescanbeappliedtotheDS18B20.Thesenotescanbeobtainedfromthe

DallasSemiconductor“ApplicationNoteBook,”viaourwebsiteathttp://www.dalsemi.com/,orthrough

ourfaxbackserviceat(214)450-0441.

ApplicationNote27:“UnderstandingandUsingCyclicRedundancyCheckswithDallasSemiconductor

TouchMemoryProduct”

ApplicationNote55:“ExtendingtheContactRangeofTouchMemories”

ApplicationNote74:“ReadingandWritingTouchMemoriesviaSerialInterfaces”

ApplicationNote104:“MinimalistTemperatureControlDemo”

ApplicationNote106:“ComplexMicroLANs”

ApplicationNote108:“MicroLAN-IntheLongRun”

Sample1-WiresubroutinesthatcanbeusedinconjunctionwithAN74canbedownloadedfromthe

websiteorourAnonymousFTPSite.

MEMORYFUNCTIONEXAMPLETable5

Example:BusMasterinitiatestemperatureconversion,thenreadstemperature(parasitepowerassumed).

MASTERMODEDATA(LSBFIRST)COMMENTS

TXResetResetpulse(480-960μs).

RXPresencePresencepulse.

TX55hIssue“MatchROM”command.

TX<64-bitROMcode>IssueaddressforDS18B20.

TX44hIssue“ConvertT”command.

TXI/Olineisheldhighforatleastaperiodoftimegreater

thant

conv

bybusmastertoallowconversiontocomplete.

TXResetResetpulse.

RXPresencePresencepulse.

TX55hIssue“MatchROM”command.

TX<64-bitROMcode>IssueaddressforDS18B20.

TXBEhIssue“ReadScratchpad”command.

RX<9databytes>ReadentirescratchpadplusCRC;themasternow

recalculatestheCRCoftheeightdatabytesreceived

fromthescratchpad,comparestheCRCcalculatedand

theCRCread.Iftheymatch,themastercontinues;ifnot,

thisreadoperationisrepeated.

TXResetResetpulse.

RXPresencePresencepulse,done.

DS18B20

23of26

MEMORYFUNCTIONEXAMPLETable6

Example:BusMasterwritesmemory(parasitepowerandonlyoneDS18B20assumed).

MASTERMODEDATA(LSBFIRST)COMMENTS

TXResetResetpulse.

RXPresencePresencepulse.

TXCChSkipROMcommand.

TX4EhWriteScratchpadcommand.

TX<3databytes>Writesthreebytestoscratchpad(TH,TL,andconfig).

TXResetResetpulse.

RXPresencePresencepulse.

TXCChSkipROMcommand.

TXBEhReadScratchpadcommand.

RX<9databytes>ReadentirescratchpadplusCRC.Themasternow

recalculatestheCRCoftheeightdatabytesreceived

fromthescratchpad,comparestheCRCandthetwo

otherbytesreadbackfromthescratchpad.Ifdatamatch,

themastercontinues;ifnot,repeatthesequence.

TXResetResetpulse.

RXPresencePresencepulse.

TXCChSkipROMcommand.

TX48hCopyScratchpadcommand;afterissuingthiscommand,

themastermustwait10msforcopyoperationto

complete.

TXResetResetpulse.

RXPresencePresencepulse,done.

DS18B20

24of26

ABSOLUTEMAXIMUMRATINGS

VoltageonAnyPinRelativetoGround-0.5Vto+6.0V

OperatingTemperature-55°Cto+125°C

StorageTemperature-55°Cto+125°C

SolderingTemperature260°Cfor10seconds

Thisisastressratingonlyandfunctionaloperationofthedeviceattheseoranyotherconditionsabove

thoseindicatedintheoperationsectionsofthisspecificationisnotimplied.Exposuretoabsolute

maximumratingconditionsforextendedperiodsoftimemayaffectreliability.

RECOMMENDEDDCOPERATINGCONDITIONS

PARAMETERSYMBOLCONDITIONMINTYPMAXUNITSNOTES

SupplyVoltageV

DD

LocalPower3.05.5V1

DataPinDQ-0.3+5.5V1

Logic1V

IH

2.2V

CC

+0.3V1,2

Logic0V

IL

-0.3+0.8V1,3,7

DCELECTRICALCHARACTERISTICS(-55°Cto+125°C;V

DD

=3.0Vto5.5V)

PARAMETERSYMBOLCONDITIONMINTYPMAXUNITSNOTES

ThermometerErrort

ERR

-10°Cto

+85°C

±?°C

-55°Cto

+125°C

±2

InputLogicHighV

IH

LocalPower

ParasitePower

2.2

3.0

5.5V

V

1,2

1,2

InputLogicLowV

IL

-0.3+0.8V1,3,7

SinkCurrentI

L

V

I/O

=0.4V-4.0mA1

StandbyCurrentI

DDS

7501000nA6,8

ActiveCurrentI

DD

11.5mA4

DQ-InputLoadCurrentI

DQ

5μA5

ACELECTRICALCHARACTERISTICS:NVMEMORY

(-55°Cto+125°C;V

DD

=3.0Vto5.5V)

PARAMETERSYMBOLCONDITIONMINTYPMAXUNITSNOTES

NVWriteCycleTimet

wr

210ms

DS18B20

25of26

ACELECTRICALCHARACTERISTICS:(-55°Cto+125°C;V

DD

=3.0Vto5.5V)

PARAMETERSYMBOLCONDITIONMINTYPMAXUNITSNOTES

Temperature

Conversion

t

CONV

9-bit93.75ms

Time10-bit187.5

11-bit375

12-bit750

TimeSlott

SLOT

60120μs

RecoveryTimet

REC

1μs

Write0LowTimer

LOW0

60120μs

Write1LowTimet

LOW1

115μs

ReadDataValidt

RDV

15μs

ResetTimeHight

RSTH

480μs

ResetTimeLowt

RSTL

480μs9

PresenceDetectHight

PDHIGH

1560μs

PresenceDetectLowt

PDLOW

60240μs

CapacitanceC

IN/OUT

25pF

NOTES:

1.Allvoltagesarereferencedtoground.

2.Logiconevoltagesarespecifiedatasourcecurrentof1mA.

3.Logiczerovoltagesarespecifiedatasinkcurrentof4mA.

4.ActivecurrentreferstoeithertemperatureconversionorwritingtotheE

2

memory.WritingtoE

2

memoryconsumesapproximately200μAforupto10ms.

5.Inputloadistoground.

6.Standbycurrentspecifiedupto70°C.Standbycurrenttypicallyis3μAat125°C.

7.Toalwaysguaranteeapresencepulseunderlowvoltageparasitepowerconditions,V

ILMAX

mayhave

tobereducedtoasmuchas0.5V.

8.TominimizeI

DDS

,DQshouldbe:GND≤DQ≤GND+0.3VorV

DD

–0.3V≤DQ≤V

DD

.

9.Underparasitepower,themaxt

RSTL

beforeapoweronresetoccursis960μS.

DS18B20

26of26

献花(0)
+1
(本文系李 林917首藏)