Troubleshooting and debugging

Debugging messages written to the application log facilitate troubleshooting of the system. If the "Low level" interface is used then three stages of debugging messages can be activated in an PLC application:

  1. Debugging messages that are logged when the TCP/IP connection is established or released (TcSocketHelper.Lib messages). These messages can be activated via the nMode parameter when the F_CreateServerHnd() function (controlled station) or FB_ClientServerConnection() function block (controlling station)  is called;
  2. Hexadecimal output of the ASDUs (without link layer control header). 32 ASDU data bytes per row are output as hexadecimal numbers. Bigger frames are split into multiple lines. These messages can be activated via the ST_IEC870_5_101TBuffer member variable: eDbg;
  3. Hexadecimal output of the APDUs (TCP/IP frames). 32 APDU data bytes per row are output as hexadecimal numbers. Bigger frames are split into multiple lines. These messages can be activated via the FB_IEC870_5_104TProtocol input variable: bOutDbg;

In order to view the activated debug messages, start the TwinCAT System Manager and activate log view. A debug output is shown below. The three different message types are identified with the respective numbers.

Troubleshooting and debugging 1:

 

Further diagnostic tools: