7 Programming FCs (Functions) and FBs for S7 Ethernet CPs
A-252
S7-CPs for Industrial Ethernet Configuring and Commissioning
Release 01/2007
C79000-G8976-C182-07
Example in STL representation:
STL Explanation
CALL FB 52, DB 52
CPLADDR := W#16#0110
WRITE_REC := M 1.1
ID := W#16#86A
INDEX := W#16#8000
DONE := M 1.3
ERROR := M 1.1
STATUS := MW 12
LEN := MW 16
RECORD := P#DB3.DBX0.0 BYTE 80
// PNIO_RW_REC block call
(read/write data record)
// Module address from hardware configuration
// TRUE: write data record;
FALSE: read data record
// Logical address of the module to be addressed
// Data record number
// Address for return parameter DONE
// Address for return parameter ERROR
// Address for return parameter STATUS
// Length of the data record that was read or
will be written in bytes
// Destination or source of the data record to
be transferred (here max. 80 bytes)
Explanation of the Formal Parameters
The following table explains all the formal parameters for FB52:
Paramet
er
Declarat
ion
Data
type
Possible
Values
Remarks
CPLADDR INPUT WORD - Module base address
WRITE_
REC
INPUT BOOL 0: Read data record
1: Write data record
Job type;
The parameter must not be changed
while the block is executing.
ID INPUT WORD Logical address of the PROFINET IO
component (module or submodule).
Bit 15 must be set for an output
module.
(Example of output address 5:
ID:=DW#16#8005).
For a mixed module, the lower of the
two addresses must be specified.
Index INPUT WORD See vendor information
for the data record
numbers supported by
the module.
Data record number that the user
wants to read or write.
DONE OUTPUT BOOL 0: -
1: Data record
transferred
successfully
This parameter indicates whether or
not the job was completed without
errors.
ERROR OUTPUT BOOL 0: -
1: Error
Error code
STATUS OUTPUT WORD 0: No error
Other value: Error
(see Table 7-13)
Status code