CSoft.Protocol.Modbus 8.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package CSoft.Protocol.Modbus --version 8.0.5                
NuGet\Install-Package CSoft.Protocol.Modbus -Version 8.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="CSoft.Protocol.Modbus" Version="8.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CSoft.Protocol.Modbus --version 8.0.5                
#r "nuget: CSoft.Protocol.Modbus, 8.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.
// Install CSoft.Protocol.Modbus as a Cake Addin
#addin nuget:?package=CSoft.Protocol.Modbus&version=8.0.5

// Install CSoft.Protocol.Modbus as a Cake Tool
#tool nuget:?package=CSoft.Protocol.Modbus&version=8.0.5                

Modbus协议:

IModBusRtu modBusRtu = new ModBusRtu(new SerialPort("COM2"));

//01 03 00 01 00 05 D4 09 -> 01 03 0A 41 A0 00 00 00 15 41 B0 00 00 97 B8(20、21、22)
var block = new Modbus.Parameter.BlockInfo();
block.ChannelInfos.Add(new() { ChannelId = "1", RegisterAddress = 1, ValueType = RegisterValueType.Float });
block.ChannelInfos.Add(new() { ChannelId = "2", RegisterAddress = 3, ValueType = RegisterValueType.UInt16 });
block.ChannelInfos.Add(new() { ChannelId = "3", RegisterAddress = 4, ValueType = RegisterValueType.Float });

modBusRtu.BlockInfos.Add(block);

//01 03 00 09 00 06 15 CA -> 01 03 0C 41 F0 00 00 42 20 00 00 42 48 00 00 5C CA(30、40、50)
block = new Modbus.Parameter.BlockInfo();
block.ChannelInfos.Add(new() { RegisterAddress = 9, ValueType = RegisterValueType.Float });
block.ChannelInfos.Add(new() { RegisterAddress = 11, ValueType = RegisterValueType.Float });
block.ChannelInfos.Add(new() { RegisterAddress = 13, ValueType = RegisterValueType.Float });

modBusRtu.BlockInfos.Add(block);

await modBusRtu.OpenAsync();

var rs = await modBusRtu.GetAsync("01");

await modBusRtu.SetAsync("01",
    [
    new Modbus.Parameter.SetBlockInfo() { RegisterAddress = 01, Data = [0x3F, 0x80, 0x00, 0x00] },
    new Modbus.Parameter.SetBlockInfo() { RegisterAddress = 03, Data = [0x3F, 0x80, 0x00, 0x00] }
    ]);
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 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. 
.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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

支持高字节优先配置选项

为ModBusRtu和相关类添加了高字节优先的支持。主要更改包括在ModBusRtu.cs中为ModBusRtu类添加IsHighByteBefore_Req属性,以支持请求时高字节优先的配置;在ChannelInfo.cs中为ChannelInfo类添加了可空的布尔属性IsHighByteBefore,用于指定通道数据的处理方式;在SetReq.cs和GetRsp.cs中修改了构造函数和数据处理逻辑,以支持高字节优先的配置。这些更改允许用户在设置请求和处理响应时,根据通道配置选择合适的字节顺序。