after looking for documentation, i need some help. I am looking for a way (in ST langage codesys) to directly exit the main function. For this purpose, i try to make a JMP fonction to an external function (at the end of the main function to directly exit) but it is not working as label is not in the scope of the function calling the JMP.
So my question is : is there a way to directly exit the main function of codesys ?
Regards,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That sort of spaghetti code isn't a good way to program.
Depending which language you are using you should write code to selectively execute the intended block of supressable code.
Horrible to maintain when you have to drill through every single proceeding function call to know what the current line of code might be doing.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It is not a RETURN that i need. I want to immediately finish the program if CheckBounds detect an array problem. So i either look for a way to stop the program (may be an infinite loop) or to directly "Jump" at the end of the main program....
An idea to help me ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
where can i find the 3 libraries : "SysTypes2_Itfs", "CmpApp" and "_". Are they free ?
Add the following libraries in the library manager of the application:
CmpApp.library and _.library as placeholder libraries
SysTypes2_Itfs.library with Newest version always
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
i succeed with generated an exception. However, the Codesys compiler do not accepted "‘__TRY’, ‘__CATCH’, ‘__FINALLY’, ‘__ENDTRY’" instruction.
In the options, i have check "advanced CEI 61131-3" but it do not change things.
Is there a library to load... i currently target 3.5.0.2..
Thank in advance for help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello.
after looking for documentation, i need some help. I am looking for a way (in ST langage codesys) to directly exit the main function. For this purpose, i try to make a JMP fonction to an external function (at the end of the main function to directly exit) but it is not working as label is not in the scope of the function calling the JMP.
So my question is : is there a way to directly exit the main function of codesys ?
Regards,
Hi.
Seems like you talk about RETURN:
https://help.codesys.com/webapp/_cds_st ... n=3.5.15.0 m
That sort of spaghetti code isn't a good way to program.
Depending which language you are using you should write code to selectively execute the intended block of supressable code.
Horrible to maintain when you have to drill through every single proceeding function call to know what the current line of code might be doing.
Hello,
It is not a RETURN that i need. I want to immediately finish the program if CheckBounds detect an array problem. So i either look for a way to stop the program (may be an infinite loop) or to directly "Jump" at the end of the main program....
An idea to help me ?
Generate an exception.
https://help.codesys.com/webapp/_cds_ob ... n=3.5.15.0
Catch an exception
https://help.codesys.com/webapp/_cds_op ... n=3.5.15.0
For jumping right to the end of main, you can do a try catch block around all of its code.
Thank you. That is exactly what i was looking for.
Regards
Hello,
where can i find the 3 libraries : "SysTypes2_Itfs", "CmpApp" and "_". Are they free ?
Add the following libraries in the library manager of the application:
CmpApp.library and _.library as placeholder libraries
SysTypes2_Itfs.library with Newest version always
Sounds like you want help Adding a library to the application
https://help.codesys.com/webapp/_cds_ad ... n=3.5.15.0
Should be the same procedure but with the lib names you want. I think you might have a typo as there's no _ library
Hello,
i succeed with generated an exception. However, the Codesys compiler do not accepted "‘__TRY’, ‘__CATCH’, ‘__FINALLY’, ‘__ENDTRY’" instruction.
In the options, i have check "advanced CEI 61131-3" but it do not change things.
Is there a library to load... i currently target 3.5.0.2..
Thank in advance for help.
Hmm, scouring the web for release notes, it seems to be it's 3.5SP6 or newer and some embedded devices don't implement it.
You are right __TRY, __CATCH,.. is not support for 3.5.0.2.
Do simply 1/0.
Sent from my Moto G (5S) Plus using Tapatalk
What do you mean by "0/1". Can you explain a little bit more ?
What do you mean by "0/1". Can you explain a little bit more ?
If you make a division by 0 an codesys throws an exception.
Sent from my Moto G (5S) Plus using Tapatalk