Description: Direct access is made to Layer 2 services in order to exchange data between a SIMATIC S5 (with SINEC CP5431) and a SIMATIC S7 via PROFIBUS. The Layer 2 services are called FDL (Fieldbus Data Link) services.
SINEC L2 is former designation for PROFIBUS. SINEC L2 supports baud rates from 9.6 kbit/s to 1.5 Mbit/s. PROFIBUS supports baud rates from 9.6 kbit/s to 12 Mbit/s.
This entry describes how to configure an FDL connection for data exchange between SIMATIC S5 (with SINEC CP5431) and SIMATIC S7 via PROFIBUS.
Configure the FDL connection for the SIMATIC S7 Use the SIMATIC Manager to open your STEP 7 project that contains the SIMATIC S7 controller.
Open the "NetPro" tool via the menu "Options > Configure Network". The FDL connection is configured in NetPro.

Fig. 01
Mark the CPU of the SIMATIC S7-300 station and insert a new connection via the menu "Insert > New Connection...".

Fig. 02
In the "Insert New Connection" dialog, select "Unspecified" under Connection Partner, because the communication partner (SIMATIC S5) is not integrated in the STEP 7 project.
Select "FDL connection" as the connection type. Click "OK" to close the dialog. The Properties dialog of the FDL connection opens.

Fig. 03
Enter a practical name for the FDL connection, e.g. "FDL-S5".

Fig. 04
Switch to the "Addresses" tab. Under Remote you specify the PROFIBUS address of the CP5431 in the SIMATIC S5.
Define the local and remote LSAPs to specify the FDL connection uniquely. You must take the defined LSAPs into account when configuring connections for the SIMATIC S5 (see Fig. 17).

Fig. 05
Confirm the settings with "OK".
If you mark the CPU of the SIMATIC S7 300 station, the FDL connection inserted is displayed in the connection table.

Fig. 06
Check the following PROFIBUS bus parameter and change them if necessary.
- Transmission rate
- Bus profile
Right-click on the PROFIBUS subnetwork and via the "Object Properties..." menu open the "Properties - PROFIBUS" dialog.

Fig. 07
Switch to the "Network Settings" tab. For the FDL connection between SIMATIC S5 and SIMATIC S7, use the "User-defined" bus profile, because the bus parameters are preset by the SIMATIC S5. Click on the "Bus Parameters..." button to open the "Bus Parameters" dialog.

Fig. 08
Change the bus parameters according to the specifications of the CP5431 of the SIMATIC S5 (see Fig. 18). The transmission rate, bus profile and bus parameters must be set the same on all nodes of the PROFIBUS subnetwork.

Fig. 09
Confirm the settings with "OK".
Save and compile the configuration in NetPro via the menu "Network > Save and compile...".
Then load the configuration into the CPU.
Close NetPro and switch to the SIMATIC Manager.
Description of the S7 program An S7-300 is used in this example. You call the communication functions FC5 "AG_SEND" and FC6 "AG_RECV" in the S7 program of the S7-300.
Please follow the instructions below for programming the communication functions FC5 "AG_SEND" and FC6 "AG_RECV".
In the SIMATIC Manager, you open the "Open Project" dialog via the menu "File > Open". Switch to the "Libraries" tab and select the "SIMATIC_NET_CP" library. Click "OK" to close the dialog.

Fig. 10
You will find the communication blocks FC5 "AG_SEND" and FC6 "AG_RCV" in the "SIMATIC_NET_CP" library under "CP 300 > Blocks".
If you are using an S7-400, you call the communication functions FC50 "AG_LSEND" and FC60 "AG_LRECV" in the S7 program. You will find these in the SIMATIC_NET_CP library under "CP 400 > Blocks".

Fig. 11
Copy the communication functions FC5 "AG_SEND" and FC6 "AG_RECV" into the S7 program of the S7-300.
Close the "SIMATIC_NET_CP" library.
In the S7 program, you open the block (e.g. FB or FC) in which the communication functions FC5 "AG_SEND" and FC6 "AG_RECV" are to be called and programmed. The block is called cyclically in OB1.
Add the call of FC5 "AG_SEND" to the program code. The input and output parameters of the FC5 "AG_SEND" are displayed.

Fig. 12
The values for the input parameters "ID" and "LADDR" must be taken from the connection configuration in NetPro. Right-click on the input parameter "ID" and select the menu item "Connections...". The "Block parameters for connection" dialog opens. The values for the input parameters "ID" and "LADDR" are entered automatically.

Fig. 13
Select the FDL connection and click "OK" to close the dialog. The values for the input parameters "ID" and "LADDR" are entered automatically.

Fig. 14
Enter the values for the remaining input and output parameters of FC5 "AG_SEND".
Please follow the instructions below for calling and programming the communication function FC6 "AG_RECV".
A sample program for the call of FC5 "AG_SEND" and FC6 "AG_RECV" might look like this:

Fig. 15
To enable the communication function FC5 "AG_SEND", you set the marker 100.0 in a run OB (e.g. OB100). This triggers communication when the CPU is restarted.
The send job is triggered when clock marker 10.5 has a positive edge and no other send job is already running. Termination of the send job is indicated via the output parameters "DONE" (M15.0) and "ERROR" (M15.1). A new configuration cannot be created when a configuration is already open. When the send job is successfully completed, the status word is saved and evaluated. FC6 "AG_RECV" is called after job evaluation of FC5 "AG_SEND".
Define a sufficient length for the receive and send buffer for the data (in this example DB10). In our example the length of the send and receive data is 10 bytes in each case, i.e. the send and receive area in DB10 should be at least 10 bytes (= 5 words) long.
Load the S7 program into the CPU. Configuring the SIMATIC S7 is now complete.
Initialize the CP5431 and create the PLC-PLC connection Start STEP 5 via "Start > SIMATIC > STEP 5 > STEP 5".
Via the "F9" key, switch to the configuration tool of CP5431, "SINEC NCM COM 5431".
The configuration tool "SINEC NCM COM 5431" is additional software that is integrated in STEP 5 to configure the CP5430. This software is not included in the standard STEP 5 package and must be ordered separately.
Initialize the CP5431 via the menu "Edit > CP_Init".
Enter the L2 address (PROFIBUS address) of the CP5431. This address must match the PROFIBUS address entered in NetPro (see Fig. 08).
The Base SSNR (base interface number) specifies the CP5431 in the rack. This interface number is to be used later for block calls in the S5 program.
More configuration notes for initializing the CP5431 are available in the basic configuration rules at the end of this entry.
Acknowledge the settings with "F7".

Fig. 16
Open the dialog "Edit > Connections > PLC-PLC Connections".
Data transfer via PLC-PLC connections is suitable for transferring consistent data blocks of lengths of up to a maximum of 128 bytes.
With data transfer through direct access to Layer 2 services, you can send/receive data blocks of lengths of up to a maximum of 240 bytes.
More information on data transfer through direct access to Layer 2 services is available in the manual "SINEC CP 5430 TF with COM 5430 TF, CP 5431 FMS with COM 5431 FMS" in Entry ID: 1804226.
The following specifications are based on those in the configuration in NetPro (see Fig. 17).
- For "Remote L2 station address" you add the PROFIBUS address of the SIMATIC S7 (see Fig. 05).
- In "PRIO", set the priority to low (L). For data exchange with an S7-300/400 via FDL, it is mandatory for "PRIO (H/I/L)" to be set to L = Low. Otherwise, the S7-300/400 cannot receive data!
- To identify the connection, you enter the "SSAP" (source SAP) and "DSAP" (destination SAP). Enter the value "3" as "SSAP" (remote LSAP in NetPro, see Fig. 05). Enter the value "2" as "DSAP" (local LSAP in NetPro, see Fig. 05).
- For data transfer between the S5 and the S7 you must set the "Send Parameters:" and "Receive Parameters:" . For SSNR you enter the offset interface number of the CPU (the offset is always 0 for a CPU). The specified job numbers have to be taken into account when calling SEND and RECEIVE in the S5 program (see Fig. 20 and Fig. 21).

Fig. 17
Acknowledge the settings with "F7".
Open the global bus parameters and bus times of the CP5431 via "Edit > Global Network Parameters".
For "Data rate" you select the desired transfer rate and via F1 "Calculate" you have the bus times recalculated. In our example the data rate is 1500000 baud (1.5 Mbit/s). Now compare the network parameters with the settings in NetPro (see Fig. 09).

