Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SCADA/Program/DataService/CacheReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public ItemData<int> ReadInt32(DeviceAddress address)
}
else
{
result = (_cache[startIndex + 1] << 16) | ((ushort)_cache[startIndex]);
result = (_cache[startIndex] << 16) | ((ushort)_cache[startIndex + 1]);
}
return new ItemData<int>(result, 0, QUALITIES.QUALITY_GOOD);
}
Expand Down
27 changes: 27 additions & 0 deletions SCADA/Program/ModbusDriver/ModbusRTUDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,17 @@ public DeviceAddress GetDeviceAddress(string address)
dv.Bit--;
}
break;
case '5':
{
dv.DBNumber = Modbus.fctWriteSingleCoil;
int st;
int.TryParse(address.Substring(1), out st);
dv.Bit = (byte)(st % 16);
st /= 16;
dv.Start = st;
dv.Bit--;
}
break;
case '1':
{
dv.DBNumber = Modbus.fctReadDiscreteInputs;
Expand Down Expand Up @@ -457,6 +468,22 @@ public DeviceAddress GetDeviceAddress(string address)
dv.ByteOrder = ByteOrder.BigEndian;
}
break;
case 'F':
{
int index = address.IndexOf('.');
dv.DBNumber = Modbus.fctWriteMultipleRegister;
if (index > 0)
{
dv.Start = int.Parse(address.Substring(1, index - 1));
dv.Bit = byte.Parse(address.Substring(index + 1));
}
else
dv.Start = int.Parse(address.Substring(1));
dv.Start--;
dv.Bit--;
dv.ByteOrder = ByteOrder.BigEndian;
}
break;
}
return dv;
}
Expand Down