Hi, All! Generating
the code for initialization variables IEC.code
:
DO4 AT %QW0.0.25344.4 : UINT;
void
config_init__(void) {
Thank! Best regards, Aleksandr Safronov! ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Beremiz-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/beremiz-devel |
On 18-03-20 11:49, [hidden email] wrote:
> Hi, All! > > Generating the code for initialization variables > > I have a problem: > There is a global variable that is referenced to a variable from the > Canfestival. For example %IV0.0.8192.1. Field init value - empty. > But in the code I see the following: > > IEC.code : > /CONFIGURATION config // > // VAR_GLOBAL // > // CONF : UINT := 1; // > / > > /DO4 AT %QW0.0.25344.4 : UINT; // > // DO5 AT %QW0.0.25344.5 : UINT := 0; // > // END_VAR // > / > > In config.c file: > > void config_init__(void) { > BOOL retain; > retain = 0; > __INIT_GLOBAL(UINT,CONF,__INITIAL_VALUE(1),retain) > > > __INIT_GLOBAL_LOCATED(CONFIG,DO4,__QW0_0_25344_4,retain) > __INIT_GLOBAL(UINT,DO4,__INITIAL_VALUE(0),retain) - WHY init 0? > > __INIT_GLOBAL_LOCATED(CONFIG,DO5,__QW0_0_25344_5,retain) > __INIT_GLOBAL(UINT,DO5,__INITIAL_VALUE(0),retain > > > Why (correctly?) with an empty field "Init value" initialize a variable? > > Thank! > > Best regards, > > Aleksandr Safronov! Hi Aleksandr, if "init value" is empty, then according to the standard IEC 61131-3 variable should be initialized to default value for variables of this type. What other would you expect for global variables? This is the same as in C. ;-) -- Best regards, Andrey Skvortsov ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Beremiz-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/beremiz-devel |
Free forum by Nabble | Edit this page |