In my projet I use Softmotion.
There are several Softmotion axis (type SM_Drive_Virtual).
In the Global Variable List I have an array of pointers to the adress of the Axis.
Axis : ARRAY[1..iMaxCntAxes] OF POINTER TO AXIS_REF_SM3 := [
ADR(AX01_Axis), // [1]
ADR(AX02_Axis), // [2]
This works, but when compiling I get the message :
. [WARNING] E3D: GVL Device: PLC Logic: Application: C0564: A reference to uninitialized variable AX01_Axis is used for initialization of Axis. Accessing the uninitialized variable may result in unexpected behavior. [WARNING] E3D: GVL Device: PLC Logic: Application: C0564: A reference to uninitialized variable AX02_Axis is used for initialization of Axis. Accessing the uninitialized variable may result in unexpected behavior.
Is there a way when initializing to force the hardware (softmotion axis) to first initialize and then the Global Variable List?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In my projet I use Softmotion.
There are several Softmotion axis (type SM_Drive_Virtual).
In the Global Variable List I have an array of pointers to the adress of the Axis.
Axis : ARRAY[1..iMaxCntAxes] OF POINTER TO AXIS_REF_SM3 := [
ADR(AX01_Axis), // [1]
ADR(AX02_Axis), // [2]
This works, but when compiling I get the message :
.
[WARNING] E3D: GVL Device: PLC Logic: Application: C0564: A reference to uninitialized variable AX01_Axis is used for initialization of Axis. Accessing the uninitialized variable may result in unexpected behavior.
[WARNING] E3D: GVL Device: PLC Logic: Application: C0564: A reference to uninitialized variable AX02_Axis is used for initialization of Axis. Accessing the uninitialized variable may result in unexpected behavior.
Is there a way when initializing to force the hardware (softmotion axis) to first initialize and then the Global Variable List?
No ideas?
I get the same warning message with initialized variable.
Codesys 3.5.19.20
Hi, you can take a look at https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_pragma_attribute_global_init_slot.html
Maybe it helps.