ModbusKit 1.0.5
dotnet add package ModbusKit --version 1.0.5
NuGet\Install-Package ModbusKit -Version 1.0.5
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="ModbusKit" Version="1.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ModbusKit" Version="1.0.5" />
<PackageReference Include="ModbusKit" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ModbusKit --version 1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ModbusKit, 1.0.5"
#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.
#:package ModbusKit@1.0.5
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ModbusKit&version=1.0.5
#tool nuget:?package=ModbusKit&version=1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ModbusKit
Github:https://github.com/CH-1024/ModbusKit
// Master Example
public class UcMasterViewModel : BindableBase
{
ModbusKitMaster _master;
string Type;
private void Connect()
{
try
{
if (Type == "Serial")
{
_master = ModbusKitMaster.CreateSerialMaster(port, baudRate, parity, dataBits, stopBits);
}
if (Type == "Tcp")
{
_master = ModbusKitMaster.CreateTcpMaster(ip, port);
}
if (Type == "Udp")
{
_master = ModbusKitMaster.CreateUdpMaster(ip, port);
}
_master.SetEndian(EndianOrder.BigEndian);
_master.SetDelay(20);
}
catch (Exception e)
{
}
}
private async Task Send()
{
await _master.Write_Single_Int32_ToHoldingRegisters(slaveId, address1, "123");
int v1 = await _master.Read_Single_Int32_FromHoldingRegisters(slaveId, address1);
await _master.Write_Multi_Int32_ToHoldingRegisters(slaveId, address2, ["1234", "2345", "3456"]);
List<int> v2 = await _master.Read_Multi_Int32_FromHoldingRegisters(slaveId, address2, 3);
await _master.Write_Multi_ASCII_ToHoldingRegisters(slaveId, address3, "ASCII String");
string str = await _master.Read_Multi_ASCII_FromHoldingRegisters(slaveId, address3, 50); // "ASCII String"
}
}
// Slave Example
public class UcSlaveViewModel : BindableBase, IDialogAware
{
ModbusKitSlave _slave;
string Type;
private void OnHoldingRegisterRequestReceived(StorageEventArgs<ushort> args)
{
}
private void OnDisconnect(Exception e)
{
if (e != null) Log(e.Message);
if (_slave != null)
{
_slave.OnHoldingRegisterRequestReceived -= OnHoldingRegisterRequestReceived;
_slave.OnDisconnect -= OnDisconnect;
}
_slave?.Dispose();
_slave = null;
}
private void Listen()
{
if (_slave?.IsListening == true)
{
return;
}
try
{
if (Type == "Serial")
{
_slave = ModbusKitSlave.CreateSerialSlave(slaveId, port, baudRate, parity, dataBits, stopBits);
}
if (Type == "Tcp")
{
_slave = ModbusKitSlave.CreateTcpSlave(slaveId, ip, port);
}
if (Type == "Udp")
{
_slave = ModbusKitSlave.CreateUdpSlave(slaveId, port);
}
_slave.SetEndian(EndianOrder.BigEndian);
_slave.SetDelay(0);
_slave.OnHoldingRegisterRequestReceived += OnHoldingRegisterRequestReceived;
_slave.OnDisconnect += OnDisconnect;
_slave.StartListen();
}
catch (Exception e)
{
}
}
private void Close()
{
_slave?.Stop();
}
private async Task Send()
{
await _master.Write_Single_Int32_ToHoldingRegisters(address1, "123");
int v1 = await _master.Read_Single_Int32_FromHoldingRegisters(address1);
await _master.Write_Multi_Int32_ToHoldingRegisters(address2, ["1234", "2345", "3456"]);
List<int> v2 = await _master.Read_Multi_Int32_FromHoldingRegisters(address2, 3);
await _master.Write_Multi_ASCII_ToHoldingRegisters(address3, "ASCII String");
string str = await _master.Read_Multi_ASCII_FromHoldingRegisters(address3, 50); // "ASCII String"
}
}
| Product | Versions 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. net10.0 was computed. 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. 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.
-
.NETStandard 2.0
- NModbus (>= 3.0.81)
- NModbus.Serial (>= 3.0.81)
- System.IO.Ports (>= 7.0.0)
- System.Text.Encoding.CodePages (>= 10.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.