Fig. 18
Acknowledge the bus time configuration with "F7".
Do a network comparison via "Network > Network Comparison". The global bus parameters set are adopted in the local bus parameters.
Then load the configuration into the CP5431 via "Transfer > FD > CP".
Via "File > Close" and "ESC" you switch to the STEP 5 configuration mask.
Description of the S5 program The function blocks of the S5 program depend on the CPU used. This example is based on the blocks of AG135 and AG155.
The handling blocks for AG135 and AG155 are available at a charge. You can order these blocks from your regional Siemens sales partner (MLFB: 6ES5 842-7CB01 individual license).
A comparison between the PLCs and the associated communication FBs is available in the basic configuration rules at the end of this entry.
- Synchronization of CP5431 with the CPU via the SYNCHRON call in the start-up OBs
Insert the start-up OBs OB20, OB21 and OB22 in your STEP 5 project.
In these OBs you program the call of FB125 "SYNCHRON", which triggers synchronization between the CPU and the CP5431.

Fig. 19
More information on the call of FB125 (SYNCHRON) is available in the basic configuration rules at the end of this entry.
- Call of the SEND/RECEIVE blocks in OB1
Create the OB1.
For cyclic sending, you create an RLO = 1 with the two statements
If the data is not be sent cyclically, then you have to program locking of the SEND call via evaluation of the display word (error analysis of the job). Possible statuses of the display word are described in the manual "SINEC CP 5430 TF with COM 5430 TF, CP 5431 FMS with COM 5431 FMS", section "7.1.2 Checking with ANZW and PAFE" in Entry ID: 1804226 .
Insert the call of the SEND block (FB120).

Fig. 20
The length of the send area is specified in words (parameter: "QLAE: +5" > 5 words).
Create an RLO = 1 with the two statements
Then add the call of the RECEIVE block (FB121) after that.

Fig. 21
- The "SEND" and "RECEIVE" blocks will now be triggered by just one RLO = 1. In the case of an RLO = 0 only the parameters "ANZW" and "PAFE" are updated.
- If the length of the receive area is preset with "-1", then the length of the data is recognized automatically (parameter: "ZLAE: -1").
More information on the call of FB120 (SEND) and FB121 (RECEIVE) is available in the basic configuration rules at the end of this entry.
Save the OB1 with "F7".
- Creation of the Send/Receive buffer
Since the send/receive buffer is located in DB10, you must create this in the project and declare it with a sufficient length. In our example, the length of the data is 10 bytes, i.e. the send and receive area in DB10 must at least 5 words long.
Then load the complete program into the CPU.
Basic configuration rules:
Interface number (SSNR)
- The interface number of the CP is assigned in the mask "Edit > CP Init" in the configuration tool of CP5431, "SINEC NCM COM 5431 TCP".
- The SSNR must be assigned as parameter in all communication blocks of the CPU (FB120, FB121, FB125).
- The interface number must always be divisible by 4 (0, 4, 8, 16, ...).
Comparison of PLCs with function blocks SYNCHRON, SEND, RECEIVE
| |
SYNCHRON |
SEND |
RECEIVE |
| AG 95U |
- |
FB252 |
FB253 |
| AG 115 |
FB249 |
FB244 |
FB245 |
| AG 135 |
FB125 |
FB120 |
FB121 |
| AG 155 |
FB125 |
FB120 |
FB121 |
SEND (FB120) and RECEIVE (FB121) and SYNCHRON (FB125)
- Specifications QLAE and ZLAE are word specifications (QLAE = 0.10 > 10 words send; ZLAE = 0.10 > 10 words receive).
- The parameters PAFE and ANZW are output parameters. These are for diagnostics and job monitoring. More information is available in the CP manuals.
- The job number (ANR) specifies the connection configured in the CP (see Fig. 17).
- The blocks must be called absolutely, for example, SPA FB120.
Keywords:
Hardware configuration, Getting Started, Guidelines, Instructions, Step by step, Send, Receive, FDL protocol, PLC-PLC connection, S5-compatible communication, Link
|