Hi guys,
I'm looking for some kind of assertion or exception mechanism. I know __try, __catch, __finally. But i don't know how "throw" an exception when something happened. I have seen in help definition of ExceptionCode type, which contains:
__USER_EXCEPTION_BASE:=16#00010000
So maybe it is possible somehow to throw an exception.
Do we have some kind of assertion mechanism in order to stop whole application if some requirements are not fulfilled?
Now I have dummy function to do that:
PROGRAM PLC_PRG
VAR
result : INT;
number5 : INT := 5;
END_VAR
result := 5 / (number5-number5);
It will then "automatically" raise an exception . I had to define a variable because codesys is so unbelievably smart it can detect a division by zero if provided with int literals -.-.
Ofcourse there was nothing useful in the helpfile about throwing an exception...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi guys,
I'm looking for some kind of assertion or exception mechanism. I know __try, __catch, __finally. But i don't know how "throw" an exception when something happened. I have seen in help definition of ExceptionCode type, which contains:
So maybe it is possible somehow to throw an exception.
Do we have some kind of assertion mechanism in order to stop whole application if some requirements are not fulfilled?
Now I have dummy function to do that:
Same question here! Any new findings?
You can do this:
PROGRAM PLC_PRG
VAR
result : INT;
number5 : INT := 5;
END_VAR
result := 5 / (number5-number5);
It will then "automatically" raise an exception . I had to define a variable because codesys is so unbelievably smart it can detect a division by zero if provided with int literals -.-.
Ofcourse there was nothing useful in the helpfile about throwing an exception...