I've been using structured exception handling in C and in other high level languages and I'm familiar with it's intended use.
In one big program I'm developing now with TwinCAT 3 I have a problem in which randomly my programming computer gets disconnected from the controller and the controller reverts to configuration mode or simply hangs.
There are plenty of loops and pointers involved and, even I've seen that same program working before... now it fails some times... (I've changed the TwinCAT version).
Given __TRY __CATCH... are there to be able to help the programmer when a loop or a pointer are not working as expected I've tried to put a __TRY clause at the beginning and a __CATCH clause at the end of the main cycle (and of course the __END_TRY at the end), but the same behavior happens.
Hello all,
I've been using structured exception handling in C and in other high level languages and I'm familiar with it's intended use.
In one big program I'm developing now with TwinCAT 3 I have a problem in which randomly my programming computer gets disconnected from the controller and the controller reverts to configuration mode or simply hangs.
There are plenty of loops and pointers involved and, even I've seen that same program working before... now it fails some times... (I've changed the TwinCAT version).
Given __TRY __CATCH... are there to be able to help the programmer when a loop or a pointer are not working as expected I've tried to put a __TRY clause at the beginning and a __CATCH clause at the end of the main cycle (and of course the __END_TRY at the end), but the same behavior happens.
See page 5 and 6 of the following PSF file: https://www.codesys.com/fileadmin/data/Images/Download/FeaturesAndImprovementsV3.5SP6_en.pdf
Should I activate something to get the SEH working in the controller (a PC)?
And... How I should declare HandleException? Which type does it has?
As always thank you very much.
Joan.
Hi Joan.
It works for me as:
You can found __system.exceptionCode enum on Codesys help.
Thank you Josep M.
It was well implemented (as you did and also as the code in the sample on that linked PDF file).
I have not been able to find information about the enumeration __system.exceptionCode, but by now I think I won't need it.
Thank you again!