Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Is it possible in the log to see previous shutdown

DavidBo
2024-02-08
2024-02-09
  • DavidBo - 2024-02-08

    If my application does some kind of violation which makes it cast an exception it will trigger my real watchdog which results in a reboot.
    Unfortunately the log it seems only shows the boot sequence. Is it possible to see what happen before reboot?

     
  • alexgooi

    alexgooi - 2024-02-09

    Hi DavidBo,

    In general Codesys is used to control equipment and an exception is the worst thing that can happen in your installation.

    If you cannot prevent the exception from triggering, you could implement a Try catch statement, with this solution your controller keeps on running and you are able to handle the exception.

    __TRY
        //This statement will trigger an exception
        Result := 4/0;
    __CATCH(exc)
        //Handle the exception
        HandleException(exc, strExceptionText => strExceptionText); // From the Codesys help file
        //Create a log file
        //--------------------------------------------------------
    __ENDTRY
    

    What you also could do is implement implicit checks, these functions cover most of the exceptions (like dividing by zero)
    See picture

    But in general avoid a complete controller shutdown!

     

    Last edit: alexgooi 2024-02-09

Log in to post a comment.