当前位置:网站首页>倍福使用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
边栏推荐
猜你喜欢

HCIP day 3 experiment

How does abaqus quickly import the assembly of other cae files?

MySQL 5.7 installation tutorial (full-step, nanny-level tutorial)
![[数据集][VOC]男女数据集voc格式6188张](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
[数据集][VOC]男女数据集voc格式6188张

The nacos source code can not find the istio package

享年94岁,图灵奖得主、计算复杂性理论先驱Juris Hartmanis逝世

正则表达式的理解学习

Vscode连接远程服务器出现‘Acquiring lock on/home/~’问题

聊天机器人如何提升独立站的营销水平?

实例028:递归求等差数列
随机推荐
awk语法-01-基础语法(命令、选项、内部变量)
能与观众实时互动的Claper
August 2022 plan, focusing on ue4 video tutorials
MySQL 5.7 installation tutorial (full-step, nanny-level tutorial)
封装class类一次性解决全屏问题
System.Security.SecurityException: 未找到源,但未能搜索某些或全部事件日志。不可 访问的日志: Security
解决C#非静态字段、方法或属性“islandnum.Program.getIslandCount(int[][], int, int)”要求对象引用
2022.07.31(LC_6133_分组的最大数量)
速看!PMP新考纲、PMBOK第七版解读
.NET静态代码织入——肉夹馍(Rougamo) 发布1.1.0
每周推荐短视频:为什么产品开发需要数字化?如何做到数字化?
See the picture to understand | How to choose sales indicators to measure the health of business growth
Expert Insights | 3 ways to seize innovation opportunities in a downturn
Resolving C# non-static field, method or property "islandnum.Program.getIslandCount(int[][], int, int)" requires an object reference
2022夏暑假每日一题(六)
(部分不懂,笔记整理未完成)【图论】差分约束
第06章 索引的数据结构【2.索引及调优篇】【MySQL高级】
APP专项测试:流量测试
MySQL high-level --- storage engine, index, lock
aTrust项目的相关操作与分享