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.
DediPath 商家成立时间也不过三五年,商家提供的云服务器产品有包括KVM和OPENVZ架构的VPS主机。翻看前面的文章有几次提到这个商家其中机房还是比较多的。其实对于OPENVZ架构的VPS主机以前我们是遇到比较多,只不过这几年很多商家都陆续的全部用KVM和XEN架构替代。这次DediPath商家有基于OPENVZ架构提供低价的VPS主机。这次四折的促销活动不包括512MB内存方案。第一、D...
819云是我们的老熟人了,服务器一直都是稳定为主,老板人也很好,这次给大家带来了新活动,十分给力 香港CN2 日本CN2 物理机 E5 16G 1T 20M 3IP 240元0官方网站:https://www.819yun.com/ 特惠专员Q:442379204套餐介绍套餐CPU内存硬盘带宽IP价格香港CN2 (特价)E5 随机分配16G1T 机械20M3IP240元/月日本CN2 (...
我们在去年12月分享过Hosteons新上AMD Ryzen9 3900X CPU及DDR4内存、NVMe硬盘的高性能VPS产品的消息,目前商家再次发布了产品更新信息,暂停新开100M带宽KVM套餐,新订单转而升级为新的Budget KVM VPS(SSD)系列,带宽为1Gbps端口,且配置大幅升级,目前100M带宽仅保留OpenVZ架构产品可新订购,所有原有主机不变,用户一直续费一直可用。Bud...
response.flush为你推荐
桂林飞宇科技股份有限公司V1.2cyclesios8支持ipad支持ipadipadwifiipad插卡版和wifi版有什么区别,价格差的多么?google图片搜索如何使用google图片搜索引擎?谷歌sb在谷歌里搜SB为什么结果中第一个是百度micromediawww.macromedia.com 是什么网站googleadsenceGoogle AdSense 帐户状态是什么意思!ipad上不了网平板电脑 能连接网络不能上网
企业域名备案 域名交易网 万网域名证书查询 burstnet 私服服务器 10t等于多少g 华为网络硬盘 域名转向 怎样建立邮箱 服务器是干什么的 电信托管 环聊 网通服务器 789 国内空间 卡巴斯基试用版下载 杭州电信宽带 双11促销 阿里云邮箱怎么注册 塔式服务器 更多