private void button2_Click(object sender, EventArgs e)
 {
     // 断开连接
     siemensFWNet.ConnectClose( );
     button2.Enabled = false;
     button1.Enabled = true;
     panel2.Enabled  = false;
 }
        public void ClassTest2( )
        {
            #region Usage2

            // 实例化对象,指定PLC的ip地址和端口号
            SiemensFetchWriteNet siemens = new SiemensFetchWriteNet(" 192.168.1.110", 2000);

            // 连接对象
            OperateResult connect = siemens.ConnectServer( );
            if (!connect.IsSuccess)
            {
                Console.WriteLine("connect failed:" + connect.Message);
                return;
            }

            // 举例读取M100的值
            short D100 = siemens.ReadInt16("M100").Content;

            siemens.ConnectClose( );

            #endregion
        }
Exemple #3
0
 public override void DeviceDiscnn()
 {
     siemensFWNet.ConnectClose();
 }