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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
Hi. Check this:
https://help.codesys.com/webapp/_cds_pointer_super;product=codesys;version=3.5.16.0
In your case you need to call SUPER^(); in body of your child FB.
Last edit: kislov 2020-09-23
ok, so now it works as required
thank you so much.
BR
Stefano Marmiroli
ok, so now it works as required
thank you so much.
BR
Stefano Marmiroli