Long Jump/Exit

2019-09-23
2019-09-30
  • 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,

     
  • i-campbell

    i-campbell - 2019-09-23

    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 ?

     
  • 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

     
  • i-campbell

    i-campbell - 2019-09-26

    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.

     
  • i-campbell

    i-campbell - 2019-09-27

    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.

     
  • josepmariarams - 2019-09-28

    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 ?

     
  • josepmariarams - 2019-09-30

    If you make a division by 0 an codesys throws an exception.

    Sent from my Moto G (5S) Plus using Tapatalk

     

Log in to post a comment.