• No results found

Reading out DP Single Diagnostics Application Program

5 DP Diagnostics from the User Program of a SIMATIC S7−

5.4.3 Reading out DP Single Diagnostics Application Program

The DP_DIAG function is used to read out the DP single diagnostic data. The necessary parameters are explained in the description of the block. DP_DIAG is described in /6/.

Saving the Diagnostic Data

The DP diagnostic data can be read into a data block or a bit memory area on the CPU. The address must be specified in the DP−DIAG block call.

5 DP Diagnostics from the User Program of a SIMATIC S7−300

Structure of the Diagnostic Data

The following diagram provides an overview of the structure. A more detailed representation of the diagnostic information with the extended DP slave diagnostics can be found in Table 5-4.

Station status byte 1

1st byte

Station status byte 2

2nd byte

Station status byte 3

3rd byte

Master address

4th byte

Ident_number

5th byte (high byte)

Diagnostic information

7th byte

6th byte (low byte)

max. 240th byte

Station status bytes

PROFIBUS address of DP master that assigned parameters to the DP slave (FFH = no parameters yet; FEH = not yet obtained on PROFIBUS) Vendor ID dependent on slave type Extended DP slave diagnostics, specifically for the addressed DP slave. The list can contain the following elements:

− Device-related diagnostic data − ID-related diagnostic data

− Channel-related diagnostic data Module statuses

Figure 5-3 Basic Structure of the Single Diagnostic Data

Note

The total length of the data record is 4 bytes shorter than the length in the DP standard. Instead of the maximum possible 244 bytes, only 240 bytes are permitted for operation with the PROFIBUS CP in a SIMATIC S7-300.

Structure of the Station Status Bytes

The coding of the station status bytes is explained in the following tables.

Table 5-4 Structure of the Station Status Bytes − Station Status Byte 1

Bit No. Meaning Explanation

7 MasterLock The DP slave has been assigned parameters by a different DP master, in other words, the DP slave can only be read by the local DP master.

This bit is set by the CP (DP master), when the master address is not FFH and is different from the CP bus address.

6 ParameterFault The last parameter assignment frame received was incorrect or not permitted.

5 DP Diagnostics from the User Program of a SIMATIC S7−300

Table 5-4 Structure of the Station Status Bytes − Station Status Byte 1

Bit No. Meaning Explanation

5 InvalidSlaveResponse This bit is set by the CP (DP master) when no plausible response has been received from the DP slave.

(Various causes possible).

4 ServiceNotSupported The requested functions (for example, SYNC mode, FREEZE mode) are not supported by the DP slave.

Remedy:

For example, switch off the SYNC/FREEZE check or do not send any SYNC/FREEZE jobs.

3 ExtDiagMessage

ExtStatusMessage

Bit = 1 (Ext_Diag) means: Important slave-specific diagnostic data exist. The module statuses/device-related diagnostics should be evaluated.

Bit = 0 (Ext_Status_Message) means: Information or a message may exist. The additional information (module

statuses/device-related diagnostics) can be evaluated.

2 SlaveConfigCheckFault Configuration data received from the DP master are rejected by the DP slave.

Cause/remedy:

For example, incorrect module configuration −> check the diagnostic buffer in NCM S7 for PROFIBUS.

1 StationNotReady The DP slave is not yet ready for parameter assignment and data exchange.

Remedy:

Temporary status, this cannot be influenced by the DP master. 0 StationNonExistent The DP slave is not responding on the bus. This bit is set by the

CP (DP master 1).

Table 5-5 Structure of the Station Status Bytes − Station Status Byte 2

Bit No. Meaning Explanation

7 Deactivated The DP slave is not being polled by its own DP master 1. Cyclic reading is possible.

6 Reserved −

5 SyncMode The DP slave is in the SYNC mode 4 FreezeMode The DP slave is in the FREEZE mode

5 DP Diagnostics from the User Program of a SIMATIC S7−300

Table 5-5 Structure of the Station Status Bytes − Station Status Byte 2

Bit No. Meaning Explanation

1 StaticDiag Static diagnostics

The DP slave cannot transfer data at present.If this bit is set, the DP master must fetch diagnostic data from the DP slave until the bit is reset by the DP slave.

0 ParameterRequest This bit is set by the DP slave when it requires a new parameter assignment or must be configured.

Table 5-6 Structure of the Station Status Bytes − Station Status Byte 3

Bit No. Meaning Explanation

7 ExtDataOverflow If this bit is set, there is more diagnostic information available than can be displayed in the extended diagnostic data. You cannot, however, display this data.

This bit is set by the DP slave or CP (DP master 1). 6 − 5 DP_Station_State Status of the DP master

00 RUN 01 CLEAR 10 STOP 11 OFFLINE This bit is set by the CP (DP master 1). 4 Polling_By_Master The DP slave is polled by its own DP master.

This bit is set by the CP (DP master 1).

3 More_Ext_Dia_Data_Exist During the data transfer phase, the DP slaves send more diagnostic data than the DP master class 1 (= parameter assignment master) can evaluate. This diagnostic frame is then ignored by the DP master class 1 but can be read by the CPU acting as DP master class 2.

The maximum diagnostic data length that can be evaluated in the DP master class 1 is 244 bytes

This bit is set by the CP (DP master 1). 2 Master_Not_In_Ring The DP master is not on the bus.

This bit is set by the CP (DP master 1).

1 MasterConfigCheckFault The DP master rejects the configured slave module list as incorrect.

Cause / Remedy:

For example, incorrect module configuration (number, order) −> check the diagnostic buffer in NCM S7.

This bit is set by the CP (DP master 1).

0 Actual_Diagnose The diagnostic data are up-to-date (1) or are older stored diagnostic data (0).

(Older, stored diagnostic data are read out according to the principle last in first out −> see /6/.)

6 Configuring and Programming the DP Slave