Debugging functions, diagnostics and troubleshooting
10.7 Diagnostics of DP CPUs
S7-300, CPU 31xC and CPU 31x: Installation
Operating Instructions, Edition 08/2004, A5E00105492-05
10-23
Example of reading out S7 diagnostic data with SFC 59 "RD REC"
Here you will find an example of how to use SFC 59 in the STEP 7 user program to read
S7 diagnostics data records for a DP slave. The process of reading the slave diagnostics is
similar to SFC 13.
Assumptions regarding the STEP 7 user program
Exceptions for this STEP 7 user program:
•
Diagnostic data for the input module at address 200
H
is to be read.
•
Data record 1 is to be read out.
•
Data record 1 is to be stored in DB 10.
STEP 7 user program
STL Description
CALL SFC 59
REQ :=TRUE
IOID :=B#16#54
LADDR :=W#16#200
RECNUM :=B#16#1
RET_VAL :=MW2
BUSY :=MO.0
RECORD :=P# DB10.DBX 0.0 BYTE 240
//Request to read
//Identifier of the address area, here the I/O input
//Logical address of the module
//Data record 1 is to be read
//An error code is output if an error occurs
//Read operation not finished
//DB 10 is target area for the read data record 1
Note:
Data is only returned to the target area if BUSY is reset to 0 and if no negative RET_VAL has
occurred.
Diagnostic addresses
At a CPU 31x-2, you assign diagnostic addresses for PROFIBUS DP. Verify in your
configuration that the DP diagnostic addresses are assigned once to the DP master and
once to the DP slave.
CPU 31x-2 as sender
CPU 31x-2 as receiver
PROFIBUS
Diagnostic address