Clearified/fixed description of different protocol implementations
This commit is contained in:
@@ -6,11 +6,13 @@ using AMWD.Protocols.Modbus.Common.Contracts;
|
||||
namespace AMWD.Protocols.Modbus.Common.Protocols
|
||||
{
|
||||
/// <summary>
|
||||
/// Implementation of the Modbus RTU over TCP protocol.
|
||||
/// Implementation of the Modbus RTU over Modbus TCP protocol.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The Modbus RTU over Modbus TCP is rarely used.
|
||||
/// It is a non-standard variant of Modbus TCP that includes the Modbus RTU CRC at the end of the message.
|
||||
/// It is a non-standard variant of Modbus TCP that includes wrapps a Modbus RTU message within a Modbus TCP message.
|
||||
/// <br/>
|
||||
/// Definition found on <see href="https://www.fernhillsoftware.com/help/drivers/modbus/modbus-protocol.html">Fernhill Software</see>.
|
||||
/// </remarks>
|
||||
public class RtuOverTcpProtocol : IModbusProtocol
|
||||
{
|
||||
@@ -475,16 +477,16 @@ namespace AMWD.Protocols.Modbus.Common.Protocols
|
||||
// Function code
|
||||
request[7] = (byte)ModbusFunctionCode.WriteSingleRegister;
|
||||
|
||||
byte[] addrBytes = register.Address.ToBigEndianBytes();
|
||||
request[8] = addrBytes[0];
|
||||
byte[] addrBytes = register.Address.ToBigEndianBytes();
|
||||
request[8] = addrBytes[0];
|
||||
request[9] = addrBytes[1];
|
||||
|
||||
request[10] = register.HighByte;
|
||||
request[10] = register.HighByte;
|
||||
request[11] = register.LowByte;
|
||||
|
||||
// CRC
|
||||
byte[] crc = RtuProtocol.CRC16(request, 6, 6);
|
||||
request[12] = crc[0];
|
||||
byte[] crc = RtuProtocol.CRC16(request, 6, 6);
|
||||
request[12] = crc[0];
|
||||
request[13] = crc[1];
|
||||
|
||||
return request;
|
||||
|
||||
Reference in New Issue
Block a user