WangChao

MrPLC Member
  • Content count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About WangChao

  • Rank
    Hi, I am New!

Profile Information

  • Country China
  1. OK,i installed the iwreshark,and got the folowing info: the request from my c# code: and the response from the plc,same result as i put in the 1st post:
  2. thank you for u reply,the 0x0c and 0x00 means the request data length ,i forgot to translate the comments"开始的长度".
  3. [solved] i set the ERROR network No. which leads to the fault. thank you for your replies. Hello ,im trying to communicate with my mitsunshi plc(with qj71e71 module) using MC Protocol's 3E frame. first i used the ASCII code way ,and succeeded. then to speed up the communication, i tryed the binary code way,Unfortunately it just renturned the "abnormal completion" response as the manual says. here is my main C# code: using System.Globalization; using System.Windows.Forms; using System; using System.Net; using System.Net.Sockets; using System.Data; using System.Collections.Generic; using System.Text; private void button1_Click(object sender, EventArgs e) { Socket mysock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPAddress ip = IPAddress.Parse("192.168.0.2"); IPEndPoint ipend = new IPEndPoint(ip, 7100); try { mysock.Connect(ipend); MessageBox.Show("连接成功!"); } catch { MessageBox.Show("连接失败!"); return; } byte[] SData=new byte[] { 0x50,0x00,//3E frame //[b] 0x02,//网络号 network No.[/b] 0x00//0x00 is the true network No. 0xff,//pc No. 0xff,//io No 0x03, 0x08,//站号 Station No 0x0c,//[i]timer开始的长度[/i] length of the request data which is started from timer byte to end 0x00, 0x0a,//timer 0x00, 0x01,//主命令Main Command 0x04, 0x01,//子命令sub command 0x00, 0x01,//the head device No. is 1, //read the M1's value 0x00, 0x00, 0x90,//'M' device 0x01,//1 point 0x00 }; byte[] RData = new byte[256]; try { mysock.Send(SData); mysock.Receive(RData); } catch { MessageBox.Show("读取错误!"); return; } mysock.Close(); } what can i do to solve this problem? the response from the plc is showed blow: