|
@@ -161,6 +161,7 @@ namespace PLCTool.Common
|
|
|
switch (valueType)
|
|
|
{
|
|
|
case VarType.Bit:
|
|
|
+
|
|
|
BitState bit = BitState.OFF;
|
|
|
if (writeValue.Trim() == "1")
|
|
|
{
|
|
@@ -174,7 +175,16 @@ namespace PLCTool.Common
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- reSuc = ENT.SetBitState(PlcMemory.CIO, address, bit);
|
|
|
+ if (address.Contains("w") || address.Contains("W"))
|
|
|
+ {
|
|
|
+ reSuc = ENT.SetBitState(PlcMemory.WR, address, bit);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ reSuc = ENT.SetBitState(PlcMemory.CIO, address, bit);
|
|
|
+ }
|
|
|
+
|
|
|
//写成功
|
|
|
if (reSuc == 0)
|
|
|
{
|
|
@@ -185,7 +195,17 @@ namespace PLCTool.Common
|
|
|
break;
|
|
|
case VarType.Word:
|
|
|
short wValue = Convert.ToInt16(writeValue);
|
|
|
- reSuc = ENT.WriteWord(PlcMemory.DM, short.Parse(address), wValue);
|
|
|
+ if (address.Contains("w") || address.Contains("W"))
|
|
|
+ {
|
|
|
+ reSuc = ENT.WriteWord(PlcMemory.WR, short.Parse(address), wValue);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ reSuc = ENT.WriteWord(PlcMemory.DM, short.Parse(address), wValue);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
//写成功
|
|
|
if (reSuc == 0)
|
|
|
{
|