1of26032703INTRODUCTIONThe1-WirecommunicationprotocolcanbegeneratedwithanIOpinonamicroprocessor;however,caremustbetakentoprovidethecorrecttimingandproperslewratestocreateareliable1-Wirenetwork.
Impropertimingsentbythe1-Wiremastermaycausecommunicationwith1-Wireslavedevicestobeintermittentorfailaltogether.
Uncontrolledslewratescanseverelylimitthelengthofanetworkandcreatesporadicbehavior.
IfaserialcommunicationUARTisavailable,usingaserial-to-1-Wirebridge(DS2480B)willeliminatetheseproblems.
TheDS2480Bisaserialbridgetothe1-Wirenetworkprotocol.
ThisbridgeallowsanyhostwithaverymodestserialcommunicationUARTtogenerateproperlytimedandslewcontrolled1-Wirewaveforms.
TheDS2480Breceivesescapedcommandsanddata,performs1-Wireoperations,andreturnstheresultbacktothehost.
SeeFigure1forasimplifieddiagramoftheDS2480Bconfiguration.
ImplementationofthisprotocolandnavigatingtheavailableDS2480Bcommandscanbetimeconsumingandconfusing.
Thisguideidentifiescommon1-WireoperationsandexplainstheconstructionofinputserialpacketsandinterpretationofoutputserialpacketsfortheDS2480B.
ThisdocumentisdesignedtocomplementtheDS2480Bdatasheet,butnotreplaceit.
Thedatasheetcanbefoundonhttp://www.
maxim-ic.
com/quick_view2.
cfm/qv_pk/2923.
DS2480BUSAGE(SIMPLIFIED)Figure1TheminimumhostUARTthatwillworkwiththisbridgemustsupport8-bit,non-parity,9600baud(bitspersecond)communication.
Fasterdataratesupto115200baudcanbenegotiatedbutthebridgestartsat9600baudwhenpoweringup.
ElectricalconsiderationssuchasRS232areaddressedinDS2480Bdatasheet.
THE1-WIREINTERFACETheDS2480Bisonlyusefulifallofitscommandsandmodescanbetranslatedintoa1-Wirecommunicationinterfacethatapplicationscanuseandbuildupon.
Thereareafewbasic1-Wirefunctionsthatanapplicationmusthaveinordertodoany1-Wireoperation.
Thisfirstoperationresetsallofthe1-Wireslavesonthebusreadyingthemforacommandfromthe1-Wiremaster.
Thesecondwritesabitfromthe1-Wiremastertotheslavesandthethirdreadsabitfromthe1-Wireslaves.
Sincethe1-Wiremastermuststartall1-Wirebitcommunication,a'read'istechnicallya'write'ofaonebitwiththeresultsampled.
Almostallother1-Wireoperationscanbeconstructedfromthesethreeoperations.
Forexample,abytewrittentothe1-Wirebusisjusteightsinglebitwrites.
The1-WireSearchAlgorithm(SeeApplicationNote187athttp://www.
maxim-ic.
com/appnotes.
cfm/an_pk/187)canalsobeconstructedusingtheseprimitives.
Thisisnotnecessarilythemostefficientimplementationmethod,however.
TheDS2480BincorporatesasearchacceleratormodethatgreatlyreducestheserialApplicationNote192UsingtheDS2480BSerial1-WireLineDriver1-WiremasterDS2480B(serialbridge)1-WirebusRXDHOSTUART(morPC)TXD1-Wireslave1-Wireslave1-WireisaregisteredtrademarkofDallasSemiconductor.
AN1922of26communicationrequiredtodoasearch.
Itisalsomoreefficienttobundlegroupsofbitcommunicationintobytesandevenblocksofbytes.
Wheneverpossible,anapplicationshouldusethelargestgroupingofcommands(biggestpackets)formaximumefficiency.
Table1isaminimalinterfaceofefficient1-Wirefunctions.
Theoperationnameisprovidedasalabeltotheparticularoperationandwillbeusedthroughtheremainderofthisdocument.
BASIC1-WIREOPERATIONSTable1OperationDescriptionOWResetSendthe1-Wireresetstimulusandcheckfor1-Wireslavedevicepresencepulses.
OWWriteBit/OWReadBitSendorreceiveasinglebitofdatatothe1-Wirebus.
OWWriteByte/OWReadByteSendorreceiveasinglebyteofdatatothe1-Wirebus.
OWBlockSendandreceivemultiplebytesofdatatoandfromthe1-Wirebus.
OWSearchPerformthe1-WireSearchAlgorithm(seeApplicationNote187).
Therearealsoextended1-Wirefunctionsthatarenotcoveredinthebasicoperations.
Some1-Wireslavedevicescanoperateattwodifferentcommunicationspeeds:standardandoverdrive.
Alldevicesatleastsupportstandard.
Overdriveisapproximately10timesfasterthanstandard.
TheDS2480Bsupportsboth1-Wirespeeds.
1-Wiredevicesnormallyderivesomeoralloftheiroperatingenergyfromthe1-Wirebus.
Howeversomedevicesrequireadditionalpowerdeliveryataparticularplaceintheprotocol.
Forexample,adevicemayneedtodoatemperatureconversionorcomputeanSHA-1hash.
Thispowerissuppliedbyenablingastrongerpulluponthe1-Wirebus.
Normalcommunicationcannottakeplaceduringthispowerdelivery.
TheDS2480Bhasseveraladvancedfeaturestoprovidepowerdelivery.
EPROM(one-time-programmable)1-Wirememorydevicesrequireaspecial12Vpulsewhenwriting.
IftheDS2480Bhas12Vavailablethenitcanbetoldtodeliverapulseontothe1-WirebusforEPROMprogramming.
Table2liststheextended1-Wireoperationsfor1-Wirespeed,powerdelivery,andprogrammingpulse.
EXTENDED1-WIREOPERATIONSTable2OperationDescriptionOWSpeedSetthe1-Wirecommunicationspeed.
Thechoiceisstandardoroverdrivespeed.
Notethatthisonlychangesthecommunicationspeedofthe1-Wiremaster;the1-Wireslavedevicemustbeinstructedtomaketheswitchwhengoingfromnormaltooverdrive.
The1-Wireslavewillalwaysreverttostandardspeedwhenitencountersastandardspeed1-Wirereset.
OWLevelSetthe1-Wirepowerlevel(normalorpowerdelivery).
OWProgramPulseSendsatimed12VprogrammingpulseforEPROM1-Wiredevicewriting.
OWReadBitPowerReadasinglebitofdatafromthe1-Wirebusandoptionallyapplypower-deliveryimmediatelyafterthebitiscomplete.
OWWriteBytePowerSendasinglebyteofdatatothe1-Wirebusandapplypower-deliveryimmediatelyafterthebyteiscomplete.
AN1923of26Thisdocumentpresentsanefficientimplementationofthebasicandextended1-WireoperationsusingtheDS2480B.
Theseoperationsprovideacompletefoundationtoperformallfunctionsforcurrentandfuture1-Wiredevices.
Abstractingthe1-Wireoperationsinthisfashionleadsto1-Wireapplicationsthatareindependentofthe1-Wiremastertype(seeExample1).
NotethatthisimplementationisnottheonlyonepossibleanddoesnotnecessarilyutilizealloftheDS2480B'sfeatures.
More1-Wireusageexamplesarepresentedattheendofthisdocument.
READMEMORYPSEUDOCODEExample1trans_block–temporarytransmitbuffer,valuesexpressedinhexadecimalnotation//resetthe1-WirebusIfOWReset=TRUE//senttheMATCHROMsequenceforthedevicetoread,ROMisR0.
.
.
R7trans_block=55,R0,R1,R2,R3,R4,R5,R6,R7OWBlock(trans_block)//sendtheReadMemorycommand,address(0),//and32readbytesforthepageofdatatrans_block=F0,00,00,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FFOWBlock(tran_block)//page0dataisnowinlast32bytesoftrans_block.
.
.
Else//nodevicepresent.
.
.
EndIFHOSTCONFIGURATIONThehostoftheDS2480BmusthaveaUARTthatcanatleastsupport8-bit,non-parity,9600baudcommunication.
ConfigurationofthehostUARTisplatformspecificsoisnotcoveredbythisdocument.
Itmust,however,providestandardinterfaceoperationsincludedreadingandwriting,flushinganypendingreads/writes,issuingabreak,andoptionallychangingthebaudrate.
Table3providesalistofoperationtermstodescribeaninterfacetoagenerichostUART.
ThesetermswillbeusedtodescribeoperationsdonetotheUART.
REQUIREDHOSTUARTOPERATIONSTable3OperationDescriptionBreakSendsaBREAKonthecommunicationportforatleast2ms.
FlushAllowsanypendingwriteoperationstocompleteandclearinput(read)buffer.
ReadReadaspecifiednumberofbytesfromtheserialport.
Provideasufficientlylongtimeouttoensurethatallbytesarereceivedundernormalconditions.
WriteWriteaspecifiednumberofbytestotheserialport.
Returnafterallofthebyteshavebeenwritten.
SetBaudChangestheserialBAUDratetotheratespecified.
(Optionalifoverdriveneeded.
)DelayDelaysatleastthespecifiednumberofmilliseconds.
AN1924of26A'C'codeimplementationofthisapplicationnoteusingtheMicrosoftWindows32-bitoperatingsystemRS232serialportwithaDS9097Uadapterasthehostcanbedownloadedfromthefollowinglink:http://files.
maxim-ic.
com/sia_bu/public/an192.
zip.
This'C'codeimplementationisasimplifiedversionoftheoneprovidedinthe1-WirePublicDomainkit.
The1-WirePublicDomainkitalsocontainsdevicespecificmodulesandexamplesandcanbefoundatthefollowinglink:http://www.
maxim-ic.
com/products/ibutton/software/tmex/.
DS2480BCONFIGURATIONBeforeany1-Wireoperationscanbeattempted,thehostmustsetupandsynchronizewiththeDS2480BSerial1-Wirelinedriver.
Thissetupandsynchronizationprocedureisalsodoneifacommunicationproblemiseverdetectedbetweenthehostandthebridge.
TheDS2480Brequires9600baudduringsetup.
Aftersetupthebaudratecanbenegotiatedupto115200baud.
Caremustbetaken,however,sincetheDS2480Bonlyhasaonebyteinputbuffer.
Theprovided1-Wirecommandmustbeabletocompletebeforethenextcommandisshiftedin.
SeeTable7intheDS2480Bdatasheettoseewhatcommandswillworkatwhatbaudrates.
DS2480B_DetectSincetheDS2480Bdoesnothaveacrystalitmusttuneitstime-basebysamplingtheserialcommunicationsentbythehost.
ThissetupsequenceisinitiatedbyresettingtheDS2480Bandthensendingapredefinedtimingbyte.
Resettingthedevicewillresultinallofthe1-Wireconfigurationparametersbeingresettotheirdefaultstate.
Forgoodperformanceonsmalltomediumlength1-Wirenetworks,itisrecommendedthattheDS2480Bbeusedin'flex'modewhendoingstandardspeedcommunication.
The1-Wireconfigurationparametersareusedtoshapethe1-Wiresignalinflexmode.
Consequently,whenevertheDS2480Bisreset,theconfigurationparametersneedtobereloaded.
ThedesiredflexsettingsarePDSRC=1.
37V/ms,W1LD=10ms,DSO/W0RT=8ms.
ThisresetandconfigurationsequenceiscombinedintoonoperationcalledDS2480B_Detect.
TheDS2480Bisresetifitdetectsaspaceinthestop-bitposition.
Theeasiestwaytogeneratethisiswithaserialbreaklongerthana9600baud8-bitword.
IfbreakisnotavailableonthehostUARTthenswitchingtoaslowerbaudrateandsendingazerobytecansimulateabreak.
Switchingtospaceparityorchangingtoa9-bitwordlengthwithazerointhemostsignificantbitcanalsosimulateabreak.
Someofthedelayvaluesintheconfigurationsequence(seeFigure2)arearbitrarilylargetoaccommodatemostUARTS.
Thesevaluescanbereduced.
Thereadbaudrateregisterandwrite1-WirebitattheendofthesetupsequenceisdesignedtomeasurethecorrectfunctioningoftheDS2480Bsetup.
Ifeitheroneofthoseoperationsreturnsaninvalidresponsethenthesetupisdeemedunsuccessful.
NotethatthisimplementationdoesnotcheckfortheunsolicitedpresencepulsenotificationbytefromtheDS2480B.
Thismaycauseanyofthe1-WireoperationstogetanimproperlyformattedresponsebyteleadingtothecalltotheDS2480B_Detectfunction.
Sinceany1-Wireapplicationthatisusedinanintermittentcontactenvironmentthatwouldproducetheseunsolicitedpresencepulsenotificationsmustalreadyincorporateretries,thisdoesnotpresentaproblem.
AN1925of26DS2480B_DETECTFLOWFigure2Setbaudto9600Sendbreak(2ms)Delay(2ms)FlushWritetimingbyte(C1hex)Delay(2ms)ConstructPacket:SetPDSRC=1.
37V/msSetW1LD=10msSetDSO/W0RT=8msReadBaud(RBR)Senda1-WirebitWritethepacketandreceivethe5-byteresponseFlushPacketreceivedandvalidYesNoDS2480BPresentDS2480BNOTPresentOutboundPacket(toDS2480B)setPDSRCsetW1LDsetDSO/W0RTreadRBR1-WireBit17(hex)455B0F91ResponsePacket(fromDS2480B)responsePDSRCresponseW1LDresponseDSO/W0RTreadRBRresponse1-WireBitresult16445A0093StartAN1926of26DS2480B_ChangeBaudTochangethecommunicationspeedbetweentheHOSTandtheDS2480B,theRBR(RS232BaudRate)registermustbewritten.
TheDS2480BimmediatelyrespondswiththesetbaudrateresponseatthenewbaudratebutitislikelytobemissedbytheHOST.
Consequently,therecommendedflowasseeninFigure3hastheresponsebyteflushedandignored.
AfterboththehostandtheDS2480Bhaveswitchedbaudrates,thebaudrateregisterisreadbacktoverifycompletion.
IftheDS2480Bisnotatthecorrectbaudrate,thereadbackwillfailandthesetupinitializationsequenceDS2480B_Detectiscalled.
TheDS2480Bcanoperateonfourdifferentbaudrates:9600,19200,57600,and115200.
SincetheDS2480Bhasonlyaone-bytebuffer,thecommandsentmustbecompletebeforethenextcommandarrives.
Figure7inthedatasheetshowswhatoperationscanbeperformedatwhatbaudrateswithoutdangerofoverwritingcommands.
Itisrecommendedthatthe1-Wireresetresultshouldalwaysbereceivedbeforeproceedingtothenextcommandsodonotincludeitinacontinuousbytestream.
Thisimplementationsplitsthe1-WireresetoffintoitsownoperationOWResetsothisisnotanissue.
Similarly,thesinglebitandsinglebyteoperationsarealsosplitintotheirownoperations:OWReadBit,OWWriteBit,OWReadByte,andOWWriteByte.
Sincetheyarenotstreamedwithothercommands,themaximumbaudratecanbeused.
Alsonotethatthisimplementationonlyusesflexmodewithextendedbittimingwhendoingstandardspeed1-Wirecommunicationwhichaffectstheallowedbaudrates.
SeeTable4forthebaudraterecommendations.
Forsimplicity,thisimplementationwilluseonlytwobaudrates:9600baudforstandardspeed(flex)operationsand115200baudfornon-searchoverdriveoperations.
MAXIMUMSTREAMINGBAUDRATESTable4FunctionStandard(Flex)OverdriveSearch(OWSearch)9600(baud)57600Command(allnon1-Wireoperations)115200115200Data(OWBlock)9600115200AN1927of26DS2480B_CHANGEBAUDFLOWFigure3AddsetbaudrateRBRtooutboundpacketSetBaudtonewbaudDelay(5ms)FlushWritereadbaudratecommandRBR(0Fhex)andget1byteresponseDS2480BMode=commandYesNoAddcommandselecttooutboundpacket,E3hexWritethepacketandignoreanyresponseDelay(5ms)FlushReadRBRreceivedandvalidYesNoDS2480BatnewbaudFailtogetDS2480BtonewbaudOutboundPacket(toDS2480B)Commandmode(optional)setbaudrateRBRE3(hex)0111bbb1(binary)ResponsePacket(fromDS2480B)(ignored)bbbbaud00096000011920001057600011115200OutboundPacket(toDS2480B)ReadbaudrateRBR0F(hex)ResponsePacket(fromDS2480B)RBRregisterresult0000bbb0(binary)bbbbaud00096000011920001057600011115200StartDS2480B_DetectAN1928of261-WIREOPERATIONSThebasicandextended1-Wireoperationscreateacommon1-Wireinterfacethatfacilitatesanyoperationonany1-Wiredevice.
Theimplementationforeachofthese1-Wireoperationshassomecommonfeatures.
ThecommandsanddataaregroupedtogetherwheneverpossibletoreducethenumberofpacketsexchangedwiththeDS2480B.
ThecurrentmodeoftheDS2480Biskeptasstatesoapacketmaystartwithamodechangingcommand.
Iftheresponsepacketisnotthecorrectlengthorisinanimproperformat,theDS2480B_Detectsequenceiscalled.
TheonlychangeintheserialcommunicationratebetweenthehostandtheDS2480BisdoneinOWSpeedwhenchangingthe1-Wirecommunicationspeed.
Asitisimplemented,OWSearchcannotberuninoverdrivemode.
Asimplecheckcouldbeaddedtoreducethebaudrateto57600baudwhendoingasearchatthefastercommunicationrate.
Every1-Wireoperationshouldfirstmakesurethatthecurrentlevelpullupisnormal.
SoeachflowstartswithanimplicitcalltoOWLevel(normal).
OWResetTheOWResetoperationinstructstheDS2480Btosendaresetpulsetothe1-Wireandsampletodetectthepresencepulsesfrom1-Wireslavesonthebus.
Whiletheprimarypurposeofthisinstructionistoperformthisresetoperation,italsoreturnsotherusefulinformation.
Italsoprovidesathree-bitfieldthatindicatestheversionofthechip.
TheversionfieldwillbeconstantwithallDS2480Bs,howeveritcanbeusedtodetectthepredecessortothisbridge,theDS2480.
ThisimplementationiscompatiblewiththeDS2480.
Also,maskingoffthisfieldwillmakethehostsoftwareorfirmwareatleastpartiallycompatibletofuturebridgeversions.
The1-Wireresetcommandoperationtakesinthecommunicationspeed.
Notethatwhencommunicatinginstandard1-Wirespeed,theDS2480Bflexmodeisusedinthisimplementation.
Thetimethatthisoperationtakestocompletedependsonwhetherthereisanalarmpresence.
Thisisthemainreasonwhythisoperationisnotgroupedinpacketswithother1-Wireoperations.
Notetheextra5msdelayandflushifaDS1994*orDS2404*devicecouldbeonthe1-Wirebus.
TheDS2480Bdoesnothandleallofthe1-Wireresetalarmtypesfromthesedevicesandcommunicationmustbedelayeduntiltheyarecomplete.
SeeFigure4fortheflowofthisoperation.
*TheDS1994andDS2404arenolongerrecommendedfornewdesigns.
AN1929of26OWRESETFLOWFigure4ResetresponsevalidYesNoStandardspeedandDS1994NoYesAddflexoroverdrive1-WireresettopacketFlushDS2480BMode=commandYesNoAddcommandselecttooutboundpacket,E3hexOutboundPacket(toDS2480B)Commandmode(optional)1-WireresetcommandE3(hex)1100ss01(binary)ResponsePacket(fromDS2480B)1-Wireresetresult11xvvvrr(binary)ssSpeed01standard(flex)10overdriverrResetresult001-Wireshorted01presence10alarmpresence11nopresenceWritethepacketandreceivethe1-byteresponseReturnresetresultReturn1-WireresetfailurexUndefinedbitvvvDS2480version010DS2480011DS2480B100(future)Delay(5ms)FlushDS2480B_DetectStartReturn1-WireresetpresentAN19210of26OWWriteBit/OWReadBitPerformingasinglebitoperationonthe1-Wireisunusualbutisincludedhereforcompleteness.
Whentheprotocolindicatesawritebitthenthevalueisjustwrittentothe1-WireasseeninFigure5.
Ifareadisrequiredthenawrite-oneisdoneandtheresultsampledisthereadresult.
OWWRITEBIT/OWREADBITFLOWFigure51-WirebitresponsevalidYesNoAddbitcommandtopacketFlushDS2480BMode=commandYesNoAddcommandselecttooutboundpacket,E3hexOutboundPacket(toDS2480B)Commandmode(optional)send1-WirebitE3(hex)100dss01(binary)ResponsePacket(fromDS2480B)1-Wirebitresult100dssrr(binary)ssSpeed01standard(flex)10overdriverrbitresult000readback111readbackWritethepacketandreceivethe1-byteresponseReturn1-WirebitresultdDatatosend0write0bit1write1orreadbitReturn1-WirebitfailureDS2480B_DetectStartAN19211of26OWWriteByte/OWReadByte/OWBlockThesingleandmultiplebyteoperationsareverysimilar.
TheDS2480Bmustfirstbeputintodatamode.
Likethesinglebitcommands,whentheprotocolindicatesawritebytethenthedataisjustwritten.
AreadbyteisdonebywritingaFFhex(allones)andthenthesampleddataisthereadresult.
Ablockoperationisagroupofsinglebyteoperationsthatmaybeamixtureofreadsandwrites.
Thereadpositionsmustbepre-filledwithFF'shex.
Caremustbetakentoalwaysduplicatedatabytesthatarethesameastheswitchtocommandmodecommand(E3hex).
ThisinstructstheDS2480Btotreatitasdataandnottheswitchtocommandmode.
OWWRITEBYTE/OWREADBYTE/OWBLOCKFLOWFigure6ResponselengthvalidYesNoAdddatabyte(s)topacket,duplicateE3'sFlushDS2480BModeDataYesNoAdddatamodeselecttooutboundpacket,E1hexOutboundPacket(toDS2480B)Datamode(optional)1-Wiredatabyte1-WiredatabyteE1(hex)(databyte1)(databyteN)ResponsePacket(fromDS2480B)1-Wiredatabytereturn1-Wiredatabytereturn(databyte1)(databyteN)WritethepacketandreceivetheresponseReturn1-WiredataresponseReturnfailure1-WiredatafailureDS2480B_DetectStartAN19212of26OWSearchThesearchalgorithmisabinarytreesearchwherebranchesarefolloweduntiladeviceROMnumber,orleaf,isfound.
Subsequentsearchesthentaketheotherbranchpathsuntilalloftheleavespresentarediscovered.
Thesearchalgorithmbeginswiththedevicesonthe1-Wirebeingresetusingtheresetandpresencepulsesequence(seeOWReset).
Ifthisissuccessfulthenthe1-bytesearchcommandissent(normalF0hexoralarmEChex).
Thesearchcommandreadiesthe1-Wiredevicestobeginthesearch.
Followingthesearchcommand,theactualsearchbeginswithalloftheparticipatingdevicessimultaneouslysendingthefirstbit(leastsignificant)intheirROMnumber(alsocalledregistrationnumber).
Aswithall1-Wirecommunication,the1-Wiremasterstartseverybitwhetheritisdatatobereadorwrittentotheslavedevices.
Whenalldevicesrespondatthesametime,theresultwillbealogicalANDofthebitssent.
AfterthedevicessendthefirstbitoftheirROMnumber,themasterinitiatesthenextbitandthedevicesthensendthecomplementofthefirstbit.
Ifbothbitsarezerothenthereareboth1sand0sinthatbitposition.
Thisiscalledadiscrepancyandisabranchpointinthesearch.
The1-Wiremasterthenwritesasearchdirectionbit.
Ifthedevicehasthatbitvalueitwillcontinueparticipatinginthesearch,allotherdevicesgointoawaitstate.
This'readtwobits'and'writeonebit'patternisthenrepeatedfortheremaining63bitsoftheROMnumber.
SeeApplicationNote187,1-WireSearchAlgorithm,athttp://www.
maxim-ic.
com/appnotes.
cfm/an_pk/187fordetailsontheoperationofthe1-Wiresearchandselectivesearchoptions.
Thebasicsearchoperationsincludefindingalldevicesonthe1-Wirenetwork.
Theselectivesearchoperationsallowsearchesthatfindonlyaparticularfamilyof1-Wiredevices.
Alargepartofthe1-WiresearchisperformedbytheDS2480B.
TheflowofthesearchsequencecanbeseeninFigure7.
Theoutboundsearchdataisconstructedbasedonthelastsearch(seeFigures8and9),thesearchisperformed,andthenthesearchresponsedataisparsed(seeFigures10and11).
CaremustbetakentonotrunOWSearchinoverdriveusingthisimplementationofOWSpeedsinceituses115200baud,whichwilloverflowtheDS2480Binputbuffer.
Thiscouldbeeasilymodifiedtoreducethebaudrateto57200whendoingoverdrivesearches.
AN19213of26OWSEARCHFLOWFigure7OWReset,devicefoundYesNoReturnnodevicesfoundDevicefoundfromsearchYesNoAdddatamodeandsearchcommandF0(orEC)hextooutboundpacket.
Alsoadd'searchaccelerator'datasequence.
(seeFigures8and9)OutboundPacket(toDS2480B)DatamodeSearchcmdCmdmodeSearchAcceleratoronE1(hex)F0E31011ss01(binary)Datamode1-Wiresearchdatabyte1-WiresearchdatabyteCmdmodeSearchAcceleratoroffE1(hex)(databyte0)(databyte15)E31010ss01(binary)ResponsePacket(fromDS2480B)Echoofsearchcmd1-Wiresearchdatabytereturn1-WiresearchdatabytereturnF0(databyte0)(databyte15)Writethe22bytepacketandreceivethe17byteresponsessSpeed01standard(flex)10overdriveFlushExtracttheROMandsearchinformationfromresponsepacket(seeFigures10and11)ReturnnodevicesfoundReturndevicefoundStartResponselength+formatvalidYesNoDS2480B_DetectAN19214of26Thestateofthe1-Wiresearchmustbemaintainedbetweensearchestofindsubsequentdevices.
ThetermsrepresentingthesearchstatearepresentedinTable5andcoincidewiththetermsusedinApplicationNote187,The1-WireSearchAlgorithm.
SEARCHSTATETable5TermDescriptionid_bit_numberTheROMbitnumber1to64currentlybeingsearched.
LastDeviceFlagFlagtoindicateprevioussearchwasthelastdevice.
LastDiscrepancyBitindexthatidentifiesfromwhichbitthe(next)searchdiscrepancycheckshouldstart.
LastFamilyDiscrepancyBitindexthatidentifiestheLastDiscrepancywithinthefirst8-bitfamilycodeofROMnumber.
ROM_NO8-bytebufferthatcontainsthecurrentROMregistrationnumberdiscovered.
search_directionBitvalueindicatingthedirectionofthesearch.
Alldeviceswiththisbitstayinthesearchandtherestgointoawaitstatefora1-Wirereset.
1-WireSearchDataConstructionThe16bytesof1-Wiresearchdatainputcanbeconsidered128bitsofdata.
Thedataisgroupedinto642-bitpairs.
Thefirstbitisnotusedandshouldbe0.
Thesecondbitisthesearchdirectionusedifadiscrepancyisdetected.
IfadiscrepancyisnotdetectedthentheDS2480Bwillautomaticallyproceedwiththeonlyavailablepath.
Whenconstructingtheoutbounddata,setthesearchdirectionbitstotheROM_IDbitsfromtheprevioussearchupuntilthelastdiscrepancybitposition.
Atthatpoint,setthesearchdirectiontooneandthereaftersetthemalltozero.
SeeFigure8forthedataformatandFigure9fortheconstructionflow.
OUTBOUNDSEARCHDATAFigure8302r1*104r2L-10L**112701280*ROM_IDbitscorrespondingtotheid_bit_numberfromaprevioussearch**LastDiscrepancybitpositionAN19215of26OWSEARCH:OUTBOUNDSEARCHDATACONSTRUCTIONFigure9Clearthe128-bits(16-bytes)ofsearchdata.
Setid_bit_numberto1.
Startid_bit_number64NoYes1-WireSearchDatacompleteAN19216of261-WireSearchDataParsingThedataresultingfromthe1-WiresearchfromtheDS2480Bareagain16bytesofdatarepresenting64two-bitpairs.
Thefirstbitineachpairisaflagindicatingifthisbitpositionencounteradiscrepancyrequiringtheuseofthesearchdirectionbitprovided.
ThesecondbitineachpairisthesearchdirectiontakenwhichisabitoftheresultingROMnumberofthedevicefoundinthesearch.
TheformatcanbeseeninFigure10.
ThediscrepancyflagsandthesearchdirectiontakenisparsedtosetthesearchstateasseeninFigure11.
SEARCHDATARESPONSEFigure103d22r1*1d1**4r2127d64128r64*newROM_IDbitscorrespondingtotheid_bit_numberfromthissearch**1ifdiscrepancyoccurredinthisbitposition,thehighestzeropositionisthenewLastDiscrepancyAN19217of26OWSEARCH:RESPONSESEARCHDATAPARSINGFigure11Retrieve(16-bytes)ofsearchdata.
Setid_bit_numberto1.
Startdiscrepancy=1andROM_ID=0NoYesSetLastDescrepancytotheid_bit_numberIncrementid_bit_numberid_bit_number64NoYesSetLastFamily-Discrepancytoid_bit_numberRetrievethenewROM_IDbitLastDiscrepancyLastFamilyDiscrepancyequalYesNoResetSearchLastDiscrepancy=0LastFamilyDiscrepancy=0LastDeviceFlag=0CRCofROM_IDvalidYesNoSetLastFamily-Discrepancyto0Last-Discrepancy=0NoYesSetLastDeviceFlagtotrueParsecompletedeviceNOTfoundAN19218of26OWSpeedTotakeadvantageofhigherthroughputofoverdrive1-Wirespeed,thebaudrateoftheserialcommunicationbetweenthehostandtheDS2480Bisincreased.
Thisimplementationusesonlytwobaudrates:9600forstandardspeedand115200foroverdrivespeednon-searchoperations.
AsearchacceleratoroffoperationisdonetosettheDS2480Btothenew1-Wirespeed.
Thisisincludedsothatevenifthenext1-Wireoperationistocommunicatebytesindatamode,thecorrectspeedwillbeused.
Seethe1-WirespeedflowinFigure12.
OWLevelTheprimarypurposeoftheOWLeveloperationistodisablethepreviouslyenabledstrongpulluppowerdeliverythatwasinitiatedfromacalltoOWReadBitPowerorOWWriteBytePower.
Thesecondarypurposeistomanuallyturnonstrongpulluppowerdeliverywithoutthearmfeature,althoughthisisnotusedoften.
TheallowedcallstothisoperationareOWLevel(normal)andOWLevel(power).
NotethatacalltoOWLevel(normal)isassumedtobeatthebeginningofall1-Wireoperationstoensurethatthe1-Wirepullupisinthenormalstate.
Todisableanarmedandcurrentinfinitepulseitisnecessarytoterminatethepulse,startanewpulsewithoutarmenabledandthenterminatethatpulse.
TheOWLevel(power)operationbeginsanewnon-armedinfinitepulse.
SeeFigure13fortheflowofthesetwooperations.
OWProgramPulseTheOWProgramPulseoperationdeliversa12-Voltprogrammingpulsetothe1-Wire.
Thisoperationisusedtoprogram1-WireEPROM(One-Time-Programmable)memorydevices.
Itcheckstoseewhethertheprogrammingvoltageisavailablebasedontheinformationderivedfromthelast1-WireresetoperationOWReset.
SeeFigure14fortheflowofthisoperation.
AN19219of26OWSPEEDFLOWFigure12DS2480B_ChangeBaudto115200(ormax)AddSearchAcceleratorOffwithnewspeedtooutboundpacketNewSpeedisoverdriveYesNoDS2480B_ChangeBaudto9600OutboundPacket(toDS2480B)Commandmode(optional)SearchAcceleratoroffE3(hex)1010ss01(binary)ResponsePacket(fromDS2480B)(none)Writethepacket,noresponseReturnsuccessStartChangeinSpeedYesNoDoneDS2480BMode=commandYesNoAddcommandselecttooutboundpacket,E3hexFlushssSpeed01standard(flex)10overdriveAN19220of26OWLEVELFLOWFigure13ResponsevalidYesNoAddtooutboundpacket:Setpullupdurationtoinfinite(3Fhex)andStartpulse(EDhex)NewLevelisNormalNoYesAddtooutboundpacket:pulseterminationcommand,startnewpulsewithoutprimeandthenterminatepulseagainWritethepacketandreceivetheresponseReturnsuccessReturnfailuretochangelevelDS2480B_DetectStartDS2480BMode=commandYesNoAddcommandselecttooutboundpacket,E3hexFlushOutboundPacket(toDS2480B)Commandmode(optional)PulseTerminationE3(hex)F1Startpulse(pullup,noprime)PulseTerminationEDF1ResponsePacket(fromDS2480B)Pulseterminationresponse(xxundefined)Pulseterminationresponse(xxundefined)111011xx(binary)111011xx(binary)WritethepacketandreceivetheresponseFlushOutboundPacket(toDS2480B)Commandmode(optional)SetstrongpullupdurationtoinfiniteStartpulse(pullup)commandE3(hex)3FEDResponsePacket(fromDS2480B)Setpullupdurationresponsebyte3E(hex)AN19221of26OWPROGRAMPULSEFLOWFigure14ResponsevalidYesNoAddtooutboundpacket:Setprogrampulsedurationto512ms(29hex)andStartpulse(FDhex)FlushDS2480BMode=commandYesNoAddcommandselecttooutboundpacket,E3hexOutboundPacket(toDS2480B)Commandmode(optional)Setpulsedurationto512msStartpulse(program)commandE3(hex)29FDResponsePacket(fromDS2480B)SetprogrampulsedurationresponsebytePulseterminationresponse(xxundefined)28(hex)111011xx(binary)WritethepacketandreceivetheresponseReturnsuccessReturnprogrampulsefailureDS2480B_DetectStartProgramVoltageavailableYesNoReturnprogrampulsefailureAN19222of26OWReadBitPowerTheOWReadBitPoweroperationisusedexclusivelywiththeJava-powerediButton.
ThisiButtonhasareleasesequencethatmustapplypowerimmediatelyafteraconfirmationbit.
Iftheconfirmationbitisthewrongvaluethenthepoweristurnedbackoffandtheoperationfails.
IftheJava-powerediButtonisnotgoingtobeusedthenthisoperationneednotbeimplemented.
Toterminatethepowerdeliveryafterthisoperation,callOWLevel(normal).
SeeFigure15fortheflowofthisoperation.
OWREADBITPOWERFLOWFigure151-WirebitresultvaluecorrectYesNoAddtooutboundpacket:Setpullupdurationtoinfinite(3Fhex)and1-WirebitwithpulluparmedFlushDS2480BMode=commandYesNoAddcommandselecttooutboundpacket,E3hexOutboundPacket(toDS2480B)Commandmode(optional)Setstrongpullupdurationtoinfinite1-Wirebitcommand(withpulluparm)E3(hex)3F100dss11(binary)ResponsePacket(fromDS2480B)Setpullupdurationresponsebyte1-Wirebitresult3E(hex)100dssrr(binary)WritethepacketandreceivetheresponseReturnsuccessReturnbitpowerfailureOWLevel(normal)StartssSpeed01standard(flex)10overdrivedDatatosend0write0bit1write1orreadbitrrbitresult000readback111readbackResponsepacketvalidYesNoDS2480B_DetectiButtonisaregisteredtrademarkofDallasSemiconductor.
AN19223of26OWWriteBytePowerTheOWWriteBytePoweroperationappliesstrongpulluppowerdeliveryimmediatelyafterawrite1-Wirebyte.
Thisisthetypicalformofpowerdelivery.
Forexample,theDS1920temperatureiButtonhasasinglebyteconverttemperaturecommandthatrequirespowerafterthecommandiscomplete.
Toterminatethepowerdeliveryafterthisoperation,callOWLevel(normal).
SeeFigure16fortheflowofthisoperation.
Notethatthebytetowriteisconvertedtoeightsinglebitoperationswiththelastbitarmingthepowerdelivery.
ThiscouldhavebeenaccomplishedwithasinglebytesequencebutthiswasdonesothattheoperationisverysimilartotheOWReadBitPoweroperationandcouldpotentiallybecombined.
OWWRITEBYTEPOWERFLOWFigure16Addtooutboundpacket:Setpullupdurationtoinfinite(3Fhex)andeight1-WirebitcommandswiththelastarmingpullupFlushDS2480BMode=commandYesNoAddcommandselecttooutboundpacket,E3hexOutboundPacket(toDS2480B)Commandmode(optional)Setstrongpullupdurationtoinfinite1-Wirebitcommand(bit0ofbytetowrite)1-Wirebitcommand(bit7ofbytetowrite+pullup)E3(hex)3F100dss01(binary)100dss11(binary)ResponsePacket(fromDS2480B)Setpullupdurationresponsebyte1-Wirebitresult(bit0ofbyte)1-Wirebitresult(bit7ofbytetowrite)3E(hex)100dssrr(binary)100dssrr(binary)Writethepacketandreceivethe9-byteresponsepacketReturnsuccessReturnbytepowerfailureStartssSpeed01standard(flex)10overdrivedDatatosend0write0bit1write1orreadbitrrbitresult000readback111readbackResponsepacketvalidYesNoDS2480B_DetectAN19224of26EXAMPLESThissectionhasseveral1-Wirecommunicationexamplesusingthebasicandextended1-Wireoperations.
TheoverdrivematchsequenceasseeninExample2isusedtotakeanoverdrivecapable1-Wiredevicetooverdrivespeed.
AfterthissequencehasbeensuccessfullycompletedboththeDS2480Bandthe1-Wiredeviceareoperatingatoverdrivespeedandany1-WireoperationexceptOWSearchcanbeperformed.
OVERDRIVEMATCHPSEUDOCODEExample2trans_block–temporarytransmitbuffer,valuesexpressedinhexadecimalnotation//putat1-WirespeedtonormalOWSpeed(normal)//resetthe1-Wirebus(atnormalspeed)IfOWReset=TRUE//overdrivematchcommandOWWriteByte(69hex)//change1-WirespeedtooverdriveOWSpeed(overdrive)//sendthe1-WiredeviceROMnumbertocompleteMATCH,ROMisR0.
.
.
R7trans_block=R0,R1,R2,R3,R4,R5,R6,R7OWBlock(trans_block)//Success.
.
.
Else//nodevicepresent.
.
.
EndIfTheDS1920iButtonisatemperaturereadingsensorthatperformsatemperatureconversionwheninstructed.
Whileatemperatureconversionistakingplacethe1-Wiremastermustsupplystrongpulluppowerdelivery.
Example3showstheconverttemperaturesequenceusingtheextended1-Wirepowerdeliveryoperations.
DS1920TEMPERATURECONVERTPSEUDOCODEExample3trans_block–temporarytransmitbuffer,valuesexpressedinhexadecimalnotation//resetthe1-WirebusIfOWReset=TRUEIfOWReset=TRUE//senttheMATCHROMsequenceforthedevicetoread,ROMisR0.
.
.
R7trans_block=55,R0,R1,R2,R3,R4,R5,R6,R7OWBlock(trans_block)//convertcommandandapplypowerOWWriteBytePower(44hex)//delaytoallowconverttocompeteDelay(1000ms)//disablethepowerdeliveryOWLevel(normal)AN19225of26//verifyconvertcompletedIfOWReadByte==FFhex//Success.
.
.
Else//convertnotcomplete,fail.
.
.
EndIfElse//nodevicepresent.
.
.
EndIfOne-time-programmable(OTP)EPROM1-WirememorydevicesarewrittenonebyteatatimeusingthesequenceasseeninExample4.
TheDS2480Bmustbesuppliedwitha12Vsupplyforthisoperationtocomplete.
TheavailabilityofthesupplyissensedoneachcalledtoOWReset.
DS1986EPROMPROGRAMMINGPSEUDOCODEExample4trans_block–temporarytransmitbuffer,valuesexpressedinhexadecimalnotation//resetthe1-WirebusIfOWReset=TRUE//senttheMATCHROMsequenceforthedevicetowrite,ROMisR0.
.
.
R7//withwritememorycommand0F,andaddress0000,anddata66,andreadCRC16.
trans_block=55,R0,R1,R2,R3,R4,R5,R6,R7,0F,00,00,66,FF,FFOWBlock(trans_block)//computeCRC16overlast6bytesinblocktoverifydata/addresssetcorrectlyIfCRC16correct//sendtheprogrampulseIfNotOWProgramPulse//Programvoltagenotavailable.
.
.
EndIf//readbackthedataforverificationIfOWReadByte!
=66//Success.
.
.
Else//failedtoprogram,pagelocked,bytealreadyprogrammed.
.
.
EndIfElse//errorintransmittingaddressanddata.
.
.
EndIfElse//nodevicepresent.
.
.
EndIfAN19226of26Example5showsawritescratchpadsequencefortheDS1996.
Notethattheentireoperationexcepttheresetitlumpedtogetherinsingleblock.
Thisisdesirableforoptimaloperationwherethereisanoverheadforeachpacketsentandreceivedfromaserialport.
DS1996WRITESCRATCHPADPSEUDOCODEExample5trans_block–temporarytransmitbuffer,valuesexpressedinhexadecimalnotation//resetthe1-WirebusIfOWReset=TRUE//senttheMATCHROMsequenceforthedevicetowrite,ROMisR0.
.
.
R7,//thewritescratchpadcommand0F,targetaddress0000,//andthedata(all66h'sforthisexample)trans_block=55,R0,R1,R2,R3,R4,R5,R6,R7,0F,00,00,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66OWBlock(trans_block)Else//nodevicepresent.
.
.
EndIfCONCLUSIONTheDS2480Bhassuccessfullybeenutilizedinthefollowingserialto1-WirebridgeadaptersforPCsandworkstations:DS9097U-009,DS9097U-S09,DS9097U-E25,DS1411-000,andDS1411-S09.
ThedatasheetsfortheseadapterscanbefoundontheDallasSemiconductor/Maximwebsiteatthefollowinglink:http://www.
maxim-ic.
comTheDS2480BhasalsobeenusedinembeddedapplicationslikeTINI.
DetailsonTINIembeddedplatformcanbefoundatthefollowinglink:http://www.
maxim-ic.
com/products/ibutton/Thisdocumenthaspresentedacomplete1-WireinterfacesolutionusingtheDS2480BSerial1-WireLineDriver.
Theprovidedflowchartsareeasilyimplementedonanyhostsystemwithaminimalserialcommunicationsport.
Acomplete'C'implementationisalsoavailablefordownloadfromthefollowinglink:http://files.
maxim-ic.
com/sia_bu/public/an192.
zipRevisionHistory03/05/02Version1.
0—Initialrelease03/27/03Version1.
1—Corrections:SearchROMcommandscorrectedtoF0hex.
(Figure4)ChangedVPPdetectionbitinthe1-Wireresetresponsebytetoundefined,ignoreresponsewhenaDS1994/DS2404isbeingread,andcorrect1-Wireresetcommand.
CorrectFigure9.
TINIisaregisteredtrademarkofDallasSemiconductor.
HostKvm也发布了开年促销方案,针对香港国际和美国洛杉矶两个机房的VPS主机提供7折优惠码,其他机房业务提供8折优惠码。商家成立于2013年,提供基于KVM架构的VPS主机,可选数据中心包括日本、新加坡、韩国、美国、中国香港等多个地区机房,均为国内直连或优化线路,延迟较低,适合建站或者远程办公等。下面列出几款主机配置信息。美国洛杉矶套餐:美国 US-Plan1CPU:1core内存:2GB硬盘...
2022年春节假期陆续结束,根据惯例在春节之后各大云服务商会继续开始一年的促销活动。今年二月中旬会开启新春采购季的活动,我们已经看到腾讯云商家在春节期间已经有预告活动。当时已经看到有抢先优惠促销活动,目前我们企业和个人可以领取腾讯云代金券满减活动,以及企业用户可以领取域名优惠低至.COM域名1元。 直达链接 - 腾讯云新春采购活动抢先看活动时间:2022年1月20日至2022年2月15日我们可以在...
官方网站:点击访问青云互联官网优惠码:五折优惠码:5LHbEhaS (一次性五折,可月付、季付、半年付、年付)活动方案:的套餐分为大带宽限流和小带宽不限流两种套餐,全部为KVM虚拟架构,而且配置都可以弹性设置1、洛杉矶cera机房三网回程cn2gia 洛杉矶cera机房  ...
response.flush为你推荐
漏洞chrome敬请参阅最后一页特别声明netbios端口如何组织netbios端口的外部通信重庆宽带测速重庆联通宽带测速的网址是好多呢?win10关闭445端口如何进入注册表修改关闭445端口css下拉菜单如何用css3做导航栏下拉菜单itunes备份怎么使用iTunes备份重庆电信网速测试电信100M下载速度多少M,为什么我家里电信100M下载速度最快5M美妙,是不是严重缩水micromediamacromedia FreeHand MX是干什么用的?google统计google分析里的数据包括搜索引擎爬虫的数据吗?Google中文专题交流
域名注册公司 网络服务器租用 猫咪永久域名收藏地址 3322动态域名注册 荣耀欧洲 bandwagonhost 20g硬盘 搜狗抢票助手 彩虹ip 云全民 卡巴斯基官方免费版 169邮箱 免费活动 天翼云盘 linode支付宝 监控服务器 网页加速 xuni 谷歌搜索打不开 重庆联通服务器托管 更多