show the entry list
Industrial Ethernet S7-300/400 CPs -- Configuring and programming communication -- Using communication blocks
How do you use the predefined data type UDT1 "FILE_DB_HEADER" for FTP communication in the S7-300 and S7-400?
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")
S7-300 CPU 31x -- Configuring and programming communication -- Using communication blocks
What is the volume of data that you can transfer with function blocks FB34 "GET_E" and FB35 "PUT_E"?
How do you cyclically read out the 8 channels of the FM 350-2 counter module as quickly as possible?
How do you read out the IP address of the S7-300 CPU in the user program at runtime?
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 the integrated PROFINET interface of the S7-300 and S7-400 CPUs and IM151-8 PN/DP CPU in STEP 7 Professional (TIA Portal)?
Which security modules can be reached with SOFTNET Security Client V4 over a secure IPsec tunnel connection?
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?
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 implement chronological messaging with S7-300 CPUs and WinCC?
How do you program communication blocks FB14 "GET" and FB15 "PUT" for data exchange in the S7 program of an S7-300 CPU?
How can you read out diagnostics data from a SIRIUS 3RK3 modular safety system using a S7-300/400 CPU?
Which ports are released for Modbus/TCP communication and how many Modbus clients can communicate with a SIMATIC S7 CPU as Modbus server?
How do you configure a specified and an unspecified S7 connection for data exchange between S7-300 and/or S7-400 by way of Industrial Ethernet CPs?
What restrictions are there for active jobs when communicating with SFC 58 / SFC 59 and SFB 52 / SFB 53 via PROFIBUS DP and PROFINET IO?
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 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 the communication blocks FB63 "TSEND", FB64 "TRCV", FB65 "TCON" and FB66 "TDISCON" in order to use the TCP protocol for data exchange by means of the integrated PROFINET interface of an S7-300 or S7-400 CPU?
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 FB67 "TUSEND", FB68 "TURCV", FB65 "TCON" and FB66 "TDISCON" in order to use the UDP protocol for data exchange by means of the integrated PROFINET interface of a CPU?
How does data communication work between S7-300/S7- 400 and S7-200 via MPI using S7 basic communication?
How great is data consistency in the PUT and GET S7 communication functions for the individual S7-300 CPUs and C7 complete devices?
How can you access via PROFIBUS DP another CPU, which is connected to the PROFIBUS DP as a slave, from a DP master using basic communication with SFC72 "I_GET" and SFC73 "I_PUT"?
How can you access consistent data without SFC14/15 as part of the process image?
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 communication blocks FB12 "BSEND" and FB13 "BRCV" for data exchange in the S7 program of an S7-300 CPU?
Part number:

Instructions
Communication blocks FB12 "BSEND" and FB13 "BRCV" have to be called in the program in order to transfer data between two S7-300 stations by way of an S7 connection configured in NetPro. The S7 connection has to be configured on both sides, because the S7 communication by way of FB12 "USEND" and FB13 "URCV" is based on the client-client principle.

Features of the communication blocks FB12 "BSEND" and FB13 "BRCV"

  • The FB12 and FB13 function blocks are asynchronous communication functions.
  • In this example, the blocks are called in the OB1 cycle (see also Entry ID: 2795485).
  • The FB12 and FB13 function blocks run for several OB1 cycles.
  • The FB12 function block is activated by the "REQ" input parameter.
  • The FB13 function block is activated by the "EN_R" input parameter.
  • The end of the job is indicated by "DONE", "NDR" or "ERROR".
  • BSEND and BRCV can communicate simultaneously through one connection.
  • The latest version of the FB12 "BSEND" and FB13 "BRCV" communication blocks for data exchange by way of a CP343-1 or CP342-5 is available in the SIMATIC_NET_CP library under "CP 300 > Blocks".
  • The latest version of the FB12 "BSEND" and FB13 "BRCV" communication blocks with the "CPU_300" family for data exchange by way of the integrated PROFINET interface of a S7-300 CPU, IM151-8 PN/DP CPU or IM154-8 CPU is available in the Standard Library under "Communication Blocks > Blocks".

Description of the sample program
The S7 program contains the call of the communication blocks FB12 "BSEND" and FB13 "BRCV" from the Standard Library. The FB12 "BSEND" function block is for sending data and the FB13 "BRCV" function block is for receiving data.
The sample program shows the functions of the FB12 "BSEND" and FB15 "BRCV" communication blocks using an S7 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 an S7 connection for the CPU in NetPro. You can configure a specified S7 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 S7 connection is configured. Make sure you assign the IP address or PROFIBUS address correctly when you configure the S7 connection. You also need to make sure you assign the rack/slot and connection resource correctly. These are for clearly identifying the S7 connection between the communication partners.

You find the value that must be specified for the "ID" input parameter of communication blocks FB12 "BSEND" and FB13 "BRCV" in the Properties dialog of the S7 connection -> tab "General".

 
Fig. 01

The STEP 7 program consists of blocks OB100, OB1, FB105, DB105, DB200, DB201, FB12 and FB13.

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. FB105 is called in this OB (instance data block: DB105) with M0.3 "START-UP" as parameter (INIT_COM). After FB105 has been run the M0.3 "START-UP" is reset.


Fig. 02

FB105
FB105 is called in the OB1 cycle. The FB12 "BSEND" and FB13 "BRCV" communication block calls are in FB105.

At the "ID" input parameter of the communication blocks you must specify the connection number of the S7 connection configured in NetPro. The value for the "ID" input parameter must be taken from the Properties dialog of the S7 connection configured in NetPro (see Fig. 01).
You can change the connection number separately in FB105. Change the connection number in network 2 of FB105 in accordance with your configuration. The connection number is stored in a static tag and so in the instance data block DB105.
The connection number "1" is defined in this example.


Fig. 03

FB12 is activated by the input parameter "REQ" when the M10.6 clock marker has a positive edge and no job is running. The "REQ" input parameter is reset only when the send job is completed either successfully or with an error.
This locking of the function call is important, because the function is asynchronous and can last several cycles. Continual activation of the function block without waiting for the end of the active job can cause a communication overload.

With the "R_ID" input parameter you define the coherence of a send job and a receive job. The "R_ID" on the FB12 "BSEND" of the sender must match that on the FB13 "BRCV" of the recipient.

At the "SD_1" input parameter of FB12 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 8000.
You enter the length of the data to be sent in bytes at the "LEN" input parameter. You define the length of the data to be sent in Network 1 of FB105. This is stored in a static tag and so in the instance data block DB105.
In this example the length of the data to be sent is 8000 bytes.

The output parameters "DONE", "ERROR" and "STATUS" are required for the job evaluation and are only valid in the same cycle.


Fig. 04

If the send job is completed with an error, then the value of the output parameter "STATUS" of FB12 is saved for error analysis.


Fig. 05

FB13 is activated by the "EN_R" input parameter. The value of the "EN_R" input parameter is always "1" because the marker M0.1 is set to the value "1" in the startup OB100. In this way the S7-300 station is always ready to receive.

With the "R_ID" input parameter you define the coherence of a send job and a receive job. The "R_ID" for FB12 on the Send side and FB13 on the Receive side must match.

At the "RD_1" input parameter you specify the address and length of the data area where the received data is stored (receive buffer), for instance P#DB200.DBX0.0 BYTE 8000.

The "LEN" output parameter indicates the length of the data received in bytes. The output parameters "NDR", "ERROR" and "STATUS" are required for the job evaluation and are only valid in the same cycle.


Fig. 06

If the receive job is completed with an error, then the value of the "STATUS" output parameter of FB13 is saved for error analysis.


Fig. 07

Additional information

  • The manual "System and Standard Functions for S7-300/400 Volume 1/2", Chapter 22 "S7 Communication" provides information, for example, about the volume of data you can transfer using the FB12 "BSEND" and FB13 "BRCV" communication blocks. This manual is available for downloading in Entry ID 44240604.
  • How to configure a specified and an unspecified S7 connection is described in Entry ID: 17628518.

The STEP 7 project as download
The STEP 7 project contains a sample program for calling the FB12 and the FB13 communication blocks. It was created with STEP 7 V5.5.

Sample_S7-300_BSEND_BRCV.zip ( 47 KB )

Note
Copy the latest version of the communication blocks FB12 and FB13 from the SIMATIC_NET_CP library or from the Standard Library into your user program and then call it in your user program.

 Entry ID:18516182   Date:2012-04-18 
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