PLCcomModbus 9.1.5
dotnet add package PLCcomModbus --version 9.1.5
NuGet\Install-Package PLCcomModbus -Version 9.1.5
<PackageReference Include="PLCcomModbus" Version="9.1.5" />
<PackageVersion Include="PLCcomModbus" Version="9.1.5" />
<PackageReference Include="PLCcomModbus" />
paket add PLCcomModbus --version 9.1.5
#r "nuget: PLCcomModbus, 9.1.5"
#:package PLCcomModbus@9.1.5
#addin nuget:?package=PLCcomModbus&version=9.1.5
#tool nuget:?package=PLCcomModbus&version=9.1.5
PLCcomModbus
Professional Modbus communication for .NET applications.
PLCcomModbus is a .NET SDK for building Modbus master and slave applications. It provides a managed API for common Modbus communication scenarios and is designed for developers who want to integrate Modbus devices into their own software without implementing protocol framing, conversion rules, connection handling, or Secure Modbus TCP transport details themselves.
The library is delivered as a .NET assembly and can be referenced directly from your application through NuGet.
What PLCcomModbus has to offer
PLCcomModbus provides a compact API for reading and writing Modbus data, hosting Modbus slave endpoints, and handling diagnostic information in a form that can be used directly from C# or Visual Basic applications.
Key advantages:
- Modbus master and slave functionality in one package
- Modbus TCP, UDP, RTU, ASCII, RTU over TCP, and Secure Modbus TCP support
- SecureTCP transport with TLS 1.2 / TLS 1.3 support
- PKI store based certificate handling for Secure Modbus TCP
- Custom certificate validation for application-specific trust decisions
- Role-based authorization callback for Secure Modbus TCP slave requests
- 16-bit, 32-bit, and 64-bit register modes
- Configurable byte order for register value conversion
- Optimized grouped reads through ReadCollection
- Diagnostic logging with telegram information for troubleshooting
- Configurable connection timing, including delay after connection establishment
Supported application scenarios include:
- Reading and writing coils, discrete inputs, holding registers, and input registers
- Building Modbus TCP master applications
- Hosting Modbus TCP or SecureTCP slave listeners
- Integrating serial Modbus RTU/ASCII devices
- Communicating with devices that expose CANopen-style object dictionary access over Modbus
- Validating Secure Modbus TCP certificates through a PKI store or a custom validator
Getting started as Modbus master
1. Install the NuGet package
Install-Package PLCcomModbus
2. Import namespaces
using PLCcomModbus.Core;
using PLCcomModbus.Master;
3. Create a master and connect via Modbus TCP
string licenseUserName = "<Enter your UserName here>";
string licenseSerial = "<Enter your Serial here>";
using (ModbusMaster master = new ModbusMaster(licenseUserName, licenseSerial))
{
master.SetConnector_TCP("192.168.0.10", 502);
master.Connect();
ReadRequest request = RequestBuilder.ReadRequestBuilder.Create(
1,
eReadFunction.F03_Read_Holding_Registers,
0,
eDataType.USHORT,
1);
ReadResult result = master.Read(request);
if (result.Quality == OperationResult.eQuality.GOOD)
{
ushort value = (ushort)result.GetValue().GetValue(0);
Console.WriteLine("Register value: " + value);
}
}
Writing register values
using PLCcomModbus.Core;
using PLCcomModbus.Master;
string licenseUserName = "<Enter your UserName here>";
string licenseSerial = "<Enter your Serial here>";
using (ModbusMaster master = new ModbusMaster(licenseUserName, licenseSerial))
{
master.SetConnector_TCP("192.168.0.10", 502);
master.Connect();
WriteRequest request = RequestBuilder.WriteRequestBuilder.Create(
1,
eWriteFunction.F16_Write_Multiple_Registers,
0);
request.AddUShort(1234);
WriteResult result = master.Write(request);
Console.WriteLine("Write quality: " + result.Quality);
}
Hosting a Modbus slave
PLCcomModbus can also host a Modbus slave endpoint. The data store can be filled by your application and is then exposed through the configured listener.
using PLCcomModbus.Core;
using PLCcomModbus.Slave;
string licenseUserName = "<Enter your UserName here>";
string licenseSerial = "<Enter your Serial here>";
using (ModbusSlave slave = new ModbusSlave(licenseUserName, licenseSerial, 1))
{
slave.SetValue(0, eModbusRegion.HoldingRegister, (ushort)1234);
slave.AddOrReplaceListener_TCP("tcp-listener", 502);
Console.WriteLine("Modbus TCP slave is running. Press ENTER to stop.");
Console.ReadLine();
}
Secure Modbus TCP
Secure Modbus TCP protects the Modbus TCP transport with TLS. PLCcomModbus provides dedicated SecureTCP master connectors and slave listeners.
using PLCcomModbus.Core;
using PLCcomModbus.Core.Security;
using PLCcomModbus.Master;
string licenseUserName = "<Enter your UserName here>";
string licenseSerial = "<Enter your Serial here>";
SecureModbusPkiStore pkiStore = new SecureModbusPkiStore(
@"C:\ProgramData\MyApplication\pki");
SecureModbusTcpOptions options = new SecureModbusTcpOptions
{
PkiStore = pkiStore,
OwnCertificate = new SecureModbusOwnCertificate(
pkiStore,
"MyApplication",
"<PrivateKeyPassword>",
365)
};
using (ModbusMaster master = new ModbusMaster(licenseUserName, licenseSerial))
{
master.SetConnector_SecureTCP("192.168.0.10", 802, options);
master.Connect();
// Use master.Read(...), master.Write(...), or ReadCollection just like with plain TCP.
}
PKI store
On first access, PLCcomModbus creates the required PKI store structure when it does not yet exist. The store is used to decide which remote certificates are trusted and where unknown certificates are placed for review.
Important folders:
own- local endpoint certificatesown/private- private keys for local endpoint certificatestrusted- trusted remote certificatesissuers- CA or issuer certificatesrejected- unknown or rejected remote certificates
If no custom validator is configured, PLCcomModbus validates certificates against this store. Unknown remote certificates are placed in the rejected store so that an operator or integrator can review them deliberately.
Custom certificate validation
Applications can provide their own validator when trust decisions need to follow a project-specific policy. When a custom validator is configured, that validator is responsible for the certificate decision.
Role-based authorization
Secure Modbus TCP certificates may carry role information. On the slave side, PLCcomModbus can pass the resolved role name, certificate chain, Modbus function, and request context to an authorization validator. If no authorization validator is configured, requests that passed TLS and certificate validation are allowed.
Register modes and byte order
Standard Modbus registers are 16 bit wide. PLCcomModbus can also map consecutive Modbus registers to 32-bit or 64-bit PLCcom values.
Supported register modes:
eRegisterMode._16BiteRegisterMode._32BiteRegisterMode._64Bit
The byte order can be configured for value conversion. This is important for devices that store multi-register values in a vendor-specific order.
using PLCcomModbus.Core;
using PLCcomModbus.Master;
using (ModbusMaster master = new ModbusMaster("<UserName>", "<Serial>"))
{
master.RegisterMode = eRegisterMode._64Bit;
master.ByteOrder = eByteOrder.AB_CD;
master.SetConnector_TCP("192.168.0.10", 502);
master.Connect();
ReadRequest request = RequestBuilder.ReadRequestBuilder.Create(
1,
eReadFunction.F03_Read_Holding_Registers,
0,
eDataType.ULONG,
1);
ReadResult result = master.Read(request);
}
The 64-bit register mode is intended for 64-bit register data types such as signed 64-bit integers, unsigned 64-bit integers, and double precision floating-point values. It is not a replacement for 16-bit or 32-bit value access.
ReadCollection
ReadCollection can be used to group multiple read requests and reduce telegram traffic where possible.
ReadRequestCollection collection = new ReadRequestCollection();
collection.AddReadRequest(
"setpoint",
RequestBuilder.ReadRequestBuilder.Create(
1,
eReadFunction.F03_Read_Holding_Registers,
0,
eDataType.USHORT,
1));
collection.AddReadRequest(
"actualValue",
RequestBuilder.ReadRequestBuilder.Create(
1,
eReadFunction.F03_Read_Holding_Registers,
1,
eDataType.USHORT,
1));
ReadResultCollection results = master.Read(collection);
The result object contains both the individual read results and diagnostic information that can be used for troubleshooting.
System requirements
Supported platforms:
- Microsoft .NET Framework 4.7.2 or higher
- Microsoft .NET Framework 4.8
- Microsoft .NET Standard 2.1
- Microsoft .NET 5.0
- Microsoft .NET 6.0
- Microsoft .NET 7.0
- Microsoft .NET 8.0
- Microsoft .NET 9.0
- Microsoft .NET 10.0
Depending on the selected transport, the application environment must provide network access, serial port access, or certificate/private-key storage permissions.
Additional documentation
Product information: https://www.indi-an.com/en/plccom/modbus/modbus-overview/
Online class reference: https://docs.plccom.net/help_modbus/Net/help/html/R_Project_PLCCom_for_Modbus_Documentation.htm
Feedback
To provide feedback or report issues, please write to: support@indi-an.com
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| .NET Framework | net472 is compatible. net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.8
- BouncyCastle.Cryptography (>= 2.6.2)
- System.IO.Ports (>= 10.0.7)
-
net10.0
- BouncyCastle.Cryptography (>= 2.6.2)
- System.IO.Ports (>= 10.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 9.1.5 | 150 | 6/10/2026 | |
| 8.3.8 | 862 | 11/22/2024 | |
| 8.3.6 | 229 | 11/18/2024 | |
| 8.3.5 | 236 | 11/12/2024 | |
| 8.3.3 | 268 | 9/23/2024 | |
| 8.2.2 | 4,391 | 1/20/2023 | |
| 7.3.3.1 | 701 | 7/12/2021 | |
| 7.3.2.1 | 562 | 6/24/2021 | |
| 7.3.1.1 | 726 | 6/18/2021 | |
| 7.2.6.1 | 519 | 4/14/2021 | |
| 7.2.5.1 | 540 | 4/8/2021 | |
| 7.2.1.1 | 553 | 4/1/2021 | |
| 7.1.1.1 | 560 | 3/11/2021 |