QUESTION:
How should you configure a TCP connection via Ethernet (TCP
native) between a SIMATIC S7 and a PC with Socket Interface?
ANSWER:
A TCP connection via Ethernet (TCP native) is configured in two
steps:
- Create the TCP connection in NetPro
- Call the communication blocks in the S7 program of the CPU (see
Entry ID: 17853532)
Create the TCP connection in NetPro
- Open the S7 project with the SIMATIC Manager.
- To create connections you switch to the NetPro program via
"Options > Configure Network".

Fig. 1: Starting NetPro
- Mark the CPU in your S7 station.

Fig. 2: Mark CPU
- You can create new connections via "Insert > New
Connection".
- Select "unspecified" as Connection Partner and "TCP connection
as Connection Type. Close the dialog with "OK".

Fig. 3: Creating a connection
- You can close the message that is displayed with
"OK".

Fig. 4: Message about routers
- The Properties dialog of the TCP connection opens. In the
"General Information" tab you can define a name for the connection.
This connection endpoint is "passive", i.e. the option "Active
connection setup" remains disabled.

Fig. 5: General connection specifications
- Switch to the "Addresses" tab. The partner IP address and the
partner's port are not specified (remain blank). This means that
for each new connection setup the partner can also specify a new
port.

Fig. 6: Partner addresses
- In the "Options" tab you set the operating mode
"Send/Recv".

Fig. 7: Setting the Send/Recv operating mode
- Close the Properties dialog with "OK". The TCP connection
created is displayed in the connection table.

Fig. 8: Display in NetPro
- Save and compile the station.
- Then load the connection into the S7 controller.
Call the communication blocks in the S7 program of the
CPU
Data communication between the two connection partners is done
via communication blocks. The function blocks AGSEND (FC5) and
AGRECV (FC6) are available to you for this.
A sample program for the Send-Receive interface with blocks FC5
(AG_SEND) and FC6 (AG_RECV) can be downloaded in Entry ID:
17853532.
|