# HG changeset patch # User Laurent Bessard # Date 1360195190 -3600 # Node ID c9b0340ea0f5ef6292cf744de0fb2b70c98551af # Parent 6733a7c5c8972145bbb585527edb9971e56a759e Added support for MC_*DigitalOutput, MC_ReadAxisInfo and MC_ReadAxisError blocks from MCL in DS402 nodes generated code diff -r 6733a7c5c897 -r c9b0340ea0f5 etherlab/etherlab.py --- 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]) diff -r 6733a7c5c897 -r c9b0340ea0f5 etherlab/plc_cia402node.c --- 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));