1、连接
lpcom_ReferencesUtlType.ActLogicalStationNumber = IHost.ActLogicalStationNumber;
lpcom_ReferencesUtlType.ActPassword = "";
iReturnCode = lpcom_ReferencesUtlType.Open();
if (iReturnCode == 0)
{
IHost.MxConnect = true;
textBox1.BackColor = Color.Green;
showPLCMessage("PLC連接OK");
But_Conn.Enabled = false; But_Close.Enabled = true;
TimerEG.Elapsed += TimerEG_Elapsed; TimerEG.Enabled = true;
TimerEG0.Elapsed += TimerEG0_Elapsed; TimerEG0.Enabled = true;
}
else
{
IHost.MxConnect = false; textBox1.BackColor = Color.Red; But_Conn.Enabled = true; But_Close.Enabled = false;
}