DiagnosisDataBuffer (FB)
FUNCTION_BLOCK DiagnosisDataBuffer
Example: check diagnosis data of a device
PROGRAM PLC_PRG VAR diagBuffer : ProfinetCommon.DiagnosisDataBuffer; slot : UINT; channelError : ProfinetCommon.ChannelErrorType := 0; i : DINT; END_VAR diagBuffer(xEnable := TRUE, ID := pnDevice.ID, DiagnosisIndex := 0); // check diagnosis of device 'pnDevice' IF(diagBuffer.UpdatedDiagnosis) THEN // some diagnosis data changed ? FOR i := 0 TO diagBuffer.DiagnosisCount - 1 DO // iterate all diagnosis entries diagBuffer(DiagnosisIndex := i); // select next Diagnosis Entry that shall be shown in outputs IF(diagBuffer.IsStandardFormat) THEN //e.g slot 2 has channel error 'Line Break' slot := diagBuffer.Source.Slot; channelError := diagBuffer.Diagnosis.ChannelErrorType; END_IF END_FOR diagBuffer.DiagnosisIndex := 0; //reset to first entry END_IF
- InOut:
Scope
Name
Type
Comment
Input
xEnableBOOLenable operation
IDDWORDDevice ID
DiagnosisIndexDINTselected DiagnosisIndex (range 0..DiagnosisCount)
Output
xBusyBOOLTRUE if function block is operating
xErrorBOOLerror occured, see STATUS output
STATUSDWORD0 = OK.
UpdatedDiagnosisBOOLshadowed diagnosis data has been updated since last execution of this function block (e.g. an alarm has been received in the mean time)
DiagnosisCountDINTnumber of diagnosis entries that are stored for this device
IsStandardFormatBOOLThe diagnosis information is in standard format, use the data in output Diagnosis.
IsUSIFormatBOOLThe diagnosis information is in USI format, use the data in output DiagnosisUSI.
SourceThe diagnosis source is the information where the diagnosis is located on the device.
DiagnosisThe diagnosis information in standard format.
DiagnosisUSIThe diagnosis information in USI format.
UpdateTimeDTThe timestamp when this diagnosis has been updated (UTC time) or 0 if unknown.