show the entry list
Industrial Ethernet S7-300/400 CPs -- Configuring and programming communication -- Using communication blocks
How do you enable the ad-hoc mode when you call the TRCV instruction?
How do you use the blocks for MODBUS/TCP communication over an Industrial Ethernet CP of S7-300 and S7-400 in STEP 7 Professional (TIA Portal)?
How do you copy the CFC chart "Modbus" from the sample project for OPEN MODBUS / TCP into your user project?
What is the difference between the initialization and runtime parameters on the blocks for Modbus TCP?
Why is the status value A090 (hex) output for Modbus TCP although you have entered the correct license?
What are the differences between the licensed version and the downloadable demo version of the blocks for Modbus TCP?
Why is the value A083 (hex) output permanently at the STATUS output parameter of the block for Modbus TCP when the ENQ_ENR=true input parameter has been set?
How is data with variable message length transferred via the TCP protocol and received by an S7-300 station via the Industrial Ethernet CP?
How do you program the function blocks FB14 "GET" and FB15 "PUT" in the S7 program of the S7-300 in order to transfer more than 160 bytes of data?
Where can you find sample programs and documentation for communication from SIMATIC S5 modules to SIMATIC S7 modules via Industrial Ethernet using the UDP protocol?
Where can you find sample programs and documentation for communication from SIMATIC S5 modules to SIMATIC S7 modules via Industrial Ethernet using the TCP protocol?
Where can you find sample programs and documentation for communication from SIMATIC S5 modules to SIMATIC S7 modules via Industrial Ethernet using the ISO transport protocol?
How do you program the FC10 "AG_CNTRL"?
Which commands (CMD) of the FC10 "AG_CNTRL" are supported by the IE CPs?
How many communication jobs may be used simultaneously in an S7-300 CPU for S7 communication via a CP343-1?
Which ports are released for Modbus/TCP communication and how many Modbus clients can communicate with a SIMATIC S7 CPU as Modbus server?
Notes on using an instance for multiple connection IDs
Internal call of FC5 (AG_SEND) with FTP client blocks (FC 40-44) for the CP343-1 IT (6GK7 343-1GX11-0XE0)
How do you program the communication blocks FB63 "TSEND", FB64 "TRECV", FB65 "TCON" and FB66 "TDISCON" in order to use the ISO-on-TCP protocol for data exchange by way of the integrated PROFINET interface of a CPU or by way of the CP443-1 Advanced?
How do you program communication blocks FC11 and FC12 for the PROFINET IO device?
Block calls for communications processors in multiple runtime layers
Changing the input parameter of the user blocks "AG_SEND" and "AG_RECV" during the runtime of a job
What should you watch out for if you transfer variables with the data type "REAL" when calling the communication blocks FC5/50 "AG_SEND/AG_LSEND" and FC6/60 "AG_RCV/AG_LRCV"?
What should you pay attention to when using the communication blocks FC53 "AG_SSEND" and FC63 "AG_SRECV"?
What points do you need to remember when calling communication blocks FC5/50 and FC6/60 in the STEP 7 user program of the CPU?
How do you program communication blocks FC11 and FC12 for the PROFINET IO controller?
How do you establish OPEN MODBUS / TCP communication from a SIMATIC S7 and where can you find further information?
How do you program the communication blocks FC50 and FC60?
Error STATUS "0x7000" on function block FC6 / FC60 (AG_SEND) with Send/Receive communication on the S7-400 controller
How do you program the communication blocks FC5 and FC6?
Sample program: S7 communication with the blocks SFB14 ("GET") and SFB15 ("PUT") with S7-400
Sample Program: S7 Communication with blocks FB14 ("GET") und FB15 ("PUT") of the CPU 317-2PN/DP
How do you program communication blocks FB8 "USEND" and FB9 "URCV" for data exchange on the S7-300?
"STATUS = 27" (0x001B) with the loadable S7 communication on the S7-300
How do you program communication blocks FB14 "GET" and FB15 "PUT" for data exchange in the S7 program of an S7-300 CPU?
How do you program communication blocks FB12 "BSEND" and FB13 "BRCV" for data exchange in the S7 program of an S7-300 CPU?
Repeating the "BSEND" job (SFB12) when the "BRCV" block (SFB13) is in the "disabled" state ("EN_R = 0")
PROFIBUS S7-300/400 CPs -- Configuring and programming communication -- Using communication blocks
How do you program the communication blocks FC50 and FC60?
How do you program communication blocks FB12 "BSEND" and FB13 "BRCV" for data exchange in the S7 program of an S7-300 CPU?
How do you program communication blocks FB14 "GET" and FB15 "PUT" for data exchange in the S7 program of an S7-300 CPU?
Which blocks for Modbus TCP can you rename or re-wire when the block numbers of the Modbus blocks are already being used in the user program?
How do you program the function blocks FB14 "GET" and FB15 "PUT" in the S7 program of the S7-300 in order to transfer more than 160 bytes of data?
Where can you find sample programs and documentation for using the PROFIBUS DP protocol for data communication between SIMATIC S5 modules and SIMATIC S7 modules?
Where can you find sample programs and documentation for communication from SIMATIC S5 modules to SIMATIC S7 modules by way of PROFIBUS using the free Layer 2 of the FDL protocol?
Where can you find sample programs and documentation for communication from SIMATIC S5 modules to SIMATIC S7 modules by way of PROFIBUS using the FDL protocol?
Where can you find sample programs and documentation for using the PROFIBUS FMS protocol for data communication between SIMATIC S5 modules and SIMATIC S7 modules as well as for data communication between SIMATIC S5 modules and PCs?
Notes on using an instance for multiple connection IDs
Processing the data from DP slaves via CP342-5 on CPU31x
Block calls for communications processors in multiple runtime layers
Changing the input parameter of the user blocks "AG_SEND" and "AG_RECV" during the runtime of a job
What should you watch out for if you transfer variables with the data type "REAL" when calling the communication blocks FC5/50 "AG_SEND/AG_LSEND" and FC6/60 "AG_RCV/AG_LRCV"?
How do you program the communication blocks FC5 and FC6?
What properties and special features does S7 Basis Communication offer?
PROFIBUS: diagnostics of S7 connections with STEP 7
Repeating the "BSEND" job (SFB12) when the "BRCV" block (SFB13) is in the "disabled" state ("EN_R = 0")
How do you program communication blocks FB8 "USEND" and FB9 "URCV" for data exchange on the S7-300?
Particularities when assigning parameters of the communication blocks of CP 342 / CP 343
What should you watch out for when upgrading the CP 342-5 or fitting spare parts?
Which version of the function blocks do you need to operate a CP 342-5?
CP 342-5 -- How can you tell that the CP 342-5 has withdrawn from the PROFIBUS?
CP 342-5 -- How do you program data communications when your DP slave only has outputs?
CP 342-5 -- How can you read and write consistent data of a DP slave via the CP 342-5?
How do you program the communication blocks FC5 and FC6?
Part number:

Instructions
Table 01 shows which communication connections in the S7-300 are used for data exchange over communication processors (CPs) and which CPs support the communication connections.
To communicate using one of the communication connections listed in Table 01, you must call the communication blocks FC5 "AG_SEND" and FC6 "AG_RECV" in the S7 program of the S7-300.
 
Communication connection CP Order number Remark
  • TCP connection
  • ISO-on-TCP communication
    (RFC 1006)
  • UDP connection
CP343-1
Lean
6GK7343-1CX10-0XE0
6GK7343-1CX00-0XE0
More information about the TCP, ISO-on-TCP (RFC 1006) and UDP protocols is available in Entry IDs 26171811, 26484227 and 26484229.
CP343-1
Standard
6GK7343-1EX30-0XE0
6GK7343-1EX21-0XE0
6GK7343-1EX20-0XE0
6GK7343-1EX11-0XE0
CP343-1
Advanced
6GK7343-1GX30-0XE0
6GK7343-1GX31-0XE0
6GK7343-1GX21-0XE0
CP343-1 IT 6GK7343-1GX20-0XE0
6GK7343-1GX11-0XE0
  • ISO transport connection
CP343-1
Standard
6GK7343-1EX21-0XE0
6GK7343-1EX30-0XE0
6GK7343-1EX11-0XE0
More information about the ISO transport protocol is available in Entry ID: 26582267.
CP343-1
Advanced
6GK7343-1GX31-0XE0
6GK7343-1GX30-0XE0
6GK7343-1GX21-0XE0
CP343-1 IT 6GK7343-1GX11-0XE0
  • FDL connection
