Clearified/fixed description of different protocol implementations

This commit is contained in:
2024-07-17 18:00:16 +02:00
parent 6a63dbb739
commit e830e43c36
3 changed files with 18 additions and 11 deletions

View File

@@ -6,11 +6,13 @@ using AMWD.Protocols.Modbus.Common.Contracts;
namespace AMWD.Protocols.Modbus.Common.Protocols namespace AMWD.Protocols.Modbus.Common.Protocols
{ {
/// <summary> /// <summary>
/// Implementation of the Modbus RTU over TCP protocol. /// Implementation of the Modbus RTU over Modbus TCP protocol.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// The Modbus RTU over Modbus TCP is rarely used. /// 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> /// </remarks>
public class RtuOverTcpProtocol : IModbusProtocol public class RtuOverTcpProtocol : IModbusProtocol
{ {

View File

@@ -59,8 +59,8 @@ Here you have the specific default implementations for the Modbus Protocol.
- ASCII - ASCII
- RTU - RTU
- RTU over TCP
- TCP - TCP
- [RTU over TCP]
**NOTE:** **NOTE:**
The implementations over serial line (RTU and ASCII) have a minimum unit ID of one (1) and maximum unit ID of 247 referring to the specification. The implementations over serial line (RTU and ASCII) have a minimum unit ID of one (1) and maximum unit ID of 247 referring to the specification.
@@ -68,4 +68,9 @@ This validation is _not_ implemented here due to real world experience, that som
--- ---
Published under MIT License (see [**tl;dr**Legal](https://www.tldrlegal.com/license/mit-license)) Published under MIT License (see [**tl;dr**Legal])
[RTU over TCP]: https://www.fernhillsoftware.com/help/drivers/modbus/modbus-protocol.html
[**tl;dr**Legal]: https://www.tldrlegal.com/license/mit-license

View File

@@ -23,14 +23,14 @@ float voltage = registers.GetSingle();
Console.WriteLine($"The voltage of device #{unitId} between L1 and N is: {voltage:N2}V"); Console.WriteLine($"The voltage of device #{unitId} between L1 and N is: {voltage:N2}V");
``` ```
If you want to use the `RTU over TCP` protocol instead, you can do this on initialization: If you have a device speaking `RTU` connected over `TCP`, you can use it as followed:
```csharp ```csharp
// [...] // [...]
using var client = new ModbusTcpClient(host, port) using var client = new ModbusTcpClient(host, port)
{ {
Protocol = new RtuOverTcpProtocol(); Protocol = new RtuProtocol()
}; };
// [...] // [...]