Home > Net >  C # of PLC, PC even if there are any other reasons?
C # of PLC, PC even if there are any other reasons?

Time:01-13

C # development PC for the first time, even not connect PLC, the type of PLC and the IP address there is absolutely nothing wrong, because I use a computer to the PLC before after filling the program, the machine running situation is normal, but when I use c # to error when communicating with PLC,
My c # code several cases cross-checked with others, think that there is no problem, but I can't communication with PLC, c # is a computer what to do in the set? For example, OPC, Simatic Manager, etc?
My code is as follows:

Using S7.Net;
Public=new Plc Plc Plc (CpuType S71200, "192.168.0.9", 0, 0).
Public _click ()
{
InitializeComponent ();
}
Private void Form1_Load (object sender, EventArgs e)
{

}

Private void btn_Connect_Click (object sender, EventArgs e)
{
PLC. The Open ();
If (PLC. IsConnected)
{
MessageBox. Show (" connection success ");
}

The else
{
MessageBox. Show (" connection ");
}
}

CodePudding user response:

Because I later the CPU model and directly to the IP address written into the code, the case statement is useless, but does not affect the connection PLC, so the error is not here
  •  Tags:  
  • C#
  • Related