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

Code not executed in extended function

smarmiroli
2020-09-22
2020-09-23
  • smarmiroli - 2020-09-22

    Hi,
    I created a structure like this

    FUNCTION_BLOCK FB_Base
    VAR
    init : INT := 0;
    END_VAR
    init := 1;
    END_FUNCTION_BLOCK ( i've added this line to clarify, of course IDE does not show it)

    FUNCTION_BLOCK FB_BaseEX EXTENDS FB_Base

    END_FUNCTION_BLOCK ( same thing as the analogous line above )

    When a instance of FB_BaseEx is called, the internal variable init remains equal to 0
    as if the base function code was not executed. is it correct? How can i make the code of the base function also be executed by the child functions?
    BR
    Stefano Marmiroli

     
  • smarmiroli - 2020-09-23

    ok, so now it works as required
    thank you so much.

    BR
    Stefano Marmiroli

     
  • smarmiroli - 2020-09-23

    ok, so now it works as required
    thank you so much.

    BR
    Stefano Marmiroli

     

Log in to post a comment.