Join us today!
The uninitialized variable VarName is used for initialization of fb. Use the attribute 'global_init_slot' to change the order of initialisation.
@alex I can but this error comes 100% from FB_Init. IoDrv... code is system / Codesys library so I can't change it.
Temporary, dirty solution:
In TwinCAT I have had the same problem, but with two global variable lists.
The issue is the order of the initialization of function blocks or global variable lists. Your variable Z_A1_X2_Ethernet is most likely initialized after your fb: Fb_ModbusTcpSlaveDiagnostics.
TwinCAT gives the following instructions on how to explicitly set the order: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_plc_intro/2529649291.html&id=
In my problem, I used a variable from one global variable list to initialize another variable in a different global variable list.
My solution was to use {attribute 'global_init_slot' := '49992'} at the top of the global variable list that needed to be initialized first and {attribute 'global_init_slot' := '49993'} in the second global variable list.
- 17 Forums
- 267 Topics
- 942 Posts
- 0 Online
- 722 Members