100% found this document useful (1 vote)
107 views4 pages

SFC 13

SFC 13 "DPNRM_DG" is used to read diagnostic data from a DP slave in a PROFIBUS network. The diagnostic data is structured according to PROFIBUS standards and provides status information about the DP slave. SFC 13 reads the diagnostic data asynchronously and the status of the read job can be monitored using output parameters. The diagnostic data is written to a data record based on parameters passed to SFC 13. Errors are returned in the RET_VAL parameter.

Uploaded by

Aoun mouloud
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
107 views4 pages

SFC 13

SFC 13 "DPNRM_DG" is used to read diagnostic data from a DP slave in a PROFIBUS network. The diagnostic data is structured according to PROFIBUS standards and provides status information about the DP slave. SFC 13 reads the diagnostic data asynchronously and the status of the read job can be monitored using output parameters. The diagnostic data is written to a data record based on parameters passed to SFC 13. Errors are returned in the RET_VAL parameter.

Uploaded by

Aoun mouloud
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

 6)&VIRU'LVWULEXWHG,2VRU352),1(7,2

5HDGLQJ'LDJQRVWLF'DWDRID'36ODYHZLWK6)&'3150B'* 6ODYH'LDJQRVWLFV 

16.4 Reading Diagnostic Data of a DP Slave with SFC 13 "DPNRM_DG"


(Slave Diagnostics)

Slave Diagnostics
Each DP slave provides slave diagnostic data structured in accordance with EN 50 170 Volume 2,
PROFIBUS. To read out this diagnostic data, you require SFC 13 "DPNRM_DG".
Refer to the following table for the basic structure of the slave diagnostic data and to the manuals of
the DP slaves for further information.

Byte Meaning
0 Station status 1
1 Station status 2
2 Station status 3
3 Master station number
4 Vendor ID (high byte)
5 Vendor ID (low byte)
6 ... Further slave-specific diagnostic information

Description
With SFC 13 "DPNRM_DG" (read diagnostic data of a DP slave), you read the current diagnostic data
of a DP slave in the format specified by EN 50 170 Volume 2, PROFIBUS. The data that has been
read is entered in the destination area indicated by RECORD following error-free data transfer.
You start the read job by assigning 1 to the input parameter REQ in the SFC 13 call.

System Software for S7-300/400 System and Standard Functions Volume 1/2
Reference Manual, 05/2010, A5E02789976-01 303
6)&VIRU'LVWULEXWHG,2VRU352),1(7,2 
5HDGLQJ'LDJQRVWLF'DWDRID'36ODYHZLWK6)&'3150B'* 6ODYH'LDJQRVWLFV 

Function
The read job is executed asynchronously, in other words it requires several SFC 13 calls. The status
of the job is indicated by the output parameters RET_VAL and BUSY, also refer to Meaning of the
Parameters REQ, RET_VAL and BUSY with Asynchronous SFCs.

Parameter Declaration Data Type Memory Area Description


REQ INPUT BOOL I, Q, M, D, L, REQ=1: Read request
constant
LADDR INPUT WORD I, Q, M, D, L, Configured diagnostic address of the DP
constant slave.
Note:
Addresses have to be entered in
hexadecimal format. For example, diagnostic
address 1022 means: LADDR:=W#16#3FE.
RET_VAL OUTPUT INT I, Q, M, D, L If an error occurs while the function is
active, the return value contains an error
code. If no error occurred, the length of
the data actually transferred is entered in
RET_VAL.
RECORD OUTPUT ANY I, Q, M, D, L Destination area for the read diagnostic
data. Only data type BYTE is permitted. The
minimum length of the data record to be
read or the destination area is 6. The
maximum length of the data record to be
read is 240. With standard slaves on which
the number of standard diagnostic data is
greater than 240 bytes and a maximum of
244 bytes, the first 240 bytes are transferred
to the destination area and the
corresponding overflow bit is set in the data.
Note: Note that the RECORD parameter of
S7-300 CPUs always requires the full
specification of the DB parameters (for
example: P#DB13.DBX0.0 byte 100).
Omitting an explicit DB no. is not permitted
for S7-300 CPUs and causes an error
message in the user program.
BUSY OUTPUT BOOL I, Q, M, D, L BUSY=1:
The read job is not yet completed.

 6\VWHP6RIWZDUHIRU66\VWHPDQG6WDQGDUG)XQFWLRQV9ROXPH
 5HIHUHQFH0DQXDO$(
 6)&VIRU'LVWULEXWHG,2VRU352),1(7,2
5HDGLQJ'LDJQRVWLF'DWDRID'36ODYHZLWK6)&'3150B'* 6ODYH'LDJQRVWLFV 

Input Parameter RECORD


The CPU evaluates the actual length of the diagnostic data that were read as following:
x If the length specified for RECORD is less than the number of data bytes supplied, the data are
discarded and a corresponding error code is entered in RET_VAL.
x If the length specified for RECORD is greater than or equal to the number of supplied data bytes,
the data are accepted in the destination area and the actual length is entered in RET_VAL as a
positive value.

Note
You must make sure that the actual parameters of RECORD match in all calls belonging to a job.
A job is uniquely identified by the LADDR input parameter.

Standard Slaves with more than 240 Bytes of Diagnostic Data


With standard slaves on which the number of standard diagnostic data is between 241 and 244 bytes,
note the following points:
x If the length specified for RECORD is less than 240 bytes, the data are discarded and the
corresponding error information is entered in RET_VAL.
x If the length specified for RECORD is greater than or equal to 240 bytes, the first 240 bytes of the
standard diagnostic data are transferred to the destination area and the overflow bit is set in the
data.

Output Parameter RET_VAL


x If an error occurs while the function is being executed, the return value contains an error code.
x If no error occurs during the data transfer, RET_VAL contains the length of the data read in bytes
as a positive number.

Note
The amount of data read in a DP slave depends on its diagnostic status.

System Software for S7-300/400 System and Standard Functions Volume 1/2
Reference Manual, 05/2010, A5E02789976-01 305
6)&VIRU'LVWULEXWHG,2VRU352),1(7,2 
5HDGLQJ'LDJQRVWLF'DWDRID'36ODYHZLWK6)&'3150B'* 6ODYH'LDJQRVWLFV 

Error Information
How to evaluate the error information of the RET_VAL parameter is explained in Evaluating Errors
with the Output Parameter RET_VAL. This chapter also contains the general error information for the
SFCs. The error information specific to SFC 13 is a subset of the error information for SFC 59
"RD_REC," see Reading a Data Record with SFC 59 "RD_REC"

System Resources for S7-400


When SFC 13 "DPNRM_DG" is called for a job that is not currently being processed, resources of the
CPU (memory space) are occupied on the S7-400. You can call SFC 13 in quick succession for
several DP slaves providing that you do not exceed the maximum number of "simultaneously" active
SFC 13 jobs for your CPU. You will find the maximum number of such jobs in /101/.
If you activate several jobs "simultaneously," all the jobs will be executed without interfering with each
other.
If you reach the limits of the system resources, this is indicated in RET_VAL. In this case, repeat the
job.

 6\VWHP6RIWZDUHIRU66\VWHPDQG6WDQGDUG)XQFWLRQV9ROXPH
 5HIHUHQFH0DQXDO$(

You might also like