1.新建项目并引用TwinCAT动态链接库
2.引用类,并编写倍福控制的相关对象
1 using System; 2 using System.Collections; 3 using System.Collections.Generic; 4 using System.Linq; 5 using System.Text; 6 using TwinCAT.Ads; 7 8 9 namespace Project_V1._001_Data 10 { 11 public class Beckhoff_PLC 12 { 13 14 15 #region 基本对象定义 16 /// <summary> 17 /// 创建Ads对象 18 /// </summary> 19 public static TwinCAT.Ads.TcAdsClient _adsClient = new TcAdsClient(); 20 21 /// <summary> 22 /// 定义连接PLC的AMSNetID 23 /// </summary> 24 public static string string_AmsNetID = "192.168.0.122.1.1"; 25 26 27 /// <summary> 28 ///</