,PLC,。,2:,WinCC、;。、、,;,,,、[1]。(1),WindowsXP,MFC、PRODAVEPLC。1:PC,Windows;S7-200/300PLC;PCMPI;Profibus。PLCProfibus-DP:EM277(9.6kbit/s~12Mbit/s)(EM277)S7-200CPUProfibus-DP,,I/O,;S7-200V,EM2771~128[2]。CPUDPPLCDP,S7-300PLCDB。DB,DBX,DBB、DBWDBD、。CPUPNPLCProfinet,PC。2PRODAVEPRODAVE()PCS7PLC。ProdavePLC,,(,100876):S7-200/300PLC。PRODAVEProfibus-DP,PLC。MFC。:MFC;PLC;PRODAVE;Profibus-DP;;SoftwareDevelopmentofSiemensPLCMonitoringandDebuggingBasedonProdaveZHAOJun,SHILiang-ping,HUANGChun-yang(AutomationSchoolofBUPT,Beijing100876,China)Abstract:CommunicationsoftwaredesignbetweenSiemensS7-200/300seriesPLCandhostcomputerareintroduced.ThePRODAVEpackageDLLareusedtoestablishProfibus-DPandEthernetcommunication.Thefunctionofhostcomputerread-writeoperationonPLCisimplemented.TheinterfacedevelopmentisunderMFCenvironment.Keywords:MFC;PLC;Profibus;Profibus-DP;Ethernet;communication:(1988-),,。:2011-05-18Profibus…PLC30PLC300PLC200PLC300ProfibusProfibusPC1HMIPLC262011102.1PRODAVEPRODAVEWindowsDLL,PLCPC,VC、CPU。:(1),,PRODAVE(DLL)。(2)PLC,PLC。(3)PC/PPlPC,PLC[3]。2.2PRODAVE,DLL;DLL,。,PRODAVE():(1)LoadConnection_ex6,PCPLC,Profibus。(2)UnloadConnection_ex6,PCPLC。(3)SetActiveConnection_ex6,,。(4)as_zustand_ex6,PLC()PG/PC。(5)GetErrorMessage_ex6,。,0(UnloadConnection_ex628720),,GetEr-rorMessage_ex6[4]。3MFCClassWizard,(2)。,:PLC200(EM277Profibus-DP)、PLC300(DPProfibus-DP)、PLC、、、。23.13.1.1toolbarCToolBarm_ToolBar,Creat,SetButtons,ID,SetButtonText,RepositionBars[5]。3.1.2CTabCtrlm_Tab,NewLink()InsertItem,SetCurSel,ConNr:if(SetActiveConnection_ex6(ConNr))//,,,。3.1.3ConnecttoPLC(unsignedshortConNr),:if(!m_RadioS200.GetCheck()&&m_CheckIP.GetCheck())//S300{BYTEf1,f2,f3,f4;//ip4m_IPAddress.GetAddress(f1,f2,f3,f4);//IPpConTable-Adr.Ip[0]=f1;//pConTable-Adr.Ip[1]=f2;pConTable-Adr.Ip[2]=f3;pConTable-Adr.Ip[3]=f4;pConTable-AdrType=2;//MPI=1,IP=2,MAC=3pConTable-SlotNr=2;//AccessPoint=S7ON-LINE;//}elseif(m_RadioS200.GetCheck())//DPS200Else//DP300HMIPLC27(ConNr,AccessPoint,ConTableLen,pConTable);//,,,。3.1.4DisconnectToPLC(unsignedshortConNr)UnloadConnection_ex6(ConNr)。3.1.5OnOpenFile()txt:charszFilters[]=MyTypeFiles(*.txt)|*.txt|AllFiles(*.*)|*.*||;CFileDialogfileDlg(TRUE,txt,*.txt,OFN_FILEMUSTEXIST|OFN_HIDEREADONLY,szFil-ters,this);if(fileDlg.DoModal()==IDOK){pathName=fileDlg.GetPathName();UpdateData(FALSE);OnReadFile(pathName);}OnReadFile(CStringSFile)CFileOpen、ReadClose,,,,strtok(),MSFlexGrid。3.2ReturnResult(),,(VB、VD、DBW),PLC200VPLC300DB:db_read_ex6(DB_No,0,StartAdd,&Amount,Bu-fLen,pBuffer,&pDatLen);//S300DBfield_read_ex6(100,1,StartAdd,Amount,BufLen,pBuffer,&pDatLen);//S200field_write_ex6db_write_ex6。3.32、10、16、S5T。1.m×2E,mEANSI/IEEE,,,823~30,m0~22。S5T,S5T#xxxms,416,BCD。sss,,S5T(S),(.),2(2#),16(16#),。,210S5T16,0162。:////////////////////16S5T//////////////{sss=sss.Mid(3);intslen=sss.GetLength();for(inti=4;islen;i--)sss=‘0’+sss;if(sss[0]‘3’||sss[1]‘9’||sss[2]‘9’||sss[3]‘9’)//S5TCurStr=16#+sss;intincr=atoi(sss.Mid(0,1));//intt_incr=pow(10,incr+1);intnum=atoi(sss.Mid(1));//intt_total=t_in-cr*num;//CurStr.Format(_T(S5T#%dms),t_total);}///////////////////////2/////////////////////////floatCDataModifyDlg::bin2float(CStringsss){longlngSign;floatdbReasult;intslen=sss.GetLength();for(inti=32;islen;i--)sss=‘0’+sss;if(sss.Mid(0,1)==1)lngSign=-1;elselngSign=1;CStringstrE=sss.Mid(1,8);//CStringstrM=binl2decl(sss.Mid(9,23));//intE=atoi(bin2dec(strE))-127;//dbReasult=lngSign*(1+atof(strM))*(pow(2,E));re-turndbReasult;}SetTextMatrix,10,,。,VC,PLC。3.4WM-TIMER,PLC,。IP,IP,,Display(),。3。4MFC,、、、HMIPLC(72)28。ProdaveS7PLC,,。Pro-dave,。,,[6]。[1],.[J].,2006,26(7):14-16[2].PLC(3)[M].:,2007[3].S7-300/400PLC(2)[M].:,2008[4]SIEMENS.SIMATICPRODAVEMPI/IEV6.0Manual[Z].SIEMENS,2005[5],,.VisualC++(2)[M].:,2010[6],,,.S7300PLCPC[J].,2003,25(1):52-543?NYNNYYN???NY(28),:(1),,、、。,,,。、,。(2)。,。,。,,,。4,。,,,。,。(3),,(、、),,,。,。,。(4),,,。,,,。[1],.IEC60870-5-104[J].,2006(17):55-5872