FC5FC6功能块使用

上传人:小** 文档编号:50495829 上传时间:2022-01-20 格式:DOC 页数:13 大小:782KB
返回 下载 相关 举报
FC5FC6功能块使用_第1页
第1页 / 共13页
FC5FC6功能块使用_第2页
第2页 / 共13页
FC5FC6功能块使用_第3页
第3页 / 共13页
点击查看更多>>
资源描述
Service & SupportSIEMENS怎样使用通讯功能块FC5和FC6?显示订货号6ES7810-4CC08.SIMATIC S7, STEP7 V5.46GK7342-5.SIMATIC NET, CP342-5 f. S7-300, Profibus6GK7343-5.SIMATIC NET, CP343-5 f. S7-300, Profibus6GK73431.SIMATIC NET, CP 343-1 COMMUNICATIONS PROCESSOR IE说明:使用下面的通讯连接,在 S7-300中的S7程序中,必须调用通信功能块 FC5 AG_SEND和FC6 AG_RECV。? TCP 连接? ISO-o n-TCP连接(RFC 1006)? ISO 传输连接? UDP 连接? FDL 连接通信功能块FC5 AG_SEND 和FC6 AG_RECV 的特点? FC5 和FC6是异步通信方式。? 在本例中,是通过OB1调用这些功能块的。(见Entry ID: 2795485 )。? 能够在OB1的几个循环中执行.? FC5 通过输入参数ACT被激活。? 由DONE或ERROR表示工作结束状态。? AG_SEND 和AG_RECV能够通过连接实时通信。? 在 SIMATIC_NET_CP 库中CP 300 Blocks,能够找到功能块 FC5 AG_SEND V4.2 和 FC6 AG_RCV V4.7。示例程序S7 软件的 SIMATIC_NET_CP 库中包含了通信功能块 FC5 AG_SEND 和 FC6 AG_RCV ,FC5 AG_SEND是向另外的S7站,计算机站,或者第三方的系统发送数据。FC6 AG_RECV是从另外的S7站,计算机站,或者第三方的系统接收数据。示例程序通过ISO-on-TCP连接演示了 FC5 AG_SEND和FC6 AG_RCV的功能。首先在S7-300站中进行硬件配置。注意Note:设置MB10作为时钟字节,时钟标记触发发送请求,保存和编译 S7-300硬件配置并下载到CPU中。在 本示例程序中使用了定时器T10。在NetPro中配置通信连接,如果通信对象在同一个 S7项目中被设置,那么就能够设置一个指定的通 信连接;如果通信对象没有在同一个 S7项目中被设置,那么一个非指定的通信连接可以被设置。当设 置通信连接时,确保正确的IP地址或者PROFIBUS地址,以及正确的接口, TSAP,或者LSAP,这些 是在通信对象之间建立通信连接的条件。在通信连接- General属性对话框中,能够找到通信功能块 FC5 AG_SEND和FC6 AG_RECV 输入参数ID和LADDR。SIEMENS2JGeneial nformation | Addie$e$ | Oplionj Overview jLocl EnqpoiriBlock PaiametmID (he4|0001A050 THiSOOti-TCP comectionlWS16H0100Via CP:CP 341 (R0/S4)Route,旺 Active comection estabishmentOK ICncl I Help I图一:设置通信连接STEP7 程序包含了 OB100, 0B1, FB200, DB200, DB201, FC5 和 FC6 块。OB100:OB100是CPU重新启动(热启动)块。在这个 OB块中,通过标记 M0.3 START-UP.使能首次通 信。OB1:OB1是循环调用块。调用参数(INIT_COM)为M0.3 START-UP的FB200(背景数据块:DB200),在 FB200 运行后,复位 M0.3 START-UP。AG_SEN1/AG_RECV .一 EMSTAHT-tTP IMIT_COHENO Network 2 : Kastart (start-up - TRUE only ones Catuuent:START-UP5TAHT-UP Blocks.Describ ing a sample programThe S7 program contains the call of the commu nication blocks FC5 AG_SEND and FC6 AG_RECV from the SIMATIC_NET_CP library. The FC5 AG_SEND is for sending data to ano ther S7 station, to a PC station, or to a third-party system. The FC6 AG_RECV is for receiving data from ano ther S7 stati on, from a PC stati on, or from a third-party system.The sample program shows the functions of the com muni cati on blocks FC5 AG_SEND and FC6 AG_RCV usi ng an ISO-o n-TCP conn ectio n.First create the hardware con figurati on for your S7-300 statio n.Note:Con figure the Marker byte 10 as clock marker . The send request is triggered by this clock marker. Save and compile the hardware configuration of your S7-300 station and load it into the CPU.The timer resource T10 is used in this sample program.Con figure one of the above-me nti oned com muni cati on blocks for the CPU in NetPro. You can con figure a specified com muni cati on connection if the com muni cati on partners are con figured together in a STEP 7 project. If the com muni catio n part ner is n ot con figured in the same STEP 7 project as the S7-300 statio n, the n an un specified com muni cati on connection is con figured. Make sure you award the IP address or PROFIBUS address correctly whe n you con figure thecom mun icati on connection. You also n eed to make sure you award the PORT, TSAP or LSAP correctly. These are for clearly ide ntify ing the com muni cati on conn ecti on betwee n the com mun icati on part ners.You find the value that must be specified for the in put parameters ID and LADDR of commu nication blocks FC5 AG_SEND and FC6 AG_RECV in the Properties dialog of the com mun icati on connection - tab Ge neral.Fig. 01: Configuring the communication connectionThe STEP 7 program con sists of blocks OB100, 0B1, FB200, DB200, DB201, FC5 and FC6. OB100:The OB100 is a restart OB and is run when the CPU is restarted (warm start). In this OB, the first com mun icati on trigger is en abled with marker 0.3 START-UP.OB1:OB1 is called cyclically. The call of FB200 is in this OB (in sta nee data block: DB200) with M0.3 START-UP as parameter (INIT_COM). After FB200 was run there is a reset with M0.3 STARTUP.(填写文档类型:常问问题)P7-12Service & SupportSIEMENS0B1 :Hfl-in Progran Svep (Cycle),hSEND_AG_SENI/AG_RECV .一 EMSTAHT-tTP IMIT_COHENONetwark 2 : Kast artart-up - TRUE only azics Coiment:START-UP8c11 ST ART-UP1* Fig. 02: OB1FB200The FB200 is called in the OB1 cycle. You find the call of commu nication blocks FC5 AG_SEND and FC6 AG_RECV in the FB200. The send request is triggered via a positive edge on the in put parameter ACT. The send request trigger is con trolled by clock marker M10.7 and the variable SND_BUSY. If the send request is running, SND_BUSY is set. Triggering a new send request is not the n possible.This lock ing is particularly importa nt, because the function is asynchronous and can last several cycles. Continual triggering of new send requests without waiting to see if they worked or ended with errors can create a com muni cati on overload.The values for the in put parameters ID and LADDR must be adopted from the Properties dialog of the com muni catio n connection in NetPro (see Fig. 1). On the in put parameter SEND of the FC5 you specify the address and len gth of the data area that contains the data to be sen t (se nd buffer), for in sta nee: P#DB201.DBX0.0 BYTE 100. On the in put parameter LEN, you en ter the number of bytes to be sen t (100). The output parameters DONE, ERROR, and STATUS are required for the job evaluati on and are only valid in the same cycle.Fig. 03: FB200: Calling the FC5 AG_SENDIf the send request is successfully completed, SND_BUSY is reset. A new send request can now be triggered.If the send request is completed with an error then SND_BUSY is likewise reset and the value of the output parameter STATUS of the FC5 is saved for an error an alysis.(填写文档类型:常问问题)P9-12Service & SupportSIEMENSMetcwerk 6 : Fun匚匕DONEIf AC_SEMDconplsed rasrat BUSY!SNP tONE #SNI BUSY Net cwerk 7 : Evaluate STATUSI f function conpletres with ERDOR then save STATUS and rese BUSY!In case of STAUS=0s70O0 (=2867Z decimal) fviiction ham not been completed yet 1 Only required tor FC50/FC60 S7-40Q U U !Fig. 04: FB200: Resetting SND_BUSY and saving STATUSThe values for the in put parameters ID and LADDR must be adopted from the Properties dialog of the com muni catio n connection in NetPro (see Fig. 1). On the in put parameter RECV of the FC6 you specify the address and len gth of the data area that contains the data received (receive buffer), for in sta nee: P#DB201.DBX100.0 BYTE 100.9 : InViOfee AGRECV furLCtien biockKoMULentar z“止PEC皐 ENNTE-rncv_NDR(ID ID# RCVERRWflfiflOO LADDRSTATUSf RCVSTATPSIB201.LBN_LEHDBX100.0BYTE 100 RECVENOFig. 05: FB200: Calling FC6 AG_RECVThe output parameter NDR is for showing that new data was received. The output parameter LEN in dicates the len gth of the data received.If the data is not successfully received, the n the value of the output parameter is saved and evaluated.(填写文档类型:常问问题)P11-12Service & SupportSIEMENSSIEMENSNetswrk 10 :STATUSit function completed with HRPORSTATUSMOVEENOUT#RCV_STAT INENO#HCV_STATSAVH_Netcwerk 11 : Wev data recivedfunction block co&pleted with new data received save lengthMOVEENOUTRCV_LEN INEHD#HCY_LENSAVEFig. 06: FB200: STATUS FC6 and length of the received dataIn FB200 there is an evaluati on of how ofte n the releva nt STATUS values occur on the FC5AG_SEND and FC6 AG_RCV. This in formation is saved in the statistical in terface parameters of the FB200 in the variable STATISTIC of data type Structure.Contents Of; 1 Environment Insr fSTAT STATISTIC-IS腭祥删mNT-aareDm2 TypeAddressXBt.al Value:S 0N_OFF囹 ON_OFFBool0.0FALSE目 V_0x8193伺 V_0xei3Int2. 00旦 V_a8302口 V_Oje&30ZInt4. 旦 V_0K33a也 |v_oxeso4lilt6, 0Q目 V_0x8OCl曰 voxeaciInc8.口0国 V_0x9OCE国 V_Ox&0C2Int10.00-旦 V_080C3W VQX80C3Int0旦 V_OxSOC4目 v oxeociInt14. 00Fig. 07: Statistical variable STATISTIC of data type Structuret is possible to switch on/off the STATUS evaluation via the variable #STATISTIC.ON_OFF.Network 2 : Svitchqh/qIfta monitor STATUS valusComment:TRUH#STATISTIC.ON OFF(填写文档类型:常问问题)P#-12Service & SupportSIEMENS(填写文档类型:常问问题)P#-12Service & SupportSIEMENSFig. 08: Switch STATUS evaluation on or offSpecial case:If the data exchange takes place via a TCP connection then the output parameter NDR is only set if the en tire receive buffer has bee n filled.The value of the output parameter LEN thus always indicates the total length of the receive buffer! The STEP 7 project for dow nl oadi ng:The STEP 7 project includes a sample program for calling FC5 and FC6 with status evaluation. It was created with STEP 7 V5.4 SP3.S7_300_SFND_RCV zip ( 44 KB ) IMPORTANT!HThis program/example is freeware. Any user can use, copy and forward this program FREE OF CHARGE. The authors and owners of this program take no resp on sibility whatsoever for thefunctionality and compatibility of this software. Use of the software is at the users own risk. Since this software is free of charge, there is absolutely no warra nty nor en titleme nt to error correct ionandhotl ine support .Keywords:FUP, SEND/RECEIVE, Sample program, STEP 7 con figuratio n. Data tran sferEntry ID: 17853532Date: 2008-07-03(填写文档类型:常问问题)P13-12
展开阅读全文
相关资源
相关搜索

最新文档


当前位置:首页 > 办公文档 > 解决方案


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!