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:
In the STEP 7 project the following modules are configured as PROFINET IO device:
- CPU 315-2DP with CP343-1 Lean (6GK7 343-1CX10-0XE0)
- ET 200S

Fig. 01: Configuration
The following input/output modules are configured for the PROFINET IO device CP343-1 Lean:
- 16-byte DI with the address area 0-15
- 8-byte DI with the address area 16-23
- 16-byte DO with the address area 0-15
- 4-byte DO with the address area 16-19
This means that the address area of the inputs is 24 bytes (0-23) and the address area of the outputs is 20 bytes (0-19). The address area of the inputs and outputs does not have to begin with the I/O address "0".
Fig. 02: I/O address area of the PROFINET IO Device CP343-1 Lean
The following output modules are configured in the ET 200S:
- 2 DO with the address area 20.0-20.1

Fig. 03: I/O address area of the PROFINET IO device ET 200S
This results in a total address area for the:
- Inputs: 0-23 = 24 bytes
- Outputs: 0-20 = 21 bytes
Description of the user program: In this example, a CP343-1 Lean is used to connect an S7-300 station as PROFINET IO device to a PROFINET IO system. Marker byte 0 (MB0) is defined as clock marker in the S7-300 CPU. 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 device. 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 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. 06). In this example, the module address of the CP343-1 Lean is 256dec = 100hex.
At the input parameter LEN of FC11 "PNIO_SEND", you specify the length of the address area of the inputs you configured for the CP343-1 Lean (24 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 inputs (24 bytes).
At the input parameter LEN of FC12 "PNIO_RECV", you specify the length of the address area of the outputs you configured for the CP343-1 Lean (20 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 outputs (20 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 24 bytes long and the DB in which the Receive data is stored must be at least 20 bytes long.

Fig. 07: Properties dialog of the CP343-1 Lean -> "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
Description of the user program of the PROFINET IO controller: In this example, a S7-300 CPU with integrated Industrial Ethernet interface is used as PROFINET IO controller. Marker byte 0 (MB0) is defined as clock marker.
The STEP 7 program consists of the blocks OB1, FB100 and DB20.
It is not necessary to call communication blocks in the user program. You access the I/O with load and transfer commands, i.e. you read out the values of the inputs and write the values to the outputs. The values of the inputs read are stored in the the data block (DB20).
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 was created with STEP 7 V5.4 SP3.
FC11_und_FC12_DEV.zip ( 296 KB )
Dearchive the "FC11_und_FC12_DEV.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.
|