示例#1
0
 private void buttonInit_Click(object sender, EventArgs e)
 {
     try
     {
         agilentDevice.InitializeU2722A(Config.U2722_ADDRESS);
         string[] ports = bridge.GetPorts();
         if (ports.Length < 1)
         {
             MessageBox.Show("No USB_I2C bridge found", "Error:", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             int status = bridge.OpenPort(ports[0].ToString());
             if (status != 0)
             {
                 MessageBox.Show("Error in open port:", "Error:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 Log.error("Error in open port: " + bridge.LastError);
                 bridge.PowerOff();
                 bridge.ClosePort();
                 //bridgeReady = false;
             }
             else
             {
                 instrument_initiated = true;
                 //buttonInit.BackColor = Color.Green;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error:", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#2
0
        //****************************************//
        //          Hardware Initialize           //
        //****************************************//

        /// <summary>
        /// Hardware initialize, init Agilent device and open comm for MPQ
        /// </summary>
        private void HardwareInitialize()
        {
            try
            {
                //Read Hardware Settings
                HardwareConfig.Read();

                //Agilent
                agilentDevice.InitializeU2651A(HardwareConfig.Option.U2651AtxtAddr);
                agilentDevice.InitializeU2722A(HardwareConfig.Option.U2722AtxtAddr);
                agilentDevice.InitializeU2751A_WELLA(HardwareConfig.Option.U2751AtxtAddr);
                //agilentDevice.InitializeU2751A_WELLB(HardwareConfig.Option.U2751AWellBtxtAddr);

                //MPQ
                mpqDevice.PortInit(HardwareConfig.Port.MPQPort);

                toolStripStatusLabelHardware.BackColor = Color.Green;
                testHardwareReady = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                toolStripStatusLabelHardware.BackColor = Color.Red;
                testHardwareReady = false;
                Log.error(ex.Message);
            }
        }
示例#3
0
文件: Form1.cs 项目: fanmuzhi/Cypress
 private void buttonConnect_Click(object sender, EventArgs e)
 {
     try
     {
         agilentDevice.InitializeU2722A(textBoxAddress.Text);
         agilentDevice.SetChannelVoltage(Convert.ToDouble(textBoxVoltage.Text), 1);
         buttonConnect.BackColor = Color.Green;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }