Beispiel #1
0
        private void userButton22_Click_1(object sender, EventArgs e)
        {
            string temp = HslCommunication.BasicFramework.SoftBasic.ByteToHexString(
                siemensTcpNet.ReadFromServerCore(HslCommunication.BasicFramework.SoftBasic.HexStringToBytes(
                                                     "03 00 00 1F 02 F0 80 32 01 00 00 00 01 00 0E 00 00 04 01 12 0A 10 01 00 01 00 00 81 00 00 00")).Content, ' ');


            // M100读取
            //TextBoxAppendStringLine(siemensTcpNet.ReadByteFromPLC("M100").Content.ToString());
            TextBoxAppendStringLine(siemensTcpNet.ReadBoolFromPLC("M100.0").Content.ToString());
            TextBoxAppendStringLine(siemensTcpNet.ReadBoolFromPLC("M100.1").Content.ToString());
            TextBoxAppendStringLine(siemensTcpNet.ReadBoolFromPLC("M100.2").Content.ToString());
            TextBoxAppendStringLine(siemensTcpNet.ReadBoolFromPLC("M100.3").Content.ToString());
            TextBoxAppendStringLine(siemensTcpNet.ReadBoolFromPLC("M100.4").Content.ToString());
            TextBoxAppendStringLine(siemensTcpNet.ReadBoolFromPLC("M100.5").Content.ToString());
            TextBoxAppendStringLine(siemensTcpNet.ReadBoolFromPLC("M100.6").Content.ToString());
            TextBoxAppendStringLine(siemensTcpNet.ReadBoolFromPLC("M100.7").Content.ToString());
        }
Beispiel #2
0
        private void userButton23_Click_1(object sender, EventArgs e)
        {
            byte[] buffer = HslCommunication.BasicFramework.SoftBasic.HexStringToBytes(
                "03 00 00 24 02 F0 80 32 01 00 00 00 01 00 0E 00 05 05 01 12 0A 10 02 00 01 00 00 83 00 03 20 00 04 00 08 3B");
            OperateResult <byte[]> operate = siemensTcpNet.ReadFromServerCore(buffer);

            if (operate.IsSuccess)
            {
                // 显示服务器返回的报文
                TextBoxAppendStringLine(HslCommunication.BasicFramework.SoftBasic.ByteToHexString(operate.Content));
            }
            else
            {
                // 显示网络错误
                MessageBox.Show(operate.ToMessageShowString());
            }
        }
Beispiel #3
0
 private void button26_Click(object sender, EventArgs e)
 {
     try
     {
         OperateResult <byte[]> read = siemensTcpNet.ReadFromServerCore(HslCommunication.BasicFramework.SoftBasic.HexStringToBytes(textBox13.Text));
         if (read.IsSuccess)
         {
             textBox11.Text = "结果:" + HslCommunication.BasicFramework.SoftBasic.ByteToHexString(read.Content);
         }
         else
         {
             MessageBox.Show("读取失败:" + read.ToMessageShowString( ));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("读取失败:" + ex.Message);
     }
 }