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
REQ
BOOL
Request
ID
DWORD
Identifier of a of DP-slave (see: AddressConcept)
MLEN
INT
maximum length to be read
Output
VALID
BOOL
New diagnosis data received and is valid
BUSY
BOOL
FB is busy
ERROR
BOOL
Error detected
STATUS
DWORD
Last detected status
LEN
INT
Length of diagnosis data
Inout
DINFO
Read diagnosis data (see: DP_DIAG