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 := pnDevice.xDiagnosis, 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
xEnable
BOOL
enable operation
ID
DWORD
Device ID
DiagnosisIndex
DINT
selected DiagnosisIndex (range 0..DiagnosisCount)
Output
xBusy
BOOL
TRUE if function block is operating
xError
BOOL
error occured, see STATUS output
STATUS
DWORD
0 = OK.
UpdatedDiagnosis
BOOL
shadowed diagnosis data has been updated since last execution of this function block (e.g. an alarm has been received in the mean time)
DiagnosisCount
DINT
number of diagnosis entries that are stored for this device
IsStandardFormat
BOOL
The diagnosis information is in standard format, use the data in output Diagnosis.
IsUSIFormat
BOOL
The diagnosis information is in USI format, use the data in output DiagnosisUSI.
Source
The diagnosis source is the information where the diagnosis is located on the device.
Diagnosis
The diagnosis information in standard format.
DiagnosisUSI
The diagnosis information in USI format.
UpdateTime
DT
The timestamp when this diagnosis has been updated (UTC time) or 0 if unknown.