README.md 1.97 KB
Newer Older
Andreas Müller's avatar
Andreas Müller committed
1
2
3
# Modbus

Implements the Modbus communication protocol, written as a .NET Standard 2.0 library.
Andreas Müller's avatar
Andreas Müller committed
4
5
6
7
8
9
10
11

| Package         | NuGet                                                                                                                                                    |
|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| Modbus.Common   | [![NuGet](https://img.shields.io/nuget/v/AMWD.Modbus.Common.svg?style=flat-square)](https://www.nuget.org/packages/AMWD.Modbus.Common)                   |
| Modbus.Tcp      | [![NuGet](https://img.shields.io/nuget/v/AMWD.Modbus.Tcp.svg?style=flat-square)](https://www.nuget.org/packages/AMWD.Modbus.Tcp)                         |
| Modbus.Serial   | [![NuGet](https://img.shields.io/nuget/v/AMWD.Modbus.Serial.svg?style=flat-square)](https://www.nuget.org/packages/AMWD.Modbus.Serial)                   |
| Modbus.Proxy    | [![NuGet](https://img.shields.io/nuget/v/AMWD.Modbus.Proxy.svg?style=flat-square)](https://www.nuget.org/packages/AMWD.Modbus.Proxy)                     |
| Build Artifacts | [![pipeline status](https://git.am-wd.de/AM.WD/Modbus/badges/master/pipeline.svg?style=flat-square)](https://git.am-wd.de/AM.WD/Modbus/-/commits/master) |
Andreas Müller's avatar
Andreas Müller committed
12
13


Andreas Müller's avatar
Andreas Müller committed
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

## Example

You can use the clients without any big knowledge about the protocol:
```cs
string host = "modbus-device.local";
int port = 502;

using var client = new ModbusClient(host, port);
await client.Connect();

byte deviceIdentifier = 5;
ushort startAddress = 19000;
ushort count = 2;

var registers = await client.ReadHoldingRegisters(deviceIdentifier, startAddress, count);
float voltage = registers.GetSingle();

Console.WriteLine($"The voltage between L1 and N is: {voltage:N2}V");
```

Andreas Müller's avatar
Andreas Müller committed
35
For the people who have seen some devices: yes, it's a request to a Janitza device ;-).
Andreas Müller's avatar
Andreas Müller committed
36

Andreas Müller's avatar
Andreas Müller committed
37
38
## License

Andreas Müller's avatar
Andreas Müller committed
39
All packages published under the [MIT license](LICENSE.txt).