EC_Net 2026.5.9
dotnet add package EC_Net --version 2026.5.9
NuGet\Install-Package EC_Net -Version 2026.5.9
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="EC_Net" Version="2026.5.9" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EC_Net" Version="2026.5.9" />
<PackageReference Include="EC_Net" />
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 EC_Net --version 2026.5.9
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EC_Net, 2026.5.9"
#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 EC_Net@2026.5.9
#: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=EC_Net&version=2026.5.9
#tool nuget:?package=EC_Net&version=2026.5.9
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
EC_Net
简介 Introduction
EC_Net是SOEM包装器,用于win和linux控制EtherCat设备,目前只支持COE和IO从站
EC_Net is SOEM wrapper, used for controlling EtherCat devices on Windows and Linux, currently only supports COE and IO slaves
1.2版本之后使用以下方法初始化主站
//更新了新的soem动态库引用方式,不在需要手动设置,直接安装发布即可
//初始化主站
EtherCATMaster _etherCATMaster = new EtherCATMaster();
//初始化1个地址为1的驱动器,如果有多个驱动器直接创建对应地址的多个对象即可,模式配置可进行多模式配置,注意不要1个通道配置过多PDO参数,避免初始化失败
//多运行模式
EtherCATSlave_CIA402? _axis = new(_etherCATMaster, 1, 0, new Dictionary<ModesOperations, (int TxPdo, int RxPdo)>
{
{ ModesOperations.CSV,(0x1A00,0X1600) },
{ ModesOperations.CSP,(0x1A00,0X1600)}
});
//如果不需要在初始化时配置多轴,请自行在代码中添加轴PDO映射即可
//运行模式切换时,必须先断使能后重新使能才生效,属于CIA402规则,否则驱动器不执行指令
_axis?.PowerOff();
_axis?.ModeSwitch(ModesOperations.CSP);
_axis?.PowerOn();
//单运行模式请按照1.1.x版本进行配置
1.1.x版本之前使用以下方法初始化主站
//更新了新的soem动态库引用方式,不在需要手动设置,直接安装发布即可
//初始化主站
EtherCATMaster _etherCATMaster = new EtherCATMaster();
//初始化1个地址为1的驱动器,如果有多个驱动器直接创建对应地址的多个对象即可
EtherCATSlave_CIA402? _axis = new(_etherCATMaster, 1,EC_Net.Slave.ModesOperations.PP);
轴控方法
//启动主站,查找从站数量,参数为网卡名称
int Count = _etherCATMaster.StartActivity("EtherCatNet");
//启动周期任务,参数为周期时间(单位:微秒) 绑定CPU核心(仅windwos起作用)
_etherCATMaster.StartSync(2000,8);
//停止主站
_etherCATMaster.StopActivity();
//伺服使能
_axis.PowerOn();
//伺服去使能
_axis.PowerOff();
//周期同步位置运动
_axis.CSP_Position(postion)
//周期同步扭矩运动
_axis.CST_Torque(100)
//周期同步速度
_axis.CSV_Velocity(100)
//绝对位置运动参数为: 位置 速度 加速度 减速度(单位:Puls)
_axis.MoveAbsolute(postion, speed, speed * 10, speed * 10);
//相对位置运动,参数同上
_axis.MoveRelative(postion, speed, speed * 10, speed * 10);
//扭矩控制,目标扭矩,扭矩斜率
_axis.TorqueControl(1000,100);//扭矩控制,单位为百分比
//速度控制,目标速度,加速度,减速度
_axis.VelocityControl(1000, 100, 100);
//伺服复位
_axis.Reset();
//伺服停止
_axis.Stop(1000000);// 停止减速度
//伺服启动回零
_axis.Home();
//写入寄存器,<写入类型>参数:驱动器地址,索引,子索引,值
_axis.Master.WriteSDO<byte>(1, 0x6060, 0x00, 6);
//读寄存器,<读取类型>参数:驱动器地址,索引,子索引
_axis.Master.ReadSDO<int>(1, 0x6060, 0x00);
//获取输入
_axis.Master.GetInputs(1);//伺服地址
//获取输出
_axis.Master.GetOutputs(1);//伺服地址
//初始化完成后可读取参数
从站名:_axis.SlaveName
从站地址:_axis.SlaveAddr
从站状态:_axis.SlaveState
报警代码:_axis.ErrorCode
状态字:_axis.StatusWord
当前模式:_axis.ModesOperationDisplay
当前位置:_axis.PositionActualValue
当前速度:_axis.VelocityActualValue
控制字:_axis.Controlword
设置模式:_axis.ModesOperation
设置位置:_axis.TargetPosition
设置速度:_axis.ProfileVelocity
设置加速度:_axis.ProfileAcceleration
设置减速度:_axis.ProfileDeceleration
快速停机:_axis.QuickOptionCode
停止代码:_axis.HaltOptionCode
伺服无故障:_axis.AxisState.ReadyToSwitchOn
等待打开伺服使能:_axis.AxisState.SwitchedOn
伺服运行:_axis.AxisState.OperationEnabled
故障:_axis.AxisState.Fault
接通主回路电:_axis.AxisState.VoltageEnabled
快速停机:_axis.AxisState.QuickStop
伺服准备好:_axis.AxisState.SwitchOnDisabled
警告:_axis.AxisState.Warning
远程控制:_axis.AxisState.Remote
目前到达:_axis.AxisState.TargetReached
内部软限位状态:_axis.AxisState.InternalLimitActive
回原点完成输出:_axis.AxisState.HomingAttained
IO控制
EtherCATMaster _etherCATMaster = new EtherCATMaster();
//初始化从站
IEtherCATSlave _etherCATSlave = new EtherCATSlave(_etherCATMaster, 1)
//启动主站,查找从站数量,参数为网卡名称
int Count = _etherCATMaster.StartActivity("EtherCatNet");
//启动周期任务,参数为周期时间(单位:毫秒)
_etherCATMaster.StartSync(1);
//停止网卡
_etherCATMaster.StopActivity();
//创建输入索引
TransmitPDOMapping in1 = _etherCATSlave.AddTxPDOMapping(0, typeof(byte));// Inputs数组 索引0
//创建输出索引
ReceivePDOMapping out1 = _etherCATSlave.AddRxPDOMapping(0, typeof(byte));
//控制输出
out1.Value = (byte)0;
| 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
- No dependencies.
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 | |
|---|---|---|---|
| 2026.5.9 | 125 | 5/9/2026 | |
| 2026.4.11 | 132 | 4/11/2026 | |
| 2026.4.3 | 115 | 4/3/2026 | |
| 1.2.1 | 148 | 3/17/2026 | |
| 1.1.1 | 133 | 1/8/2026 | |
| 1.1.0 | 127 | 1/8/2026 | |
| 1.0.9 | 249 | 9/30/2025 | |
| 1.0.8 | 205 | 9/26/2025 | |
| 1.0.6 | 305 | 7/8/2025 | |
| 1.0.5 | 485 | 6/12/2025 | |
| 1.0.4 | 589 | 6/12/2025 | |
| 1.0.3 | 203 | 5/30/2025 | |
| 1.0.2 | 216 | 5/30/2025 | |
| 1.0.1 | 227 | 5/29/2025 | |
| 1.0.0 | 212 | 5/29/2025 |
修改对AOT发布的警告