当前位置:网站首页>倍福使用AdsRemote组件实现和C#的ADS通讯
倍福使用AdsRemote组件实现和C#的ADS通讯
2022-08-02 06:21:00 【黄昏和星空】
C# 倍福ADS的正确打开方式,使用AdsRemote组件优雅的通过ADS通讯,支持WPF窗体控件的绑定机制,做上位机页面很方便,大大节省了开发时间。
倍福的官方文档给的例子我就不多说了,今天介绍一种更改优雅的使用ADS组件进行通讯的方式,非常符合高级语言的编程风格,在也不用到处readany,writeany了。
https://github.com/nikvoronin/AdsRemote
AdsRemote:Beckhoff的TwinCAT.Ads API库的高级接口可以节省大量的开发时间。您不需要网络线程或句柄。只需声明一个C#变量,并通过变量属性将其绑定到PLC var。就这样。
我最喜欢的使用方式是变量变化后自动通知,类似观察者模式,不用傻傻的死等结果的反馈。Adsremote组件内部会使用一个线程来对取变量,当值发生变化时,调用ValueChanged事件。
PLC instance
First you have to create an instance of PLC object. This one wiil be like a factory that produces linked variables.
PLC plc = new PLC(“5.2.100.109.1.1”);
When device connected or disconnected
plc.DeviceReady += Plc_DeviceReady;
plc.DeviceLost += Plc_DeviceLost;
[…]
private void Plc_DeviceReady(object sender, AdsDevice e)
{
Log(“READY [” + e.Address.Port.ToStri
边栏推荐
- Kind of weird!Access the destination URL, the host can container but not
- 笔记本开机黑屏提示:ERROR 0199:System Security-Security password retry count exceeded
- Day 4 of HCIP
- C# Coding Conventions Handbook
- SphereEx苗立尧:云原生架构下的Database Mesh研发实践
- Resolving C# non-static field, method or property "islandnum.Program.getIslandCount(int[][], int, int)" requires an object reference
- 每周推荐短视频:为什么产品开发需要数字化?如何做到数字化?
- 张驰课堂:六西格玛测量系统的误差分析与判定
- chrome plugin development guide
- 宝塔+FastAdmin 404 Not Found
猜你喜欢
随机推荐
Specified URL is not reachable,caused by :‘Read timed out
论文《Deep Multifaceted Transformers for Multi-objective Ranking in Large-Scale E-commerce Recommender》
Project development specification
Expert Insights | 3 ways to seize innovation opportunities in a downturn
MySQL Advanced Statements (1)
实例029:反向输出
typescript 'props' is declared but its value is never read solution
The second day HCIP
笔记本开机黑屏提示:ERROR 0199:System Security-Security password retry count exceeded
2022年7月18日-7月31日(Ue4视频教程和文档,20小时。合计1412小时,剩8588小时)
Toolbox App 1.25 New Features at a Glance | Version Update
How does abaqus quickly import the assembly of other cae files?
In-depth analysis of the initialization of member variables and local variables
实验8 VLAN综合实验
张驰课堂:六西格玛测量系统的误差分析与判定
optional
(部分不懂,笔记整理未完成)【图论】差分约束
optional
Connection reset by peer 问题解析
.NET静态代码织入——肉夹馍(Rougamo) 发布1.1.0

![[数据集][VOC]眼睛佩戴数据集VOC格式6000张](/img/66/37f76d9ce5d5f68d6ea0e18710fa04.png)





![[npm install error report collection] - npm ERR! code ENOTEMPTY npm ERR! syscall rmdir](/img/c5/2c42e26e577506573985b30669ca6c.png)

