Instructions: If you are operating an Industrial Ethernet CP of the S7-300 as PROFINET IO controller or PROFINET IO device, then you must call the following communication functions in the user program:
- FC11 "PNIO_SEND"
- FC12 "PNIO_RECV"
Features of communication blocks FC11 "PNIO_SEND" and FC12 "PNIO_RECV":
- FC11 and FC12 are synchronous communication blocks.
- The blocks are contained in the "SIMATIC_NET_CP" library for the S7-300 controller.
- The blocks must be called in the OB1 cycle (see also Entry ID: 2795485)
- The end of the job is indicated by "DONE", "NDR" or "ERROR".
Features of communication block FC11 "PNIO_SEND":
- Operation as PROFINET IO controller
The block transfers the process data (outputs) of a specified output range to the IE CP for forwarding to PROFINET IO devices and as status display supplies the IO Consumer Status (IOCS) of the outputs of the PROFINET IO devices.
- Operation as PROFINET IO device
The block reads the preprocessed process inputs of the CPU in the PROFINET IO device and transfers them to the PROFINET IO controller (configured I addresses); furthermore, the block supplies the IO Consumer Status (IOCS) of the PROFINET IO controller as status display.
Features of communication block FC12 "PNIO_RECV":
- Operation as PROFINET IO controller
The block accepts the process data (inputs) from PROFINET IO devices (inputs of the controller) and the IO Provider Status (IOPS) of the inputs from the PROFINET IO devices in the specified input areas.
- Operation as PROFINET IO device
The block accepts the data (configured Q addresses) transferred by the PROFINET IO controller and the IO Provider Status (IOPS) of the PROFINET IO controller and writes it to data areas of the CPU reserved for the process outputs in the PROFINET IO device.
Description of the configuration: The STEP 7 project includes the following S7-300 station that is configured as PROFINET IO controller:
- CPU 315-2DP with CP343-1 (6GK7 343-1EX21-0XE0)
In the STEP 7 project the following modules are configured as PROFINET IO device:
- ET 200S with IM151-3 PN (6ES7 151-3AA10-0AB0)
- ET 200S with IM151-3 PN HF (6ES7 151-3BA22-0AB0)

Fig. 01: Configuration
The following input and output modules are configured for the ET 200S with IM151-3 PN:
- 4 DO with the address area 0.0-0.3
- 4 DI with the address area 0.0-0.3
- 4 DO with the address area 1.0-1.3

Fig. 02: I/O address area of the ET 200S with IM151-3 PN
The following input and output modules are configured in the ET 200S with IM151-3 PN HF:
- 2 DO with the address area 20.0-20.1
- 4 DI with the address area 10.0-10.3

Fig. 03: I/O address area of the ET 200S PN HF
This results in a total address area for the:
- Inputs: 0 to 10 = 11 bytes
- Outputs: 0 to 20 = 21 bytes
Note: The address area of the inputs and outputs must begin with the I/O address "0".
Description of the user program: In this example, a S7-300 station with CP343-1 is used as PROFINET IO controller.
The STEP 7 program consists of the blocks OB1, FB100, DB30, DB31, DB12, FC11 and FC12.
- OB1
OB1 is called cyclically. In this OB is the call of FB100 (instance DB: DB100).

Fig. 04: OB1
- FB100
FB100 is called in the OB1 cycle. In this FB is the call of FC11 "PNIO_SEND" and FC12 "PNIO_RECV".

Fig. 05: Call of FC11 "PNIO_SEND"

Fig. 06: Call of FC12 "PNIO_RECV"
The input parameter MODE=0, because the IE CP is only operated as PROFINET IO controller. If the IE CP is operated in parallel as PROFINET IO controller and PROFINET IO device, then the input parameter is MODE=1.
At the input parameter LEN of FC11 "PNIO_SEND" you specify the length of the total address area of the configured outputs (21 bytes). The data area for the Send data is specified by the SEND parameter of FC11 "PNIO_SEND". This data area must be as long as the address area of the configured outputs (21 bytes).
At the input parameter LEN of FC12 "PNIO_RECV" you specify the length of the total address area of the configured inputs (11 bytes). The data area for the Receive data is specified by the RECV parameter of FC12 "PNIO_RECV". This data area must be as long as the address area of the configured inputs (11 bytes).
The send and receive buffers (for example data blocks), which contain the data to be sent or received, must be at least as long as the data area defined for the Send and Receive data. In this example, the DB that contains the Send data must be at least 21 bytes long and the DB in which the Receive data is stored must be at least 11 bytes long.
At the input parameter CPLADDR of the communication functions you specify the module address of the PROFINET IO device. You take this from the hardware configuration, in the Properties dialog of the Industrial Ethernet CPs -> "Addresses" tab (see Fig. 07). In this example, the module address of the CP343-1 is 256dec = 100hex.

Fig. 07: Properties dialog of the CP343-1 -> "Addresses" tab
The output parameters "DONE", "NDR", "ERROR" and "STATUS" of the communication functions FC11 "PNIO_SEND" and FC12 "PNIO_RECV" are required for job evaluation.
The output parameter "DONE" at FC11 "PNIO_SEND" is set if the Send job has been completed successfully.
The output parameter "NDR" at FC12 "PNIO_RECV" is set if the Receive job has been completed successfully, i.e. the data has been accepted.
If the communication function FC11 "PNIO_SEND" or FC12 "PNIO_RECV" ends with an error, the communication functions's status word is saved for error analysis.

Fig. 08: Saving STATUS of F11 and FC12
Note: A detailed description including sample program for the call of the communication blocks FC11 and FC12 in the PROFINET IO device is available in Entry ID: 31764614.
The STEP 7 project as download: The following STEP 7 project contains a sample program for the call of the FC11 and the call of the FC12 with status evaluation. It has been created with STEP 7 V5.4 SP4.
FC11_und_FC12_CTRL.zip ( 553 KB )
Dearchive the "FC11_und_FC12_CTRL.zip" file in the SIMATIC Manager via the menu "File > Dearchive". The STEP 7 project is now unpacked with all the subdirectories. Now you can open and edit the STEP 7 project with the SIMATIC Manager.
|