--- a/etherlab/plc_ds402node.c Sun Mar 11 21:57:00 2012 +0100
+++ b/etherlab/plc_ds402node.c Sun Mar 18 23:57:32 2012 +0100
@@ -19,6 +19,7 @@
IEC_UINT __InactiveMask = 0x4f;
IEC_UINT __ActiveMask = 0x6f;
IEC_UINT __PowerMask = 0x10;
+IEC_BOOL __FirstTick = 1;
typedef enum {
__Unknown,
@@ -44,8 +45,8 @@
int __init_%(location)s()
{
-%(init_entry_variables)s;
-*__IW%(location)s_0 = __MK_AllocAxis(&(__DS402Node_%(location)s.axis));
+%(init_entry_variables)s
+ *__IW%(location)s_0 = __MK_AllocAxis(&(__DS402Node_%(location)s.axis));
return 0;
}
@@ -58,6 +59,11 @@
IEC_UINT statusword_inactive = *(__DS402Node_%(location)s.StatusWord) & __InactiveMask;
IEC_UINT statusword_active = *(__DS402Node_%(location)s.StatusWord) & __ActiveMask;
+ if (__FirstTick) {
+%(init_axis_params)s
+ _FirstTick = 0;
+ }
+
// DS402 node state computation
__DS402Node_%(location)s.state = __Unknown;
switch (statusword_inactive) {