1、安装 TC31-FULL-Setup.3.1.4024.35 倍福软件
2、打开待调试的倍福项目
3、本机调试时如何查找Netid
4、创建上位机项目 引用动态链接库TwinCAT.Ads.dll 参考地址 https://baijiahao.baidu.com/s?id=1669263124598569989&wfr=spider&for=pc
5、上位机代码示例
TcAdsClient _clientBeckhoff = new TcAdsClient(); _clientBeckhoff .Connect(new AmsNetId("192.168.10.230.1.1"), 851); _clientBeckhoff .TryReadState(out state); bool plcok = state.AdsState == AdsState.Run; string varame="GVL_Laser.CO2_In.Start"; int handno = 0; try { handno = _clientBeckhoff .CreateVariableHandle(varame);//根据变量创建句柄 } catch (Exception ex) { string err = string.Format("{0}{1}", line.Name, ex.Message.ToString()); } var outval = (bool)_clientBeckhoff .ReadAny(handno, typeof(bool)); //读取 _clientBeckhoff .WriteAny(handno, true); //写入
标签:handno,string,Ads,bool,TwinCAT,clientBeckhoff From: https://www.cnblogs.com/dongxizhen/p/18041349