
The standard function block „T_CONFIG“ from SIEMENS can be used to parametrize the integrated PROFINET interface on CPUs or CPs/CMs.
By calling „T_CONFIG“ in the program source code you can change the actual parameters, the actual configuration is going to be overwritten. The fallowing parametrization can be done:
Setting the IP-Protocol
- IP-Address
- Subnet mask
- Router address
Before you begin, you must set some parameters in the hardware configuration. Open the “Device view” in TIA portal and then click on the PROFINET interface that you are going to parametrize. I am using S7 CPU1516—3 PN/DP
Figure 1. Device view.
Then in the General setting tab over "Ethernet address" select "Set IP address using a different method" radio button, thus you will be able to change the IP address using the "T_CONFIG" instruction after the program is downloaded.
Figure 2. Selecting the PROFINET interface.
Next step is to define a global DB for controlling the Function Block.
We define “DP_paramT_CONFIG” and it should look like this:
Figure 3. Defining DB with parameters.
In this example I will be configuring the single port of the CPU PORT[X2 P1]. To be able to configure the IP Address of the exact port we need to know the “Hardware Identifier” of this port. The identifier could be seen by selecting the port and the tab “System constants”.
Figure 4. S7 CPU hardware identifier.
Then we apply it in the DB (in this example 72).
Figure 5. Setting the hardware identifier.
Assign parameters for the system data type "IF_CONF_Header" for specifying the size of the PROFINET data:
SubfieldCount = 1, means that we are going to change only the IP Address, we we want to set and the name, we will put SubfieldCount = 2.
Figure 6. Size of PROFINET data.
Define the IP Address in "IF_CONF_v4".
Figure 7. Defining the IP Address.
This function can be used to change the name of the PROFINET device. It is limited to 240 symbols.
For In the structure "deviceName" (system data type IF_CONF_NOS)
As show in Figure 8 Lenght = 10 . The value corresponds to the overall length of the structure NOS (4 bytes for the device name"NAME" + 6 bytes for the parameters Id, Length and Mode). Instead of an absolute length, you can use the default start value (Lenght = 0) for a dynamic length.
Mode = 1. The value causes a permanent change of the device name in "NAME".
NOS[1] ... NOS[4]. The NOS array contains the new device name (1 character / byte).
Figure 8. Name of PROFINET device.
When we finish parametrizing the DB we call the FB (in this example in SCL).
Figure 9. Calling the FB in SCL.
Set the new data by changing “T_CONFIG.start” to true.
Figure 10. Interface and status parameters of T_CONFIG.
To check whether the PROFINET data were changed, open the path "Online & Diagnostics > Functions > Assign name" in the project tree.
For S7-1200 CPUs with firmware versions V2.0 to V4.1.2 a CPU restart must be performed after changing the Address over T_CONFIG.
0 COMMENTS //
Join the discussion