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