Yes I know, instead of _ _ throw an exception I can force codesys to divide by zero which will generate an exception.
This is the only possible solution?
Second question. How can I put underscore in text? One underscore change formating to italics, double underscore change formating to bold.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
thank you very much for your answer. In SysExcept there is also function SysExceptGenerateException so probablly CmpApp.AppGenerateException() is not needed.
But now I have another problem - only some exceptions can be 'catched' witch __try __catch - for example for RtsExceptions.RTSEXCPT_DIVIDEBYZERO it works, but I can not catch e.g. SysExcept.RTSEXCPT_VENDOR_EXCEPTION_BASE.
What wrong am I doing? Should I register the exception before?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm still looking for solution how to use 16#2000 or SysExcept.RTSEXCPT_VENDOR_EXCEPTION_BASE for exception.
The problem is, if I throw these exception even in __try __catch the execution of my PLC program stops and can't be continued.
Hi guys.
I know that there is mechanism
where can I check for example whether there is divison by 0.
But what if I want to generate my own exception in order to stop normal execution of program - for example when I am not able to allocate new memory
I have seen
__THROW
but when I try to use it
Codesys says future not implemented.
when I try
Codesys says unexpected token _ _ SYSTEM found
Yes I know, instead of _ _ throw an exception I can force codesys to divide by zero which will generate an exception.
This is the only possible solution?
Second question. How can I put underscore in text? One underscore change formating to italics, double underscore change formating to bold.
To generate an exception, you need these:
CmpApp.GetCurrent()
CmpApp.AppGenerateException()
List of exceptions available at:
SysExcept.RtsExceptions
Usually 16#2000 is good for your own exception
To generate a less cryptic log message associated with that exception, you need
CmpLog.LogAdd2()
Checkout "escapes and HTML" at this page (new forum uses Apache Allura. Sourceforge also uses that, so sometimes you can find info on sourceforge):
https://forge-allura.apache.org/p/allura/wiki/markdown_syntax/#md_ex_escapes
So I would type "\_\_" to get "__"
Hi,
thank you very much for your answer. In SysExcept there is also function SysExceptGenerateException so probablly CmpApp.AppGenerateException() is not needed.
But now I have another problem - only some exceptions can be 'catched' witch __try __catch - for example for RtsExceptions.RTSEXCPT_DIVIDEBYZERO it works, but I can not catch e.g. SysExcept.RTSEXCPT_VENDOR_EXCEPTION_BASE.
What wrong am I doing? Should I register the exception before?
Hi,
I'm still looking for solution how to use 16#2000 or SysExcept.RTSEXCPT_VENDOR_EXCEPTION_BASE for exception.
The problem is, if I throw these exception even in __try __catch the execution of my PLC program stops and can't be continued.
Please see an example below:
When I throw RTSEXCPT_DIVIDEBYZERO then in __CATCH() clause divisionByZero is set to TRUE and execution goes further.
But when I throw RTSEXCPT_VENDOR_EXCEPTION_BASE then in __CATCH() clause vendor is not set to TRUE, and code execution is stoped on line
I am using Wago PLC - PFC200 750-8202.
SysExcept library in version 3.5.7.0
I think we need to wait for SP16 to do such a thing. Currently SP15 only catches the non-vendor exceptions.
Last edit: i-campbell 2020-03-13