Diagnosis in the Application
The PROFINET Controller is equipped with an internal buffer for diagnostic data. This "shadowing database" is constantly updated in the background (transparent for the user) by alarms sent from the devices and by acyclic services for establishing the connection. In this way, with a minimum delay the actual diagnosis status of all devices is mirrored in the host application and can be evaluated there at any time. Alternatively or additionally, the application can receive the individual alarms (CommFB.RALARM
) or re-read the diagnosis data (CommFB.RDREC
).
The API of the ProfinetCommon
and CommFB
libraries described here is identical for the CODESYS PROFINET stack as well as the CIFX solution. However, individual services are not fully implemented by the CIFX solution (see data sheet). For code examples, see the library documentation of the function blocks listed below.
Device Function Block
For each PROFINET Device in the device tree, a function block is created that provides basic information about the connection or configuration status of the device. For example, to request diagnosis entries or for a deviating module configuration.

Similarly, a function block instance is also created for the controller to provide information about the operating status of the PROFINET Controller.
For more information, see: IoDrvProfinet.ProfinetController
and IoDrvProfinet.PNSlave
Provider and Consumer Status
This status information is always transferred with the I/O data. It can be added to the CODESYS I/O mapping of the respective module.
Alarms
Alarms which are sent by PROFINET Devices can be received by means of the CommFB.RALARM
function block. For a code example for the evaluation of information, see the library documentation for ProfinetCommon.DiagnosisDataReader
.
Device and Submodule Status
In addition to direct access to the outputs of the device function block, there is also the possibility of using the ProfinetCommon.DeviceIterator
POU to iterate over all devices engineered for a controller.
In the same way, the ProfinetCommon.SubmoduleIterator
POU is used for iterating the submodules configured for a PROFINET Device and for evaluating the individual ProfinetCommon.SubmoduleState
.
Diagnosis Buffer (Diagnosis Shadowing)
With the ProfinetCommon.DiagnosisDataBuffer
POU, the data which is buffered locally in the “Shadowing Database“ of the controller can be called.
Alternatively, the ProfinetCommon.GetSubmoduelDiagnosis() function could also be used to query all buffered diagnostic entries for a single submodule.
Error codes and diagnostic texts
The numeric PROFINET error codes (ErrorCode
and ExtErrorCode
) can be called by means of the functions and function blocks mentioned above. If the corresponding textual descriptions are required in an application (for example, to display in a visualization), then these textual descriptions need to be downloaded separately. For more information, see: Command: Add PROFINET Diagnosis Resources.