You are on page 1of 3

SFCs for Distributed I/Os

15.3

Reading Diagnostic Data of a DP Slave with SFC13 "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 SFC13 "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 0 1 2 3 4 5 6 ... Meaning Station status 1 Station status 2 Station status 3 Master station number Vendor ID (high byte) Vendor ID (low byte) Further slave-specific diagnostic information

Description
With SFC13 "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 SFC13 call.

Function
The read job is executed asynchronously, in other words it requires several SFC13 calls. The status of the job is indicated by the output parameters RET_VAL and BUSY, see Section 2.2.
Parameter REQ LADDR RET_VAL Declaration Data Type Memory Area Description INPUT BOOL I, Q, M, D, L, REQ=1: Read request constant INPUT WORD I, Q, M, D, L, Configured diagnostic address of the DP slave. constant 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.

System- and Standard Functions for S7-300 and S7-400 C79000-G7076-C567-01

15-9

SFCs for Distributed I/Os

RECORD

OUTPUT

ANY

I, Q, M, D, L

BUSY

OUTPUT

BOOL

I, Q, M, D, L

Destination area for the diagnostic data that were read. Only the BYTE data type 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 sent is 240. Standard slaves can provide more than 240 bytes of diagnostic data up to a maximum of 244 bytes. In this case, the first 240 bytes are transferred to the destination area and the overflow bit is set in the data. BUSY=1: The read job is not yet completed.

Input Parameter RECORD


The CPU evaluates the actual length of the diagnostic data that were read as following: 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. If the length specified for RECORD is longer 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 identified unequivocally 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: 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. 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


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

15-10

System- and Standard Functions for S7-300 and S7-400 C79000-G7076-C567-01

SFCs for Distributed I/Os

Error Information
How you evaluate the error information of the RET_VAL parameter is explained in Chapter 2. This chapter also contains the general error information for the SFCs. The error information specific to SFC13 is a subset of the error information for SFC59 "RD_REC," see Table 7-2 Specific Error Information for SFC58 "WR_REC" and SFC59 "RD_REC."

System Resources for S7-400


When SFC13 "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 SFC13 in quick succession for several DP slaves providing that you do not exceed the maximum number of "simultaneously" active SFC13 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.

System- and Standard Functions for S7-300 and S7-400 C79000-G7076-C567-01

15-11

You might also like