Skip to content

Commit

Permalink
fix bugs in shortgroup
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinYellow committed Feb 9, 2018
1 parent 5c8c046 commit 5c4481b
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 7 deletions.
Binary file modified SCADA/Example/BatchCoreTest.exe
Binary file not shown.
Binary file modified SCADA/Example/ClientDriver.dll
Binary file not shown.
Binary file modified SCADA/Example/DataService.dll
Binary file not shown.
Binary file modified SCADA/Program/.vs/DataExchange/v15/.suo
Binary file not shown.
Binary file modified SCADA/Program/.vs/DataExchange/v15/Server/sqlite3/storage.ide
Binary file not shown.
Binary file modified SCADA/Program/.vs/DataExchange/v15/sqlite3/storage.ide
Binary file not shown.
2 changes: 1 addition & 1 deletion SCADA/Program/DataService/PLCGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ protected override unsafe void Poll()
{
for (int i = 0; i < addr.DataSize / 2; i++)
{
prcv[iShort1] = IPAddress.HostToNetworkOrder(prcv[iShort1]);
prcv[iShort1 + i] = IPAddress.HostToNetworkOrder(prcv[iShort1 + i]);
}
}
if (addr.DataSize <= 2)
Expand Down
15 changes: 9 additions & 6 deletions SCADA/Program/ModbusDriver/ModbusRTUDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,20 +478,23 @@ public byte[] ReadBytes(DeviceAddress address, ushort size)
CreateReadHeader(address.Area, address.Start, size, func);
lock (_async)
{
byte[] frameBytes = new byte[size * 2 + 3];//size * 2 +
byte[] frameBytes = new byte[size * 2 + 5];//size * 2 +
byte[] data = new byte[size * 2];
_serialPort.Write(header, 0, header.Length);
int numBytesRead = 0;
while (numBytesRead < 2)
numBytesRead += _serialPort.Read(frameBytes, numBytesRead, 2 - numBytesRead);
if (frameBytes[1] == address.DBNumber)
{
numBytesRead = 0;
while (numBytesRead != frameBytes.Length)
while (numBytesRead < frameBytes.Length)
numBytesRead += _serialPort.Read(frameBytes, numBytesRead, frameBytes.Length - numBytesRead);
Array.Copy(frameBytes, 1, data, 0, data.Length);
Thread.Sleep(20);
return data;
if (Utility.CheckSumCRC(frameBytes))
{
Array.Copy(frameBytes, 3, data, 0, data.Length);
Thread.Sleep(20);
return data;
}
else Thread.Sleep(10);
}
else
{
Expand Down
Binary file modified SCADA/dll/DataService.dll
Binary file not shown.
Binary file modified SCADA/dll/ModbusDriver.dll
Binary file not shown.
Binary file modified SCADA/dll/OPCDriver.dll
Binary file not shown.
Binary file modified SCADA/dll/SiemensPLCDriver.dll
Binary file not shown.

0 comments on commit 5c4481b

Please sign in to comment.