diff --git a/Rs.Motion/GugaoEcat/ECatIOCard.cs b/Rs.Motion/GugaoEcat/ECatIOCard.cs index f7c02de..9cc01c6 100644 --- a/Rs.Motion/GugaoEcat/ECatIOCard.cs +++ b/Rs.Motion/GugaoEcat/ECatIOCard.cs @@ -1,4 +1,6 @@ -using Rs.Motion.Base; +using Rs.Framework; +using Rs.Motion.Base; +using Rs.Motion.GugaoPulse; using System; using System.Collections.Generic; using System.Linq; @@ -44,6 +46,13 @@ namespace Rs.Motion.GugaoEcat io.Name = "In" + i + "_" + slaveNo; DIn.Add(io); } + + + } + public override void Save() + { + string filename = $"config/motion/io/gugao_ecat{CardID}.xml"; + XmlSerializerHelper.Instance.Serialize(filename, this); } } } diff --git a/Rs.Motion/IoManager.cs b/Rs.Motion/IoManager.cs index 6179ebf..44a5e91 100644 --- a/Rs.Motion/IoManager.cs +++ b/Rs.Motion/IoManager.cs @@ -206,7 +206,16 @@ namespace Rs.Motion ECatIO eio = (ECatIO)io; apiResult = mc_ecat.GTN_EcatIOBitReadOutput(eio.Core, eio.SlaveNo, eio.Offset, eio.Index, out byte pValue); if (apiResult == 0) - return pValue; + { + if (io.IsReverse) + { + return (short)((~pValue) & 0x01); + } + else + { + return pValue; + } + } } else { @@ -215,7 +224,15 @@ namespace Rs.Motion if (apiResult == 0) { byte pValue = (byte)(~(value >> eio.Index) & 0x01); - return pValue; + if(io.IsReverse) + { + return (short)((~pValue) & 0x01); + } + else + { + return pValue; + } + } } }