Example of fetching Slave diagnostic data with FB192 "IM 308C"
Here you will find an example of how to use FB192 to fetch slave diagnostic data
of a DP slave in the 192 STEP 5 user program.
Assumptions
The following assumptions are made for this STEP 5 user program:
S IM 308-C, operating as DP Master, occupies frames 0 ... 15 (number 0 of
IM 308-C).
S The DP Slave has the PROFIBUS address 3.3
S The slave diagnostic data should be written to DB20. You can also use any
data block for this.
S The slave diagnosis consists of 26 bytes.
STEP 5 Use Program
STL
:A
DB 30
:SPA
FB 192
Name
:IM308C
DPAD
:
KH F800
IMST
:
KY 0, 3
FCT
:
KC SD
GCGR
:
KM 0
TYPE
:
KY 0, 20
STAD
:
KF +1
LENG
:
KF 26
ERR
:
DW 0
Example of reading out S7 diagnostic data with SFC59 "RD_REC"
Here you will find an example of how to use SFC59 to fetch S7 diagnostic data
records for a DP Slave in the STEP 7 user program. Reading out the slave
diagnostic data with SFC13 is similar.
Assumptions
The following assumptions are made for this STEP 7 user program:
S The diagnosis for the input module with the address 200
S Data record 1 is to be read out.
S Data record 1 is to be stored in DB 10.
PLC S7-300, CPU Specifications CPU 312 IFM to CPU 318-2 DP
A5E00111190-01
CPU 31x-2 as DP Master/DP Slave and Direct Communication
Description
Default address area of IM 308-C
IM no. = 0, PROFIBUS address of the DP slave = 3
Function: Read Slave diagnostic data
Not evaluated
S5 Data area: DB 20
Diagnostic data, starting at Data Word 1
Length of diagnostic data = 26 bytes
Error code area in DW 0 of DB30
is to be read.
H
2-21