zl程序教程

您现在的位置是:首页 >  硬件

当前栏目

倍福--ADS通信读写

通信 -- 读写 倍福 ADS
2023-09-27 14:22:13 时间

1、PLC变量类型对应C#变量
C# 基本数据类型,值类型隐式继承自System.ValueType->System.Object
基本类型占用字节
在这里插入图片描述
在这里插入图片描述

2、读写任意类型变量
2.0 官方例程
TwinCAT 3 -> TE1000 XAE -> Technologies ->ADS -> TwinCAT ADS
在这里插入图片描述

2.1、TcAdsClient类 ReadAny() 方法
//read
bool bTest1 = (bool)tcAdsClient.ReadAny(pHandle_bool1, typeof(Boolean));//read by handle
short nTest1 = (short)tcAdsClient.ReadAny(pHandle_int1, typeof(short));//read by handle
int dintTest1 = (int)tcAdsClient.ReadAny(pHandle_dint1, typeof(int));//read by handle
double dfTest1 = (double)tcAdsClient.ReadAny(pHandle_lreal1, typeof(double));//read by handle
string strTest1 = (string)