CSoft.Protocol.IOBoard1629 11.0.0

dotnet add package CSoft.Protocol.IOBoard1629 --version 11.0.0
                    
NuGet\Install-Package CSoft.Protocol.IOBoard1629 -Version 11.0.0
                    
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.IOBoard1629" Version="11.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CSoft.Protocol.IOBoard1629" Version="11.0.0" />
                    
Directory.Packages.props
<PackageReference Include="CSoft.Protocol.IOBoard1629" />
                    
Project file
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 CSoft.Protocol.IOBoard1629 --version 11.0.0
                    
#r "nuget: CSoft.Protocol.IOBoard1629, 11.0.0"
                    
#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 CSoft.Protocol.IOBoard1629@11.0.0
                    
#: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=CSoft.Protocol.IOBoard1629&version=11.0.0
                    
Install as a Cake Addin
#tool nuget:?package=CSoft.Protocol.IOBoard1629&version=11.0.0
                    
Install as a Cake Tool

IOBoard-1629 接口板协议库

NuGet 包 CSoft.Protocol.IOBoard1629,支持 .NET Standard 2.0 和 .NET 8–11。通过 RS485 和 QL 主站读写帧访问接口板。

串口接入

填写主机实际连接的串口名。配套上位机默认使用 115200、8N1 和站号 0x10000001。接口板端口为 COM3,主机端口以接线和操作系统为准,串口参数可在构造函数中调整。

using CSoft.Protocol.IOBoard1629;

await using var serial = new IOBoard1629SerialPort(portName);
await serial.OpenAsync();

var board = new IOBoard1629Client(serial);
var battery = await board.ReadBatteryStatusAsync();
var di = await board.ReadDigitalInputsAsync();
var outputs = await board.ReadDigitalOutputsAsync();
var currents = await board.ReadAnalogInputsAsync();
var locked = await board.ReadDoorLockedAsync();

Console.WriteLine($"电池 {battery.CapacityPercent}% ({battery.Level}/4 格)");
Console.WriteLine($"DI 0x{di:X2},DO 0x{outputs:X2},AI1 {currents[0]} mA,已上锁 {locked}");

已有 QL 主站的程序可以通过实现 IIOBoard1629RegisterAccess 复用同一套设备 API。

功能 API 与寄存器
电池状态 ReadBatteryStatusAsync 返回电压 mV、百分比、供电来源、使能、充电状态和格数。寄存器块 0x0806–0x080D。
电池控制 SetBatteryEnabledAsync 写 0x0809,SetBatteryPowerDownAsync 写 0x080A。后者置位拉低 EN_BAT12V,清零恢复该控制信号。
DI 输入 ReadDigitalInputsAsync 读 0x07D2 位图,ReadDigitalInputAsync 读 0x07D3–0x07DA 单路状态。
DO 输出 ReadDigitalOutputsAsync 读 0x07E4 位图。 ReadDigitalOutputAsync 和 SetDigitalOutputAsync 读写 0x07E5–0x07EC,true 表示闭合,false 表示断开。
AI 输入 ReadAnalogInputsAsync 连读 0x07F6–0x07FD,ReadAnalogInputAsync 读指定通道。返回实际电流,单位 mA。
电子门锁 UnlockDoorAsync 写 0x080E 触发板端 500 ms 脉冲,ReadDoorLockedAsync 读 0x080F 锁体反馈。

DI、DO、AI API 的通道号均为 1–8。DI 和 DO 位图的位 0–7 对应通道 1–8。

串口客户端按顺序收发,校验长度、CRC、站号、功能码和寄存器起始地址。板端错误应答通过 IOBoard1629ProtocolException.ErrorCode 提供。命令发送后会等应答或超时再释放串口。写入超时可能发生在设备执行后,库不自动重发。

寄存器映射依据《IOBoard1629_Protocol》,帧格式依据《启绿嵌入式软件通讯协议标准》§3.3 的报文示例。CRC 低字节先发,寄存器槽为 4 字节小端。电池总使能的掉电保存行为在寄存器表和测试上位机说明中有差异,应以现场固件为准。

构建与验证

dotnet run --project tests/IOBoard1629.Protocol.Tests -c Release
dotnet pack src/CSoft.Protocol.IOBoard1629 -c Release -o output
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.  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.  net11.0 is compatible. 
.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.

Version Downloads Last Updated
11.0.0 0 11/27/2026