Retrieves the diagnostic information of a hardware component.
This function does not return the group state of the IO device; errors in the subordinate modules are only retrieved by GetDiagnostics(UINT, SubordinateDiagnosticDetails) : GetDiagnosticsReturnCode.
Parameters:
| Name | Type | Section | Description |
|---|---|---|---|
| hardwareID | UINT |
Input | Hardware identifier of the component. |
| diagnosticDetails | DiagnosticDetails |
InOut | Diagnostic information of the addressed hardware component. |
GetDiagnosticsReturnCode |
Return | Provides information about the execution of the instruction. |
To determine the
OperatingStateof a SIMATIC PLC, usehardwareIDvalue52for standard PLC, value65147and65347for redundant PLCs, and34to query a R/H system.
Example:
USING Siemens.Simatic.S71500.Diagnostics.Hardware;
PROGRAM DiagnosticsProgram
VAR
diagInfo : DiagnosticDetails;
deviceAddress : UINT := UINT#269;
END_VAR
// Retrieve device information
IF GetDiagnostics(deviceAddress, diagInfo) = GetDiagnosticsReturnCode#NoError THEN
IF diagInfo.ComponentState <> ComponentState#Good THEN
;// The device with address '269' has a problem
ELSE
;// The device with address '269' is working fine
END_IF;
END_IF;
END_PROGRAM