//退出PMAC private void ExitPmac_Click(object sender, EventArgs e) { if (openPmacSuccess) { PMAC.Close(pmacNumber); } openPmacSuccess = false; PmacStatus.Text = "PMAC未连接"; communicatePmac.Enabled = true; ExitPmac.Enabled = false; }
//关闭PMAC private void DisconnectToPMAC_Click(object sender, EventArgs e) { if (openPmacSuccess) { tmrMotorStatus.Enabled = false; PMAC.Close(pmacNumber); DisconnectToPMAC.Enabled = false; gBoxSetAndShow.Enabled = false; gBoxWork.Enabled = false; CommunicateToPMAC.Enabled = true; } }
public bool ConectToPMAC() { int dev = m_nDevice; bool bSuccess = false; string str; string type; Pmac.SelectDevice(0, out dev, out bSuccess); if (bSuccess) { m_bDeviceOpen = true; if (m_bDeviceOpen) { Pmac.Close(m_nDevice); } m_nDevice = dev; m_bDPRAvailable = false; m_nDPRBase = 0; m_nDPRSize = 0; Pmac.Open(m_nDevice, out m_bDeviceOpen); if (m_bDeviceOpen) { m_bDPRAvailable = Pmac.get_DPRAvailable(m_nDevice); m_nDPRSize = Pmac.get_DPRSize(m_nDevice); Pmac.DPRAddressRange(m_nDevice, false, false, out m_nDPRBase); m_bTurbo = Pmac.get_IsTurbo(m_nDevice); // m_bFGEnabled = Pmac.get_DPRMotorRptEnabled(m_nDevice); // Setup for this device if (m_bTurbo) { type = "Turbo"; } else { type = "NO Turbo"; } str = string.Format("Device number {0:D} opened successfully." + type, m_nDevice); } else { // Disable all required str = string.Format("Device number {0:D} failed to open.", m_nDevice); } m_PMAC_msg = str; } return(bSuccess); }
//断开PMAC private void ExitPmac_Click(object sender, EventArgs e) { if (openPmacSuccess) { PMAC.Close(pmacNumber); } labPmacStatus.Text = "PMAC未连接"; ExitPmac.Enabled = false; groupBox1.Enabled = false; groupBox2.Enabled = false; groupBox3.Enabled = false; groupBox4.Enabled = false; btnStart.Enabled = false; btnRelease.Enabled = false; btnStop.Enabled = false; comunicateTSMI.Enabled = true; }