Added support for MC_*DigitalOutput, MC_ReadAxisInfo and MC_ReadAxisError blocks from MCL in DS402 nodes generated code
authorLaurent Bessard
Thu, 07 Feb 2013 00:59:50 +0100
changeset 2096 c9b0340ea0f5
parent 2095 6733a7c5c897
child 2097 58d07e039896
Added support for MC_*DigitalOutput, MC_ReadAxisInfo and MC_ReadAxisError blocks from MCL in DS402 nodes generated code
etherlab/etherlab.py
etherlab/plc_cia402node.c
--- a/etherlab/etherlab.py	Wed Jan 30 23:46:58 2013 +0100
+++ b/etherlab/etherlab.py	Thu Feb 07 00:59:50 2013 +0100
@@ -202,9 +202,17 @@
     DEFAULT_PUBLISH = "    *(__CIA402Node_%(location)s.%(name)s) = __CIA402Node_%(location)s.axis->%(name)s;"
     
     EXTRA_NODE_VARIABLES = [
+        ("ErrorCode", [
+            {"description": ("ErrorCode", 0x603F, 0x00, "UINT", "I"),
+             "publish": None}
+            ]),
         ("DigitalInputs", [
             {"description": ("DigitalInputs", 0x60FD, 0x00, "UDINT", "I"),
              "publish": None}
+            ]),
+        ("DigitalOutputs", [
+            {"description": ("DigitalOutputs", 0x60FE, 0x00, "UDINT", "Q"),
+             "retrieve": None}
             ])
     ]
     EXTRA_NODE_VARIABLES_DICT = dict([("Enable" + name, value) for name, value in EXTRA_NODE_VARIABLES])
--- a/etherlab/plc_cia402node.c	Wed Jan 30 23:46:58 2013 +0100
+++ b/etherlab/plc_cia402node.c	Thu Feb 07 00:59:50 2013 +0100
@@ -118,6 +118,8 @@
 	}
 
 	// Default variables retrieve
+	__CIA402Node_%(location)s.axis->CommunicationReady = *(__CIA402Node_%(location)s.StatusWord) != 0;
+	__CIA402Node_%(location)s.axis->ReadyForPowerOn = __CIA402Node_%(location)s.state == __SwitchedOn || __OperationEnabled;
 	__CIA402Node_%(location)s.axis->PowerFeedback = __CIA402Node_%(location)s.state == __OperationEnabled;
 	__CIA402Node_%(location)s.axis->ActualPosition = AXIS_UNIT_TO_USER_UNIT(*(__CIA402Node_%(location)s.ActualPosition));
 	__CIA402Node_%(location)s.axis->ActualVelocity = AXIS_UNIT_TO_USER_UNIT(*(__CIA402Node_%(location)s.ActualVelocity));