RDIAG (FB)
FUNCTION_BLOCK RDIAG
Read Diagnosis data from DP Slave.
This service is for Profibus only, Profinet uses a different, more advanced Diagnosis.
Code-Example: Profibus DP Diagnosis
PROGRAM PLC_PRG VAR readDiag : CommfB.RDIAG; diag : CommFB.DP_DIAG; sMessage : STRING; END_VAR readDiag.REQ := TRUE; readDiag.ID := CommFB.ID(EN := TRUE, Master := CIFX_PB.MasterID, SEGMENT := 0, STATION := 3, SLOT := 0); readDiag.MLEN := TO_INT(SIZEOF(diag)); readDiag(DINFO := diag); IF(readDiag.VALID) THEN IF(diag.status1.Diag.Station_Non_Existent) THEN sMessage := 'Station with Address = 3 is not available !'; END_IF END_IF
- InOut:
Scope
Name
Type
Comment
Input
REQBOOLRequest
IDDWORDIdentifier of a of DP-slave (see: AddressConcept)
MLENINTmaximum length to be read
Output
VALIDBOOLNew diagnosis data received and is valid
BUSYBOOLFB is busy
ERRORBOOLError detected
STATUSDWORDLast detected status
LENINTLength of diagnosis data
Inout
DINFORead diagnosis data (see: DP_DIAG