当前位置:网站首页>倍福使用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
边栏推荐
- request.getSession(), the story
- [21天学习挑战赛——内核笔记](一)——设备树的概述(硬件、目标、效果、文件类型)
- 看图就懂|衡量业务增长健康的销售指标如何选择
- Py's mlxtend: a detailed guide to the introduction, installation, and usage of the mlxtend library
- 张驰课堂:六西格玛培训工具——箱线图
- 堡垒机、堡垒机的原理
- Vscode connect to remote server "Acquiring the lock on the/home / ~ 'problem
- Leetcode周赛304
- PHP Warning: putenv() has been disabled for security reasons in phar
- JS初识高阶函数和函数柯里化
猜你喜欢
随机推荐
typescript 'props' is declared but its value is never read solution
abaqus如何快速导入其他cae文件的assembly?
实验8 VLAN综合实验
postgres 多个变量填充字符串,字串格式化
看图就懂|衡量业务增长健康的销售指标如何选择
返回文件名问题
【21天学习挑战赛】顺序查找
Nodejs installation and global configuration (super detailed)
提交代码流程
Pagoda+FastAdmin 404 Not Found
Project development specification
PMP新考纲通关秘籍,告别抓瞎
aTrust项目的相关操作与分享
振兴农村循环经济 和数链串起农业“生态链”
Dataset: A detailed guide to the download link collection of commonly used datasets in machine learning
In-depth analysis of the initialization of member variables and local variables
C# FileInfo class
张驰课堂:六西格玛培训工具——箱线图
chrome 插件开发指南
[21天学习挑战赛——内核笔记](一)——设备树的概述(硬件、目标、效果、文件类型)