工控培訓教程、手冊合集如何用s7-200實現(xiàn)modbus通信_第1頁
工控培訓教程、手冊合集如何用s7-200實現(xiàn)modbus通信_第2頁
工控培訓教程、手冊合集如何用s7-200實現(xiàn)modbus通信_第3頁
已閱讀5頁,還剩2頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

Service& SIMATICS7-200,CPU 說明參數(shù)設置步驟:1,2,3,4,5,1516。要求要使用Modbus協(xié)議必須先獲得并在STEP7Micro/Win中安裝指令庫(條目 Modbus主站協(xié)議只被STEP7Micro/WinV4.0SP5及其以上版本支持。.硬件設置o)1Micro/WINPGPCCPU0Profibus纜進行連接(電3,3,8,8->01)M(26KB圖參數(shù)匹配"MBUS_INIT"and"MBUS_SLAVE"。"(40KB圖MBUS參意選0=PPI,1200,2400,4800,9600,19200,38400,57600,STEP7Micro/WIN幫助:"MODBUS主站執(zhí)MBUS_MSG時的錯誤代碼"參參意選0=讀1=wwwPLCworld0128Q0.0w

1)STEP7Micro/WIN幫助:"MODBUSMBUS_MSG時的錯誤代碼。參意選0=PPI,1200,2400,4800,9600,19200,38400,57600,參意選庫的地再被其它程序所使用(主站側(cè):"DataPtr"+"Count"從站側(cè):"HoldStart"+"MaxHold")。圖co.

(137KBwwwPLCworld保持寄存器值的傳輸見圖.04。保持寄存器是以字為單位傳輸?shù)?,它與從站的V區(qū)地址對應??梢园聪旅婀接嬎銖恼镜腣區(qū)目標指針: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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論