Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

I have error Call recursion

2022-04-05
2022-04-06
  • edwin200000 - 2022-04-05

    Hello,

    Ik want to make a function block that converts 16 inputs bool into one bytes number
    I have already a pack box for 8 inputs image 'knipsel'. Got that Pack box from a library.
    But now I want a pack box for 16 inputs. I already made a seperate function block program.
    and copy it in the program where I wanna use it. But I get a error called 'Call recursion'
    how can I fix that? And I am very new in codesys so made I maybe some more mistakes?

    Thanks in advance,

    Edwin

    PS: I have use fake inputs by the function block program do not pay attention.

     
  • edwin200000 - 2022-04-05

    I forgot the error notification

     
  • sgronchi - 2022-04-06

    You defined a function "Pack_16" and then proceed to call "Pack_16" inside it. How do you think this can work?

    Apart that recursion is generally disallowed (as opposed to other languages), but this would not make sense either, since you are not going to reach a base case.

    If you try this e.g. in C your program would hang indefinitely or get terminated by the OS due to a segmentation fault.

    Furthermore, I really doubt you can shove 16 bits in a BYTE...

     

Log in to post a comment.