CP342-5 6GK7342-5DA03-0XE0
6GK7342-5DA02-0XE0
6GK7342-5DA01-0XE0
6GK7342-5DA00-0XE0
More information about the FDL protocol is available in Entry ID: 26098555.
CP342-5 FO 6GK7342-5DF00-0XE0
CP343-5 6GK7343-5FA01-0XE0
6GK7343-5FA00-0XE0
Table 01

 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 by way of one connection.
  • The latest version the communication blocks FC5 "AG_SEND" and FC6 "AG_RCV" is available in the "SIMATIC_NET_CP" library under "CP 300 > Blocks".

Description of the 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 assign the IP address or PROFIBUS address correctly when you configure the communication connection. You also need to make sure you assign the PORT, TSAP or LSAP correctly. These are for clearly identifying the communication connection between the communication partners.

The value that must be specified for the input parameters "ID" and "LADDR" of communication blocks FC5 "AG_SEND" and FC6 "AG_RECV" is in the Properties dialog of the communication connection -> "General" tab.


Fig. 01

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. FB200 is called 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".


Fig. 02

FB200
FB200 is called in the OB1 cycle. The call of communication blocks FC5 "AG_SEND" and FC6 "AG_RECV" is in the FB200.

FC5 "AG_SEND" parameters
The send request is triggered via a positive edge at 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 taken from the Properties dialog of the communication connection in NetPro (see Fig. 01).
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#DB201.DBX0.0 BYTE 100.
You enter the length of the data to be sent in bytes at the input parameter "LEN". In this example, the length of the data to be sent is 100 bytes.
The output parameters "DONE", "ERROR" and "STATUS" are required for the job evaluation and are only valid in the same cycle.


Fig. 03

If the send request is successfully completed, "SND_BUSY" is reset. A new send job 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.


Fig. 04

FC6 "AG_RECV" parameters
The values for the input parameters "ID" and "LADDR" must be taken from the Properties dialog of the communication connection in NetPro (see Fig. 01). At 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#DB201.DBX100.0 BYTE 100.


Fig. 05

The output parameter "NDR" is for showing that new data has been 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.

 
Fig. 06

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

It is possible to switch on/off the STATUS evaluation by means of the variable "#STATISTIC.ON_OFF. The STATUS evaluation is switched on by default.


Fig. 08

Special case
If the data exchange takes place by way of 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 as download
The STEP 7 project contains a sample program for calling the FC5 and the FC6 with status evaluation. It was created with STEP 7 V5.4 SP3.

S7_300_SEND_RCV.zip ( 45 KB )

Note
Copy the latest version of the communication blocks FC5 and FC6 from the SIMATIC_NET_CP library into your user program and then call it in your user program.

Additional Keywords
FUP, SEND/RECEIVE, Sample program, STEP 7 configuration, Data transfer

 Entry ID:17853532   Date:2012-10-17 
I regard this article....as helpfulas not helpful                                 
mySupport
My Documentation Manager 
Newsletter 
CAx-Download-Manager 
Support Request
To this entry
Print
Create PDF 
Send to a friend
QuickLinks
Compatibility tool 
Topics
Help
Online Help
Guided Tour