2024年2月25日发(作者:隋英彦)
ice & Support
怎样使用通讯功能块FC5和FC6?
显示订货号
6ES7810-4CC08..
6GK7342-5..
6GK7343-5..
6GK73431..
SIMATIC S7, STEP7 V5.4
SIMATIC NET, CP342-5 f. S7-300, Profibus
SIMATIC NET, CP343-5 f. S7-300, Profibus
SIMATIC NET, CP 343-1 COMMUNICATIONS PROCESSOR IE
说明:
使用下面的通讯连接,在S7-300中的S7程序中,必须调用通信功能块 FC5 "AG_SEND" 和 FC6
"AG_RECV" 。
• TCP 连接
• ISO-on-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"。
(填写文档类型:常问问题)
P1-12
ice & Support
图一:设置通信连接
STEP7程序包含了OB100, OB1, 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"。
图二OB1
FB200
OB1调用FB200,在FB200中调用通信功能块 FC5 "AG_SEND" 和 FC6 "AG_RECV",在输入参数
(填写文档类型:常问问题)
P2-12
ice & Support
"ACT"输入一个上升沿,来触发发送请求。通过时钟标记M10.7和变量 "SND_BUSY".来控制发送请求。如果发送请求正在运行,这时候"SND_BUSY"被置位,那么触发一个新的发送请求是不可能的。
这个互锁是非常重要的,因为通信是异步的,并且能够持续几个循环周期。持续的触发新的发送请求,而没有等待检查工作是否结束,这将会产生通信过载的错误。
输入参数"ID" 和 "LADDR"的值必须和通信连接的属性对话框中的参数一致(见图一)。在FC5的输入参数 "SEND"中,必须指定被发送的数据区域(发送缓冲区)的地址和长度,例如 P#0.0
BYTE 100 。在输入参数 "LEN"中,需要输入被发送的字节长度(100)。输出参数"DONE",
"ERROR"和 "STATUS"用来表示同一个循环中通讯完成情况及状态。
图三FB200FC5 "AG_SEND" 调用
如果发送请求成功完成,"SND_BUSY"被复位,然后一个新的发送请求能够被再次触发。
如果发送请求产生错误,"SND_BUSY"同样被复位,并且FC5的"STATUS" 输出参数值作为错误记录被保存。
(填写文档类型:常问问题)
P3-12
ice & Support
图四:FB200复位"SND_BUSY" 和保存"STATUS" 。
输入参数"ID" 和 "LADDR"的值必须和通信连接的属性对话框中的参数一致(见图一)。在FC6的输入参数 "RECV"中,必须指定接收的数据区域(接收缓冲区)的地址和长度,例如 P#100.0
BYTE 100 。
图5:FB200调用FC6 "AG_RECV"
输出参数 "NDR" 是表示新数据是否被接收,输出参数"LEN" 表示接收数据的长度。
如果没有成功接收数据,输出参数的值将被保存和分析。
(填写文档类型:常问问题)
P4-12
ice & Support
图6 :FB200:FC6的状态和接收的数据的长度
在FB200中,有对FC5 "AG_SEND" 和 FC6 "AG_RCV"产生的状态值的分析,在数据类型"Structure".的变量"STATISTIC"里保存着FB200的这些统计接口参数。
图7:数据类型"Structure" 的统计变量 "STATISTIC"
通过变量"#_OFF"可以打开/关掉状态分析。
图8:打开/关闭状态分析
特殊情况:
如果通过TCP连接建立数据交换,在整个数据缓存区都被占用的情况下,这个输出参数"NDR"仅仅能被置位。
输出参数 "LEN"的值总是表示了缓冲区的整个长度。
下载的STEP7项目:
这个STEP7 项目包含了一个调用具有状态分析的FC5和FC6 示例程序,它由 STEP 7 V5.4 SP3创建。
S7_300_SEND_ ( 44 KB )
重要!
(填写文档类型:常问问题)
P5-12
ice & Support
这个程序是免费软件,任何用户都可以使用它,拷贝和转载都是免费的,程序的作者不对这个软件的功能和兼容性负责,软件的使用由用户自己负责,因为这个软件是免费的,因此绝对不保证也没有权利来纠正错误和热线支持。
关键字:
FUP, SEND/RECEIVE,FUP, SEND/RECEIVE, 示例程序,STEP7配置,数据传输。
日期:2008-07-16
条目号:17853532
Scroll down for English:
Display part number
6ES7810-4CC08..
6GK7342-5..
6GK7343-5..
6GK73431..
How do you program the communication blocks FC5 and FC6?
SIMATIC S7, STEP7 V5.4
SIMATIC NET, CP342-5 f. S7-300, Profibus
SIMATIC NET, CP343-5 f. S7-300, Profibus
SIMATIC NET, CP 343-1 COMMUNICATIONS PROCESSOR IE
Instructions:
To communicate using one of the following communication connections, you must call the
communication blocks FC5 "AG_SEND" and FC6 "AG_RECV" in the S7 program of the S7-300.
• TCP connection
• ISO-on-TCP communication (RFC 1006)
• ISO transport connection
• UDP connection
• FDL connection
Features of the communication blocks FC5 "AG_SEND" and FC6 "AG_RECV"
•
•
•
•
•
•
•
FC5 and FC6 are asynchronous communication functions.
In this example, the blocks are called in the OB1 cycle (see also Entry ID: 2795485)
They can run over several OB1 cycles.
The FC5 is activated by the input parameter "ACT".
The end of the job is indicated by "DONE" or "ERROR".
AG_SEND and AG_RECV can communicate simultaneously via one connection.
You will find the communication blocks FC5 "AG_SEND" V4.2 and FC6 "AG_RCV" V4.7 in
the SIMATIC_NET_CP library in "CP 300 > Blocks".
Describing a sample program
The S7 program contains the call of the communication blocks FC5 "AG_SEND" and FC6
"AG_RECV" from the SIMATIC_NET_CP library. The FC5 "AG_SEND" is for sending data to another
S7 station, to a PC station, or to a third-party system. The FC6 "AG_RECV" is for receiving data from
another S7 station, from a PC station, or from a third-party system.
The sample program shows the functions of the communication blocks FC5 "AG_SEND" and FC6
"AG_RCV" using an ISO-on-TCP connection.
First create the hardware configuration for your S7-300 station.
Note:
Configure 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.
Configure one of the above-mentioned communication blocks for the CPU in NetPro. You can
configure a specified communication connection if the communication partners are configured
together in a STEP 7 project. If the communication partner is not configured in the same STEP 7
project as the S7-300 station, then an unspecified communication connection is configured. Make
sure you award the IP address or PROFIBUS address correctly when you configure the
(填写文档类型:常问问题)
P6-12
ice & Support
communication connection. You also need to make sure you award the PORT, TSAP or LSAP
correctly. These are for clearly identifying the communication connection between the communication
partners.
You find the value that must be specified for the input parameters "ID" and "LADDR" of
communication blocks FC5 "AG_SEND" and FC6 "AG_RECV" in the Properties dialog of the
communication connection -> tab "General".
Fig. 01: Configuring the communication connection
The STEP 7 program consists of blocks OB100, OB1, 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
communication trigger is enabled with marker 0.3 "START-UP".
OB1:
OB1 is called cyclically. The call of FB200 is in this OB (instance data block: DB200) with M0.3
"START-UP" as parameter (INIT_COM). After FB200 was run there is a reset with M0.3 "START-UP".
(填写文档类型:常问问题)
P7-12
ice & Support
Fig. 02: OB1
FB200
The FB200 is called in the OB1 cycle. You find the call of communication blocks FC5 "AG_SEND"
and FC6 "AG_RECV" in the FB200. The send request is triggered via a positive edge on the input
parameter "ACT". The send request trigger is controlled 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 then possible.
This locking is particularly important, 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 communication overload.
The values for the input parameters "ID" and "LADDR" must be adopted from the Properties dialog of
the communication connection in NetPro (see Fig. 1). On the input parameter "SEND" of the FC5 you
specify the address and length of the data area that contains the data to be sent (send buffer), for
instance: P#0.0 BYTE 100. On the input parameter "LEN", you enter the number of bytes
to be sent (100). The output parameters "DONE", "ERROR", and "STATUS" are required for the job
evaluation and are only valid in the same cycle.
(填写文档类型:常问问题)
P8-12
ice & Support
Fig. 03: FB200: Calling the FC5 "AG_SEND"
If 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 analysis.
(填写文档类型:常问问题)
P9-12
ice & Support
Fig. 04: FB200: Resetting "SND_BUSY" and saving "STATUS"
The values for the input parameters "ID" and "LADDR" must be adopted from the Properties dialog of
the communication connection in NetPro (see Fig. 1). On the input parameter "RECV" of the FC6 you
specify the address and length of the data area that contains the data received (receive buffer), for
instance: P#100.0 BYTE 100.
Fig. 05: FB200: Calling FC6 "AG_RECV"
The output parameter "NDR" is for showing that new data was received. The output parameter "LEN"
indicates the length of the data received.
If the data is not successfully received, then the value of the output parameter is saved and
evaluated.
(填写文档类型:常问问题)
P10-12
ice & Support
Fig. 06: FB200: STATUS FC6 and length of the received data
In FB200 there is an evaluation of how often the relevant STATUS values occur on the FC5
"AG_SEND" and FC6 "AG_RCV". This information is saved in the statistical interface parameters of
the FB200 in the variable "STATISTIC" of data type "Structure".
Fig. 07: Statistical variable "STATISTIC" of data type "Structure"
It is possible to switch on/off the STATUS evaluation via the variable "#_OFF.
Fig. 08: Switch STATUS evaluation on or off
Special case:
If the data exchange takes place via a TCP connection then the output parameter "NDR" is only set if
the entire receive buffer has been filled.
The value of the output parameter "LEN" thus always indicates the total length of the receive buffer!
The STEP 7 project for downloading:
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_SEND_ ( 44 KB )
IMPORTANT!
This 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 responsibility whatsoever for the
(填写文档类型:常问问题)
P11-12
Entry ID:17853532
Service & Support
functionality and compatibility of this software. Use of the software is at the user's own risk. Since this
software is free of charge, there is absolutely no warranty nor entitlement to error correction and
hotline support.
Keywords:
FUP, SEND/RECEIVE, Sample program, STEP 7 configuration, Data transfer
Date:2008-07-03
(填写文档类型:常问问题)
P12-12
2024年2月25日发(作者:隋英彦)
ice & Support
怎样使用通讯功能块FC5和FC6?
显示订货号
6ES7810-4CC08..
6GK7342-5..
6GK7343-5..
6GK73431..
SIMATIC S7, STEP7 V5.4
SIMATIC NET, CP342-5 f. S7-300, Profibus
SIMATIC NET, CP343-5 f. S7-300, Profibus
SIMATIC NET, CP 343-1 COMMUNICATIONS PROCESSOR IE
说明:
使用下面的通讯连接,在S7-300中的S7程序中,必须调用通信功能块 FC5 "AG_SEND" 和 FC6
"AG_RECV" 。
• TCP 连接
• ISO-on-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"。
(填写文档类型:常问问题)
P1-12
ice & Support
图一:设置通信连接
STEP7程序包含了OB100, OB1, 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"。
图二OB1
FB200
OB1调用FB200,在FB200中调用通信功能块 FC5 "AG_SEND" 和 FC6 "AG_RECV",在输入参数
(填写文档类型:常问问题)
P2-12
ice & Support
"ACT"输入一个上升沿,来触发发送请求。通过时钟标记M10.7和变量 "SND_BUSY".来控制发送请求。如果发送请求正在运行,这时候"SND_BUSY"被置位,那么触发一个新的发送请求是不可能的。
这个互锁是非常重要的,因为通信是异步的,并且能够持续几个循环周期。持续的触发新的发送请求,而没有等待检查工作是否结束,这将会产生通信过载的错误。
输入参数"ID" 和 "LADDR"的值必须和通信连接的属性对话框中的参数一致(见图一)。在FC5的输入参数 "SEND"中,必须指定被发送的数据区域(发送缓冲区)的地址和长度,例如 P#0.0
BYTE 100 。在输入参数 "LEN"中,需要输入被发送的字节长度(100)。输出参数"DONE",
"ERROR"和 "STATUS"用来表示同一个循环中通讯完成情况及状态。
图三FB200FC5 "AG_SEND" 调用
如果发送请求成功完成,"SND_BUSY"被复位,然后一个新的发送请求能够被再次触发。
如果发送请求产生错误,"SND_BUSY"同样被复位,并且FC5的"STATUS" 输出参数值作为错误记录被保存。
(填写文档类型:常问问题)
P3-12
ice & Support
图四:FB200复位"SND_BUSY" 和保存"STATUS" 。
输入参数"ID" 和 "LADDR"的值必须和通信连接的属性对话框中的参数一致(见图一)。在FC6的输入参数 "RECV"中,必须指定接收的数据区域(接收缓冲区)的地址和长度,例如 P#100.0
BYTE 100 。
图5:FB200调用FC6 "AG_RECV"
输出参数 "NDR" 是表示新数据是否被接收,输出参数"LEN" 表示接收数据的长度。
如果没有成功接收数据,输出参数的值将被保存和分析。
(填写文档类型:常问问题)
P4-12
ice & Support
图6 :FB200:FC6的状态和接收的数据的长度
在FB200中,有对FC5 "AG_SEND" 和 FC6 "AG_RCV"产生的状态值的分析,在数据类型"Structure".的变量"STATISTIC"里保存着FB200的这些统计接口参数。
图7:数据类型"Structure" 的统计变量 "STATISTIC"
通过变量"#_OFF"可以打开/关掉状态分析。
图8:打开/关闭状态分析
特殊情况:
如果通过TCP连接建立数据交换,在整个数据缓存区都被占用的情况下,这个输出参数"NDR"仅仅能被置位。
输出参数 "LEN"的值总是表示了缓冲区的整个长度。
下载的STEP7项目:
这个STEP7 项目包含了一个调用具有状态分析的FC5和FC6 示例程序,它由 STEP 7 V5.4 SP3创建。
S7_300_SEND_ ( 44 KB )
重要!
(填写文档类型:常问问题)
P5-12
ice & Support
这个程序是免费软件,任何用户都可以使用它,拷贝和转载都是免费的,程序的作者不对这个软件的功能和兼容性负责,软件的使用由用户自己负责,因为这个软件是免费的,因此绝对不保证也没有权利来纠正错误和热线支持。
关键字:
FUP, SEND/RECEIVE,FUP, SEND/RECEIVE, 示例程序,STEP7配置,数据传输。
日期:2008-07-16
条目号:17853532
Scroll down for English:
Display part number
6ES7810-4CC08..
6GK7342-5..
6GK7343-5..
6GK73431..
How do you program the communication blocks FC5 and FC6?
SIMATIC S7, STEP7 V5.4
SIMATIC NET, CP342-5 f. S7-300, Profibus
SIMATIC NET, CP343-5 f. S7-300, Profibus
SIMATIC NET, CP 343-1 COMMUNICATIONS PROCESSOR IE
Instructions:
To communicate using one of the following communication connections, you must call the
communication blocks FC5 "AG_SEND" and FC6 "AG_RECV" in the S7 program of the S7-300.
• TCP connection
• ISO-on-TCP communication (RFC 1006)
• ISO transport connection
• UDP connection
• FDL connection
Features of the communication blocks FC5 "AG_SEND" and FC6 "AG_RECV"
•
•
•
•
•
•
•
FC5 and FC6 are asynchronous communication functions.
In this example, the blocks are called in the OB1 cycle (see also Entry ID: 2795485)
They can run over several OB1 cycles.
The FC5 is activated by the input parameter "ACT".
The end of the job is indicated by "DONE" or "ERROR".
AG_SEND and AG_RECV can communicate simultaneously via one connection.
You will find the communication blocks FC5 "AG_SEND" V4.2 and FC6 "AG_RCV" V4.7 in
the SIMATIC_NET_CP library in "CP 300 > Blocks".
Describing a sample program
The S7 program contains the call of the communication blocks FC5 "AG_SEND" and FC6
"AG_RECV" from the SIMATIC_NET_CP library. The FC5 "AG_SEND" is for sending data to another
S7 station, to a PC station, or to a third-party system. The FC6 "AG_RECV" is for receiving data from
another S7 station, from a PC station, or from a third-party system.
The sample program shows the functions of the communication blocks FC5 "AG_SEND" and FC6
"AG_RCV" using an ISO-on-TCP connection.
First create the hardware configuration for your S7-300 station.
Note:
Configure 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.
Configure one of the above-mentioned communication blocks for the CPU in NetPro. You can
configure a specified communication connection if the communication partners are configured
together in a STEP 7 project. If the communication partner is not configured in the same STEP 7
project as the S7-300 station, then an unspecified communication connection is configured. Make
sure you award the IP address or PROFIBUS address correctly when you configure the
(填写文档类型:常问问题)
P6-12
ice & Support
communication connection. You also need to make sure you award the PORT, TSAP or LSAP
correctly. These are for clearly identifying the communication connection between the communication
partners.
You find the value that must be specified for the input parameters "ID" and "LADDR" of
communication blocks FC5 "AG_SEND" and FC6 "AG_RECV" in the Properties dialog of the
communication connection -> tab "General".
Fig. 01: Configuring the communication connection
The STEP 7 program consists of blocks OB100, OB1, 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
communication trigger is enabled with marker 0.3 "START-UP".
OB1:
OB1 is called cyclically. The call of FB200 is in this OB (instance data block: DB200) with M0.3
"START-UP" as parameter (INIT_COM). After FB200 was run there is a reset with M0.3 "START-UP".
(填写文档类型:常问问题)
P7-12
ice & Support
Fig. 02: OB1
FB200
The FB200 is called in the OB1 cycle. You find the call of communication blocks FC5 "AG_SEND"
and FC6 "AG_RECV" in the FB200. The send request is triggered via a positive edge on the input
parameter "ACT". The send request trigger is controlled 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 then possible.
This locking is particularly important, 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 communication overload.
The values for the input parameters "ID" and "LADDR" must be adopted from the Properties dialog of
the communication connection in NetPro (see Fig. 1). On the input parameter "SEND" of the FC5 you
specify the address and length of the data area that contains the data to be sent (send buffer), for
instance: P#0.0 BYTE 100. On the input parameter "LEN", you enter the number of bytes
to be sent (100). The output parameters "DONE", "ERROR", and "STATUS" are required for the job
evaluation and are only valid in the same cycle.
(填写文档类型:常问问题)
P8-12
ice & Support
Fig. 03: FB200: Calling the FC5 "AG_SEND"
If 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 analysis.
(填写文档类型:常问问题)
P9-12
ice & Support
Fig. 04: FB200: Resetting "SND_BUSY" and saving "STATUS"
The values for the input parameters "ID" and "LADDR" must be adopted from the Properties dialog of
the communication connection in NetPro (see Fig. 1). On the input parameter "RECV" of the FC6 you
specify the address and length of the data area that contains the data received (receive buffer), for
instance: P#100.0 BYTE 100.
Fig. 05: FB200: Calling FC6 "AG_RECV"
The output parameter "NDR" is for showing that new data was received. The output parameter "LEN"
indicates the length of the data received.
If the data is not successfully received, then the value of the output parameter is saved and
evaluated.
(填写文档类型:常问问题)
P10-12
ice & Support
Fig. 06: FB200: STATUS FC6 and length of the received data
In FB200 there is an evaluation of how often the relevant STATUS values occur on the FC5
"AG_SEND" and FC6 "AG_RCV". This information is saved in the statistical interface parameters of
the FB200 in the variable "STATISTIC" of data type "Structure".
Fig. 07: Statistical variable "STATISTIC" of data type "Structure"
It is possible to switch on/off the STATUS evaluation via the variable "#_OFF.
Fig. 08: Switch STATUS evaluation on or off
Special case:
If the data exchange takes place via a TCP connection then the output parameter "NDR" is only set if
the entire receive buffer has been filled.
The value of the output parameter "LEN" thus always indicates the total length of the receive buffer!
The STEP 7 project for downloading:
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_SEND_ ( 44 KB )
IMPORTANT!
This 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 responsibility whatsoever for the
(填写文档类型:常问问题)
P11-12
Entry ID:17853532
Service & Support
functionality and compatibility of this software. Use of the software is at the user's own risk. Since this
software is free of charge, there is absolutely no warranty nor entitlement to error correction and
hotline support.
Keywords:
FUP, SEND/RECEIVE, Sample program, STEP 7 configuration, Data transfer
Date:2008-07-03
(填写文档类型:常问问题)
P12-12