Internet PLC Forum
General => Technical support => Topic started by: Philippe Parmentier on April 09, 2014, 01:03:27 PM
-
Greetings,
Have you some samples of code for trapping runtime errors,
Especially how do you get the displayed error messages on line 1 and 2 of the LCD display
What type of recover we ca do, exept doing a reset and error logging?
Regards
-
You can trap the error using INTRDEF 100, n, 1
where n is the custom function number (1 to 256) which is used to trap the run time error. All you need to do is write some code in the function #n where you want to handle the errors.
What is displayed on the LCD indicates the function number and the code address where the runtime error occur. You can then open that particular custom function and press F8 to get a list of the code addresses for that function, which you can then narrow down to find where the runtime error took place.
-
Thanks, but i would like to trap this error message to save it on a file for further troubleshooting, or off line logging
-
Unfortunately the error messages on the LCD display are not available to the TBASIC program itself.
However, the runtime error messages displayed on the LCD can be retrieved from an external host processor using the host link commands RV$1 to RV$4.
So one way is to setup a PLC to monitor the running state of the other PLCs. When a runtime error occur the PLC that trapped the error could alert the monitoring PLC that an error has occurred and the monitoring PLC can then query the running PLC for the error message and log these data to a TLServer or a webserver.