You are on page 1of 5

How do you program communication blocks FB14 "GET" and FB15 "PUT" for data exchange in the S7 program

of an S7-300
CPU?
Instructions
Communication blocks FB14 "GET" and FB15 "PUT" 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 does not have to be configured on both sides,
because the S7 communication via FB14 "GET" and FB15 "PUT" is based on the server-client principle.
Features of the communication blocks FB14 "GET" and FB15 "PUT"
The FB14 and FB15 function blocks are asynchronous communication functions.
In this example, the blocks are called in the OB1 cycle (see also Entry ID: 2795485).
The FB14 and FB15 function blocks run for several OB1 cycles.
The FB14 and FB15 function blocks are activated by the "REQ" input parameter.
The end of the job is indicated by "DONE", "NDR" or "ERROR".
PUT and GET can communicate simultaneously by way of one connection.
The latest version of the FB14 "GET" and FB15 "PUT" 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 FB14 "GET" and FB15 "PUT" 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 FB14 "GET" and FB15 "PUT" from the Standard Library. Function
block FB14 "GET" is for reading data out of a remote CPU and function block FB15 "PUT" is for writing data to a remote CPU.
The sample program shows the functions of the FB14 "GET" and FB15 "PUT" 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 read and write job 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 FB14 "GET" and FB15 "PUT" in the
Properties dialog of the S7 connection -> tab "General".

Fig. 01
The STEP 7 program consists of blocks OB100, OB1, FB115, DB115, DB200, DB201, FB14 and FB15.
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. FB115 is called in this OB (instance data block: DB115) with M0.3 "START-UP" as parameter (INIT_COM).
After FB115 has been run the M0.3 "START-UP" is reset.

Fig. 02
FB115
FB115 is called in the OB1 cycle. The FB14 "GET" and FB15 "PUT" communication block calls are in FB115.
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 FB115. Change the connection number in network 1 of FB115 in accordance
with your configuration. The connection number is stored in a static tag and so in the instance data block DB115.
The connection number "1" is defined in this example.

Fig. 03
FB14 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 read job is completed either successfully or with an error. This means that a new
read job can only be triggered once the running job has been completed.
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.
The "ADDR_1" parameter refers to a data area in the remote CPU that is written to or read from, for instance: P#DB201.DBX0.0
BYTE 200. For the "RD_1" parameter you must specify the data area for the data read, for instance: P#DB200.DBX0.0 BYTE 100.
The output parameters "NDR", "ERROR" and "STATUS" are required for the job evaluation and are only valid in the same cycle.

Fig. 04
If the read job is completed with an error, then the value of the output parameter "STATUS" of FB14 is saved for error analysis.

Fig. 05
FB15 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 write job is completed either successfully or with an error. This means that a new
write job can only be triggered once the running job has been completed.
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.
The "ADDR_1" parameter refers to a data area in the remote CPU that is written to or read from, for instance: P#DB200.DBX0.0
BYTE 20. For the "SD_1" parameter you must specify the data area for the data to be sent, for instance: P#DB201.DBX0.0 BYTE
20. The output parameters "DONE", "ERROR" and "STATUS" are required for the job evaluation and are only valid in the same
cycle.

Fig. 06
If the write job is completed with an error, then the value of the output parameter "STATUS" of FB15 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 FB14 "GET" and FB15 "PUT" communication blocks. This manual is
available for downloading in Entry ID 44240604. ".
Entry ID 17628518 includes a description of how to configure a specified and unspecified
S7 connection.
The STEP 7 project as download
The STEP 7 project contains a sample program for calling the FB14 and the FB15 communication blocks. It was created with STEP
7 V5.5.
Sample_S7-300_PUT_GET.zip ( 197 KB )
Note
Copy the latest version of the communication blocks FB14 and FB15 from the SIMATIC_NET_CP library or from the Standard
Library into your user program and then call it in your user program.

You might also like