S7-1200/1500 (ISO over TCP) LOGO 0BA7/0BA8 (ISO over TCP) S7-200 SMART (ISO over TCP) S7-300/400 (MPI) S7-300/400 (PPI) S7-200 (PPI) S7-1200/1500 (PPI) S7-200 (S7 Basic) S7-1200/1500 (S7 Basic) S7-1200/1500 (TIA Portal) S5 (3964R) S5 (3964R over IP) S5 (AS5...
西门子PLC通常使用S7协议(例如S7-1200、S7-1500等系列的PLC)。 在使用hslcommunication库之前,需要确认PLC使用的具体通信协议和相应的参数(如IP地址、机架号、槽号等)。安装并配置hslcommunication库: hslcommunication是一个流行的工业通信库,支持多种PLC品牌和通信协议。 通过NuGet包管理器安装这个库: bash Install-Pa...
usingHslCommunication.Profinet;usingSystem;classProgram{staticvoidMain(string[] args){// 创建一个S7 plc通信对象SiemensS7Net siemensPlc =newSiemensS7Net(SiemensPLCS.S1200,"192.168.0.1");// 连接到PLCOperateResult connectResult = siemensPlc.ConnectServer();if(connectResult.IsSuccess) {// 读取D100地址的...
{ siemensTcpNet = new SiemensS7Net( SiemensPLCS.S1200 ); // 实例化西门子的对象 siemensTcpNet.IpAddress = "192.1681.195"; // 设置IP地址 siemensTcpNet.LogNet = LogNet; //设置统一的日志记录器 siemensTcpNet.ConnectTimeOut = 1000; // 超时时间1秒 // 启动后台读取的线程 threadRead...
SiemensS7Net siemens =newSiemensS7Net( SiemensPLCS.S1200," 192.168.1.110"); // 连接对象 OperateResult connect = siemens.ConnectServer( ); if(!connect.IsSuccess) { Console.WriteLine("connect failed:"+ connect.Message ); return; } // 举例读取M100的值 ...
SiemensS7Net siemens = new SiemensS7Net( SiemensPLCS.S1200, " 192.168.1.110" ); short value = siemens.ReadInt16("M100").Content; // Look at this code, isn't it very succinct. The above operation we have read the data, but is based on a short connection, when the reading of the...
SiemensS7Net siemens = new SiemensS7Net( SiemensPLCS.S1200, " 192.168.1.110" ); short value = siemens.ReadInt16("M100").Content; // Look at this code, isn't it very succinct. The above operation we have read the data, but is based on a short connection, when the reading of the...
SiemensS7Net siemens = new SiemensS7Net( SiemensPLCS.S1200, " 192.168.1.110" ); short value = siemens.ReadInt16("M100").Content; // Look at this code, isn't it very succinct. The above operation we have read the data, but is based on a short connection, when the reading of the...
SiemensS7Net siemens = new SiemensS7Net( SiemensPLCS.S1200, " 192.168.1.110" ); siemens.SetPersistentConnection( ); OperateResult<short> read = await siemens.ReadInt16Async("M100"); if(read.IsSuccess) { // you get the right value short value = read.Content; } else { // failed , but...
static void Main( string[] args ){ SiemensS7Net plc = new SiemensS7Net( SiemensPLCS.S1200, "127.0.0.1" ); // 此处拿了本地虚拟的PLC测试 plc.SetPersistentConnection( ); // 设置了长连接 while (true){ Thread.Sleep( 1000 ); // 每秒读取⼀次 OperateResult<short> read = plc.ReadInt...