NModbusAsync 3.0.2

dotnet add package NModbusAsync --version 3.0.2                
NuGet\Install-Package NModbusAsync -Version 3.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NModbusAsync" Version="3.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NModbusAsync --version 3.0.2                
#r "nuget: NModbusAsync, 3.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NModbusAsync as a Cake Addin
#addin nuget:?package=NModbusAsync&version=3.0.2

// Install NModbusAsync as a Cake Tool
#tool nuget:?package=NModbusAsync&version=3.0.2                

NModbusAsync

NModbusAsync is a striped to the bone version of NModbus library.

The only thing that left is Modbus over TCP and Modbus RTU over TPC masters.

The main difference and advantage of NModbusAsync is that all operations now utilize only asynchronous I/O.

Prerequisites

.NET Standart 2.1

Usage examples

// create & connect your TCP client (or something derived from it)
// you are responsible for managing it
var tcpClient = new TcpClient();
tcpClient.Connect(IPAddress.Loopback, 502);

// create master factory
var masterFactory = new ModbusFactory(); // optional Microsoft logger can be passed

// call CreateTcpMaster or CreateRtuOverTcpMaster to create the master
var master = masterFactory.CreateTcpMaster(tcpClient); // optional Microsoft logger can be passed as well

// call methods on modbus master to read/write from coils/registers
var actual = await master.ReadInputRegistersAsync(slaveAddress: 1, startAddress: 1, numberOfPoints: 2, token: default);

// a bit hacky way to get your tcpClient back from master
var resource = (master.Transport.PipeResource as IPipeResource<TcpClient>)?.Resource;

// configuring communication settings
// detailed explanation in xml comments
modbusMaster.Transport.ReadTimeout = ReadTimeout;
modbusMaster.Transport.WriteTimeout = WriteTimeout;
modbusMaster.Transport.RetryOnOldTransactionIdThreshold = RetryOnOldTransactionIdThreshold; // tcp only
modbusMaster.Transport.RetryOnInvalidResponseCount = RetryOnInvalidResponseCount; // rtu only
modbusMaster.Transport.SlaveBusyUsesRetryCount = SlaveBusyUsesRetryCount;
modbusMaster.Transport.WaitToRetryMilliseconds = WaitToRetryMilliseconds;
modbusMaster.Transport.Retries = Retries;

Acknowledgments

Most of the code was originally written by the authors of NModbus library.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 was computed.  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 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
3.0.2 69 1/7/2025
3.0.1 373 9/19/2024
3.0.0 215 7/2/2024
2.1.3 2,896 3/31/2022