工控培训教程、手册合集如何用s7-200实现modbus通信_第1页
工控培训教程、手册合集如何用s7-200实现modbus通信_第2页
工控培训教程、手册合集如何用s7-200实现modbus通信_第3页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Service& SIMATICS7-200,CPU 说明参数设置步骤:1,2,3,4,5,1516。要求要使用Modbus协议必须先获得并在STEP7Micro/Win中安装指令库(条目 Modbus主站协议只被STEP7Micro/WinV4.0SP5及其以上版本支持。.硬件设置o)1Micro/WINPGPCCPU0Profibus缆进行连接(电3,3,8,8->01)M(26KB图参数匹配"MBUS_INIT"and"MBUS_SLAVE"。"(40KB图MBUS参意选0=PPI,1200,2400,4800,9600,19200,38400,57600,STEP7Micro/WIN帮助:"MODBUS主站执MBUS_MSG时的错误代码"参参意选0=读1=wwwPLCworld0128Q0.0w

1)STEP7Micro/WIN帮助:"MODBUSMBUS_MSG时的错误代码。参意选0=PPI,1200,2400,4800,9600,19200,38400,57600,参意选库的地再被其它程序所使用(主站侧:"DataPtr"+"Count"从站侧:"HoldStart"+"MaxHold")。图co.

(137KBwwwPLCworld保持寄存器值的传输见图.04。保持寄存器是以字为单位传输的,它与从站的V区地址对应。可以按下面公式计算从站的V区目标指针:2*(Addr-40001)+HoldStart=2*(40002-40001)+&VB0="MaxHold>=Addr-40001+Count=40002-40001+1=(38KBFig. )条目号 日期:2008-05-HowHowdoyouimplementMODBUScommunicationwithS7-Displaypart SIMATICS7-200,CPU TakingthefollowingexampleyoucansetupasimpleMODBUSmaster-slavecommunicationbetweentwoS7-200CPUs.TheexampleconcernstheMODBUSfunctioncode6(Writetoslave-holdingregister)andcanbeconsideredasabasisforstep-by-stepchangingoftheparametersfortheotherfunctioncodessupported:1,2,3,4,5,15and16.TooperatetheMODBUSprotocolyoumustfirstprocureandinstallfirsttheSTEP7Micro/WINcommandlibrary,thenSTEP7Micro/WIN(EntryID TheMODBUS-MasterprotocolissupportedonlyfromSTEP7Micro/WINV4.0ServicePack51.Hardware2.Parameter3.Memoryaddressingforthe4.Holdingregistervalue9M.wHardware ww9M.wTheexampleissetupforaMODBUScommunicationbetweenthePorts0oftwoS7-200CPUs(preferablyeachwith2communicationinterfaces).OnthemastersideitwouldalsobepossibletoselectPort1withthecorrespondinglibraryblockselection"MBUS_CTRL_P1"and"MBUS_MSG_P1".Port1isconnectedineachcasewithaPCorPGwiththeMicro/WINsoftware.CommunicationbetweentheCPUsviaPort0ismadeviaaPROFIBUScable(serialconnectionofPins3,3,7and8->seeFig.01).Inaddition,youmustmakesurethattheencoderground(M)is(26KBFig.ForMODBUScommunication,onthemastersideyouneedlibraryblocks"MBUSCTRL"and"MBUS_MSG",and"MBUS_INIT"and"MBUS_SLAVE"ontheslaveside.InMicro/WINyoucreateanewprojectforthemasterandtheslavewiththenetworksandparametersshowninFig.02.Hereyoumustmakesurethatthe"Baud"and"Parity"parametersareidenticalandthatthe"Slave"addressofthe"MBUS_MSG"blockmatchesthe"Addr"parameterofthe"MBUS_INIT"block(seeFig.02).ThebaudratesettingforthePort0interfaceinthe"Systemdatablock"viewinMicro/WINisirrelevantfortheMODBUSprotocol("Mode"="1").(40KBFig.Thefollowingtablesdescribethemeaningsandselectionoptionsofthelibraryblock0=PPI,Transmissionratein1200,2400,4800,9600,19200,38400,0=none,1=odd,umtimeinmsforthe'Finished'ErrorTable1)SeeSTEP7Micro/WINHelp:"ErrorcodesfortheexecutionoftheMODBUSmasteroperationw.91HMI.oBUS wwwPLCworldSlave"Read"or0=read,MOBDUSinitial0..128=digitaloutputsQ0.0..Q15.710001..10128=digitalinputsI0.0..30001..30092=oginputsAIW0..40001..49999=holdingregisterNumberofbits(0xxxx,1xxxx)/words(3xxxx,Pointertostartofvariable'Finished'ErrorTable1)SeeSTEP7Micro/WINHelp:"ErrorcodesfortheexecutionoftheMODBUSmasteroperationMBUSMSG"MBUSINIT0=PPI,SlaveTransmissionratein1200,2400,4800,9600,19200,57600,0=none,1=odd,SignalstretchinginNumberofavailabledigitalinputsandNumberof oginputMax.numberofholdingregisterwordPointertothestartoftheholdingregister'Finished'ErrorTable2)The umaddressesthatcanbereallyuseddependsontheCPUtypeusedandits 3)SeeSTEP7Micro/WINHelp:"ErrorcodesfortheexecutionoftheMODBUSslave'Finished'rrorErrorTable3)SeeSTEP7Micro/WINHelp:"ErrorcodesfortheexecutionoftheMODBUSslaveMemoryaddressingfortheAftercompletionoftheprojectsyoumustdefinethememoryforthelibraryintheMicro/WINprogramblockcontainer.Whenreservingmemoryforthelibraries,makesurethattheareaselectedineachcasedoesnotoverlapthevariablememoryareaforthedata(forthemaster:"DataPtr"+"Count"andfortheslave:"HoldStart"+"MaxHold").(137KBFig.HoldingregistervalueAfterloadingtheprojectsintotheappropriateCPUyoucanwritetotheselectedmastervariablememoryareabyactivatingthetablestatusandmonitorontheslaveside.WhenthemasterinputI0.0isactivated,thecontentofvariablewordVW2issenttotheslaveCPUandwrittenheretothevariablewordVW2.ThisholdingregistervaluetransferisshowninFig.Thepointer"DataPtr"representsthestartofthevariablememorytobeThe"Count"parameterspecifiesthenumberofwordstobewrittentotheaddress"Addr"="4xxxx"(holdingregister).Thevariablememoryareaselectedwillbewrittentotheholdingregisterstartaddress"Addr"="40002"("RW"="1").TheholdingregisterworkswordforwordasaplaceholdertotheslavevariablememoryThe"HoldStart"pointerspecifiestheinitialaddressofthevariablememoryequivalenttotheholdingregisterstartaddress40001.Youcancalculatetheslavevariablememorytargetpointerasfollows:2*(Addr-40001)+HoldStart=2*(40002-40001)+&VB0=&VB2Inaddition,youmustmakesurethatthe umnumbero

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论