首页 培训资料手册Modbus protocol

培训资料手册Modbus protocol

举报
开通vip

培训资料手册Modbus protocolInstrometUltrasonicTechnologiesInstrometUltrasonicsB.V.CheckSonic,FlareSonic,P.Sonic®,Q.Sonic®,TwinSonicDigitalCommunication:ModbusProtocolDocumentCode:99.01.03A.01/2/A99.01.03A.01/2/APage2of14InstrometUltrasonicTechnologiesDocumentCheckSon...

培训资料手册Modbus protocol
InstrometUltrasonicTechnologiesInstrometUltrasonicsB.V.CheckSonic,FlareSonic,P.Sonic®,Q.Sonic®,TwinSonicDigitalCommunication:ModbusProtocolDocumentCode:99.01.03A.01/2/A99.01.03A.01/2/APage2of14InstrometUltrasonicTechnologiesDocumentCheckSonic,FlareSonic,P.Sonic®,Q.Sonic®,TwinSonic-DigitalCommunication:ModbusprotocolDocumentCode99.01.03A.01/2/ADateApril28,1999PublisherInstrometUltrasonicsB.V.PieterZeemanweg61POBox80903316GZDordrecht3301CBDordrechtTheNetherlandsTheNetherlandsPhone:+31-78-6510977Fax:+31-78-6511017Copyright©1999,InstrometUltrasonicsB.V.,Dordrecht,TheNetherlands.InstrometUltrasonicsB.V.isamemberoftheInstrometgroup.Alltechnicalandtechnologicalinformationcontainedinthismanual,includinganydrawingsandtechnicalspecificationsshallremainthepropertyofInstrometUltrasonicsB.V.andmaynotbeused(otherthanfortheoperationofthisproduct),copied,multiplied,passedonorcommunicatedtoathirdpartywithoutthepriorwrittenpermissionofInstrometUltrasonicsB.V.TrademarksProductslistedaretrademarksoftheirrespectivemanufacturers.CompanynameslistedaretradenamesoftheirrespectivecompaniesRevisionHistoryRevisionDescriptionDate99.01.03A.01/2/AFirstissue.04-28-1999Contents99.01.03A.01/2/APage3of14InstrometUltrasonicTechnologiesContentsPreface...........................................................................................................4Introduction................................................................................................4Abbreviations/Acronyms............................................................................4References................................................................................................51OSILayer1:TheHardwareLayer.............................................................61.1Introduction..........................................................................................61.2RS-485hardwareconnections............................................................62OSILayer2:TheLinkLayer......................................................................72.1Introduction..........................................................................................72.2Generalcharacteristics........................................................................72.3Messageformat...................................................................................71.4Exceptionresponses...........................................................................81.5BitsandBytes......................................................................................83OSILayer6:ThePresentationLayer........................................................93.1Introduction..........................................................................................93.2Abstractdatatypes..............................................................................94OSILayer7:TheApplicationLayer.........................................................104.1Introduction........................................................................................104.2Registergroups.................................................................................104.2.1Shortwordregisters..................................................................104.2.2Longwordregisters...................................................................104.2.3Floatingpointregisters..............................................................114.3Detailedexplanationoffunctioncodes..............................................114.3.1ReadNumericVariables(Functioncode3)..............................124.3.1.1Query.................................................................................124.3.1.2Response..........................................................................124.3.2EncapsulatedUNIFORMCommand(Functioncode65)..........12Glossary........................................................................................................13FiguresFigure2-1:RTUmessageframeformat...................................................7Figure2-2:Exceptionresponsemessageframeformat...........................8Figure4-1:ReadNumericVariablesquerymessage..............................12Figure4-2:ReadNumericVariablesresponsemessage........................12TablesTable2-1:Supportederrorcodes..............................................................8Table4-1:Shortwordregisters...............................................................10Table4-2:Longwordregisters................................................................11Table4-3:Floatingpointregisters...........................................................11Table4-4:Modbusfunctioncodes..........................................................11Preface99.01.03A.01/2/APage4of14InstrometUltrasonicTechnologiesPrefaceIntroductionThisdocumentdescribestheModbusRTUserialcommunicationprotocolasimplementedinthefollowingultrasonicflowmetersfromInstromet:♦CheckSonic:◊CheckSonic(-1)Series-IIIQLMeter◊CheckSonic-2Series-IIIQLMeter♦FlareSonic:◊FlareSonic(-1)Series-IIIQLMeter◊FlareSonic-2Series-IIIQLMeter♦P.Sonic:◊P.Sonic-1Series-IIIQLMeter◊P.Sonic-2Series-IIIQLMeter♦Q.Sonic:◊Q.Sonic-2Series-IIIQLMeter(Stand-aloneSPU)◊Q.Sonic-3Series-IIIQLMeter(Stand-aloneSPU)◊Q.Sonic-5Series-IIIQLMeter(Stand-aloneSPU)♦TwinSonic:AllTwinSonicmeterconfigurationsbuiltfromthemeterslistedabove.TheprotocolasimplementedintheultrasonicflowmetersisasubsetoftheModbusRTUprotocolasdesignedbyGouldInc.asmodifiedbyDanielIndustries,Inc.ModbusisaregisteredtrademarkofGouldIncorporated.TheModbuscommunicationsprotocolisfullydescribedinthereferenceguideentitledGouldModbusProtocolpublicationPI-MBUS-300,[1].ThedescriptionofthecommunicationprotocolisbasedontheISOReferenceModelforOpenSystemsInterconnection,alsoreferredtoasOSImodel(ISO7498,[3]).TheOSImodelismadeupof7layers:♦Layer7:Applicationlayer♦Layer6:Presentationlayer♦Layer5:Sessionlayer♦Layer4:Transportlayer♦Layer3:Networklayer♦Layer2:Linklayer♦Layer1:PhysicallayerOSIlayer1,thephysicallayer,isdescribedinchapter2.OSIlayer2,thedatalinklayer,isdescribedinchapter3.TheOSIlayers3through5arenotused.OSIlayer6,thepresentationlayerisdescribedinchapter4.OSIlayer7,theapplicationlayerisdescribedinchapter5.Abbreviations/AcronymsbpsbitspersecondCTSClearToSendDCDDataCarrierDetectDCEDataCircuit-terminatingEquipmentDSRDataSetReadyDTEDataTerminalEquipmentDTRDataTerminalReadyEIAElectricalIndustriesAssociationIEEEInstituteforElectricalandElectronicsEngineersISOInternationalStandardsOrganizationPreface99.01.03A.01/2/APage5of14InstrometUltrasonicTechnologiesLSBLeastSignificantByteLSbitLeastSignificantbitMACMediumAccessControlMSBMostSignificantByteMSbitMostSignificantbitOSIOpenSystemsInterconnectionPCPersonalComputerPCBPrintedCircuitBoardRDReceiveDataRIRingIndicatorRTSRequestToSendRURemoteUnitSGSignalGroundSPUSignalProcessingUnitTDTransmitDataUARTUniversalAsynchronousReceiverTransmitterUNIFORMUltrasoNIcFlowmetercOnfiguRationandMonitoringsoftwareReferences1.GouldModbusProtocol,PI-MBUS-300,GouldInc.,ProgrammableControlDivision2.IEEEStandardforFloating-pointArithmetic754,19853.ISO7498,InformationProcessingSystems-OpenSystemsInterconnection-BasicReferenceModel,1984OSILayer1:TheHardwareLayer99.01.03A.01/2/APage6of14InstrometUltrasonicTechnologies1OSILayer1:TheHardwareLayer1.1IntroductionThephysicallayerisconcernedwithboththephysicalandelectricalinterfacebetweentheuserequipmentandthenetworkterminatingequipment.Itprovidesthelinklayerwithameansoftransmittingaserialbitstreambetweenthetwocorrespondentsystems.1.2RS-485hardwareconnectionsTheultrasonicflowmetersfromInstrometarefittedwithaserialinterfaceusingtheRS-485electricalstandard.TheRS-485terminalsarelabelledAandB.Thefollowingrulesapplywhenconnectinganultrasonicflowmetertoexternalequipment:♦Useashieldedtwistedpairdatalink.♦Makesurethedatalink’smainlineisproperlyterminatedonbothsides:terminatethelinewithitscharacteristicimpedance.♦Keepstublengthsoffthemainlineasshortaspossible.♦RS-485devicesshouldbeconnected"1:1"(or"straightthrough").ThismeansthattheSPUterminalAisconnectedtotheexternalequipment'sterminalA,andtheSPUterminalBisconnectedtotheexternalequipment'sterminalB.♦RS-485terminalsonexternalequipmentaresometimeslabelledData+andData-,orYandG.Data+andYareequivalenttoA,Data-andGareequivalenttoB.OSILayer2:TheLinkLayer99.01.03A.01/2/APage7of14InstrometUltrasonicTechnologies2OSILayer2:TheLinkLayer2.1IntroductionThelinklayerbuildsonthephysicalconnectionandprovidesareliableinformationtransferfacility.2.2GeneralcharacteristicsAserialdatalinkisused.Specifications:♦Transmissionmode:asynchronous,halfduplex♦Transmissionrate-programmable:4800bps(default),9600bps,19200bps,or38400bps♦Startbits:1♦Databits:8(LSbitfirst)♦Stopbits:1♦Parity-programmable:none(default),oreven.2.3MessageformatFramesynchronisationcanbemaintainedinRTUtransmissionmodeonlybysimulatingasynchronousmessage.Thereceivingdevicemonitorstheelapsedtimebetweenreceiptofcharacters.If3½charactertimeselapsewithoutanewcharacterorcompletionofframe,thenthedeviceflushestheframe,andassumesthatthenextbytereceivedwillbeanaddress.SeeFigure2-1:RTUmessageframeformat.•••••••••••••••••••••••••••••••••••••••••••••••••T3.5•Address•Function•Data•CheckSum•T3.5••••••••••••••••••••••••••••••••••••••••••••••••••8bits•8bits•Nx8bits•16bits•••••••••••••••••••••••••••••••••••••••Figure2-1:RTUmessageframeformatDescriptionofthemessagefields:♦TheT3.5fieldrepresentsthetime-outlimit(3½charactertimes)thatprovidesframesynchronisation.♦TheAddressfieldimmediatelyfollowsthebeginningofframe,andconsistof8bits(1byte).Thesebitsindicatetheuserassignedaddressoftheslavedevicethatistoreceivethemessagesentbytheattachedmaster.Eachslavemustbeassignedauniqueaddressandonlytheaddressedslavewillrespondtoaquerythatcontainsitsaddress.Whentheslavesendsaresponse,theslaveaddressinformsthemasterwhichslaveiscommunicating.Validaddressesrangefrom1to247.Broadcastmessages–whichhaveaddress0–arenotsupportedbyInstrometultrasonicflowmeters.♦TheFunctioncodefieldtellstheaddresseddevicewhichfunctiontoperform.Refertosection4.3forthelistoffunctioncodes(andadetaileddescriptionoftheirmeaning)implementedintheInstrometultrasonicflowmeters.Thehighorderbitinthefunctioncodefieldissetbytheslavedevicetoindicateotherthananormalresponseisbeingtransmittedtothemasterdevice.Seesection2.4foradescriptionofexceptionresponses.Thisbitremains0ifthemessageisaqueryoranormalresponsemessage.♦TheDatafieldcontainsinformationneededbytheaddresseddevicetoperformthespecificfunction,oritcontainsdatacollectedbythedeviceinresponsetoaquery.Thisinformationmaybevalues,addressreferences,orlimits.Forexample,thefunctioncodetellstheslavetoreadaholdingregister,andthedatafieldisneededtoindicatewhichregistertostartat,andhowmanytoread.OSILayer2:TheLinkLayer99.01.03A.01/2/APage8of14InstrometUltrasonicTechnologies♦TheCheckSumfieldconsistsof16bits(2bytes)whichcontaintheCRC-16checksumofthemessage.Thisfieldallowsthemasterandslavedevicestocheckamessageforerrorsintransmission.Sometimes,becauseofelectricalnoiseorotherinterference,amessagemaybechangedslightlywhileitisonitswayfromoneunittoanother.Theerrorcheckingassuresthattheslaveormasterdoesnotreacttomessagesthathavechangedduringtransmission.Thisincreasesthesafetyandtheefficiencyofthecommunicationsystem.SeethereferenceguideGouldModbusProtocol[1]foradetaileddescriptionoftheCRC-16errorcheck.2.4ExceptionresponsesThehighorderbitofthefunctioncodefieldissetbytheslavedevicetoindicatethatotherthananormalresponseisbeingtransmittedtothemasterdevice.Operationerrorsarethoseinvolvingillegaldatainamessage,ordifficultyincommunicating.Theseerrorsresultinanexceptionresponse.TheexceptionresponsecodesarelistedinTable2-1:Supportederrorcodes.CodeNameMeaning01IllegalFunctionThemessagefunctionreceivedisnotanallowableactionforthedevice.02IllegalDataAddressTheaddressreferencedinthedatafieldisnotanallowableaddressforthedevice.Table2-1:SupportederrorcodesWhenaslavedevicedetectsoneoftheseerrors,itsendsaresponsemessagetothemasterconsistingofaslaveaddress,functioncode,errorcodeanderrorcheckfields;seeFigure2-2:Exceptionresponsemessageframeformat.••••••••••••••••••••••••••••••••••••••••••••••••T3.5•Address•Function•Exception•CheckSum•T3.5•••••••••••••••••••••••••••••••••••••••••••••••••8bits•8bits•8bits•16bits••••••••••••••••••••••••••••••••••••••Figure2-2:Exceptionresponsemessageframeformat2.5BitsandBytesBitsandbytesarehandledaccordingtothefollowingrules:♦Bitsarenumbered0through7;bit0istheleastsignificantbit,bit7isthemostsignificantbit.ThedecimalvalueofbitNis2N.♦Thebitsofabytearetransmittedinascendingorder:LSbitfirst,MSbitlast.OSILayer6:ThePresentationLayer99.01.03A.01/2/APage9of14InstrometUltrasonicTechnologies3OSILayer6:ThePresentationLayer3.1IntroductionThepresentationlayerisconcernedwiththerepresentation(syntax)ofthedataduringtransferbetweentwocorrespondentapplicationlayerprotocolentities.Thepresentationlayermapstheapplicationlayer'sabstractdatatypestothelinklayer'sdataunits(bytes).3.2AbstractdatatypesThepresentationlayerrecognisesthefollowingabstractdatatypes:♦ShortWord:Twobytes(16bits)containinganintegernumberbetween0and65535.Byteorder:MSBfirst,LSBlast.♦LongWord:Fourbytes(32bits)containinganintegernumberbetween0and+4294967295.Byteorder:MSBfirst,LSBlast.♦FloatingPoint:Fourbytes(32bits)containingafloatingpointnumber(IEEE-754,[1]).Byteorder:MSBfirst,LSBlast.Thebytescanbeviewedas32contiguousbits,whicharedividedintofields,asfollows:••••••••••••••••••••••••••••••••••••••••MSB•sign•exponent•fraction•LSB•(1bit)•(8bits)•(23bits)•••••••••••••••••••••••••••••••••••••••••where:◊Signisa1-bitfieldthatcontainsthevalue0iftherealvalueispositive;1iftherealvalueisnegative.◊Exponentisan8-bitfieldthatcontainsavalueoffsetby127;inotherwords,theactualexponentcanbeobtainedfromtheexponentfieldbysubtracting127.Anexponentfieldofall0sorall1srepresentsspecialcases.Otherwise,therealiscallednormalised.◊Fractionisa23-bitfieldthatcontainsthefractionalpartoftherealvalue,representedinbinaryscientificnotation.Themost-significantdigitofthefractionfieldisnotactuallyrepresented,becausebydefinition,thisdigitcontainsavalueof1unlesstherealnumberis0ordenormalised.OSILayer7:TheApplicationLayer99.01.03A.01/2/APage10of14InstrometUltrasonicTechnologies4OSILayer7:TheApplicationLayer4.1IntroductionTheapplicationlayerprovidestheuserinterfacefordataexchangewiththeultrasonicflowmeter.4.2RegistergroupsThedatatypespresentedinchapter3areassignedspecificaddressranges:♦Shortwordregisters:n000…n199,wheren=0,1,…,9♦Longwordregisters:n200…n399,wheren=0,1,…,9♦Floatingpointregisters:n400…n599,wheren=0,1,…,9Note:Assomesystemsmaybefussyaboutdatatypeversusthousands-seriesregisteraddresses,thedataarerepeatedthroughoutthestandard10000registeraddressrange.Example:Readingregister400,or1400,or2400,etc.,wouldallreturnthesamemeasuredvalue,inthiscasethespeedofsound.4.2.1ShortwordregistersTable4-1liststheshortwordregistersimplementedinInstrometultrasonicflowmeters.AddressMeasuredvalueUnitsMeaningn000InstrumentType-FlowmetertypecodeasusedbytheUNIFORMsoftwaren001NumPaths-Numberofacousticpathsn002SequenceNumLO-Measurementintervalsequencenumber:'Low-order'bytesn003SequenceNumHI-Measurementintervalsequencenumber:'High-order'bytesn004SampleRate-Numberofacquiredsamples(elementarymeasurements)n005…n009ValidSamples:L1…L5-Numberofvalidsamplesofpath1…5n010…n019AgcLevel:Trd1A…5B-AGCleveloftransducer1A,1B,2A,2B…5Bn020…n029AgcLimit:Trd1A…5B-AGClimitoftransducer1A,1B,2A,2B…5Bn030…n034DiagBits:L1…L5-Reservedfordiagnosticinformationofpath1…5n035Status1(V-status)-OperatingstatusoftheV-Modulen036Status2(C/R-status)-OperatingstatusoftheoptionalC-Module(or,ifapplicable)theRemoteUnitn037Checksum1-ReservedforfirmwareROMchecksumn038Checksum2-Reservedforparameterset-upchecksumn039ModeOfOperation-Actualmodeofoperationn040…n199undefined-Undefinedregistersalwaysreturnzero(0)Table4-1:Shortwordregisters4.2.2LongwordregistersTable4-2liststhelongwordregistersimplementedinInstrometultrasonicflowmeters.OSILayer7:TheApplicationLayer99.01.03A.01/2/APage11of14InstrometUltrasonicTechnologiesAddressMeasuredvalueUnitsMeaningN200SequenceNum-MeasurementintervalsequencenumberN201ForwardVolume8m3Reserved:Accumulatedactualvolume‘forward’;8-digitcounterN202ReverseVolume8m3Reserved:Accumulatedactualvolume‘reverse’;8-digitcounterN203ForwardErrorVolume8m3Reserved:Accumulatedactualerrorvolume‘forward’;8-digitcounterN204ReverseErrorVolume8m3Reserved:Accumulatedactualerrorvolume‘reverse’;8-digitcountern205…n399Undefined-Undefinedregistersalwaysreturnzero(0)Table4-2:Longwordregisters4.2.3FloatingpointregistersTable4-3liststhefloating-pointregistersimplementedinInstrometultrasonicflowmeters.AddressMeasuredvalueUnitsMeaningn400SpeedOfSoundm/sSpeedofsound(N-pathaverage)n401GasVelocitym/sFlowvelocity(N-pathaverage)n402PressurekPaAbsolutepressuren403TemperatureKAbsolutetemperaturen404QLinem3/hVolumeflowatlineconditions(=actualvolumeflow)n405QBasem3/hVolumeflowatbase/referenceconditions(=correctedvolumeflow)n406…n410Cpp:L1…L5m/sSpeedofsoundperacousticpath(L1…L5)n411…n415Vpp:L1…L5m/sFlowvelocityperacousticpath(L1…L5)n416ForwardVolume7m3Reserved:Accumulatedactualvolume‘forward’;7-digitcountern417ReverseVolume7m3Reserved:Accumulatedactualvolume‘reverse’;7-digitcountern418ForwardErrorVolume7m3Reserved:Accumulatedactualerrorvolume‘forward’;7-digitcountern419ReverseErrorVolume7m3Reserved:Accumulatedactualerrorvolume‘reverse’;7-digitcountern420Tspare-ReservedforTwinSonic“singlepathsectionadjustfactor”n421…n599Undefined-Undefinedregistersalwaysreturnthe‘ErrorValue’(9.999e9)Table4-3:Floatingpointregisters4.3D
本文档为【培训资料手册Modbus protocol】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
个人认证用户
潮起潮落
一线信息技术教师,具有丰富教学经验和管理经验,多次被评为地级优秀教师
格式:pdf
大小:80KB
软件:PDF阅读器
页数:14
分类:交通与物流
上传时间:2019-09-01
浏览量:21