/// <summary>
        /// 读取设备的系统参数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pictureBoxRead_Click(object sender, EventArgs e)
        {
            try
            {
                CommPort mCommPort = CommPort.Instance;
                try
                {
                    string str = "ff" + "{0}" + "05" + "05" + "00";
                    mCommPort.SearchDeviceAddress();
                    str = string.Format(str, CommPort.mDeviceAddress.ToString("X2"));
                    byte[] sendData = mCommPort.convertstringtobyte(str);
                    int    sum      = 0;
                    foreach (int i in sendData)
                    {
                        sum += i;
                    }
                    sendData[sendData.Length - 1] = (byte)(sum % 256);
                    mCommPort.Send(sendData);
                }

                catch (Exception er)
                {
                    MessageBox.Show(er.Message);
                }

                tBPES_Dif_max.Text   = mCommPort.PES_Dif_max1;
                tBPVDF_Dif_max.Text  = mCommPort.PVDF_Dif_max1;
                tBPTFE_Dif_max.Text  = mCommPort.PTFE_Dif_max1;
                tBNYLON_Dif_max.Text = mCommPort.NYLON_Dif_max1;
                tBOTHER_Dif_max.Text = mCommPort.OTHER_Dif_max1;
                tBExter_Volm.Text    = mCommPort.Exter_Volm1;
                tBSourceP.Text       = mCommPort.SourceP1;
                tBAddP_extent.Text   = mCommPort.AddP_extent1;
                const Int32 a = 0;
                const Int32 b = 1;
                //打印设置
                switch (Convert.ToInt32(mCommPort.Print_Setup1))
                {
                case a:
                    radioButtonPrint_SetupAuto.Checked   = false;
                    radioButtonPrint_SetupManual.Checked = true;
                    break;

                case b:
                    radioButtonPrint_SetupAuto.Checked   = true;
                    radioButtonPrint_SetupManual.Checked = false;
                    break;

                default: break;
                }

                //结束还是询问

                switch (Convert.ToInt32(mCommPort.Over_ModeSetup1))
                {
                case a:
                    radioButtonOver_ModeSetupM.Checked = false;
                    radioButtonOver_ModeSetupA.Checked = true;
                    break;

                case b:

                    radioButtonOver_ModeSetupM.Checked = true;
                    radioButtonOver_ModeSetupA.Checked = false;
                    break;

                default: break;
                }
                //语言选择,中文还是英文


                switch (Convert.ToInt32(mCommPort.Language_Setup1))
                {
                case a:
                    radioButtonLanguage_SetupC.Checked = false;
                    radioButtonLanguage_SetupE.Checked = true;
                    break;

                case b:
                    radioButtonLanguage_SetupC.Checked = true;
                    radioButtonLanguage_SetupE.Checked = false;

                    break;

                default: break;
                }
                //是否加载缺省值

                switch (Convert.ToInt32(mCommPort.Default_Load1))
                {
                case a:
                    radioButtonDefault_LoadYes.Checked = false;
                    radioButtonDefault_LoadNo.Checked  = true;
                    break;

                case b:
                    radioButtonDefault_LoadYes.Checked = true;
                    radioButtonDefault_LoadNo.Checked  = false;

                    break;

                default: break;
                }
                //是否初始化测试参数

                switch (Convert.ToInt32(mCommPort.InitTestPara1))
                {
                case a:
                    radioButtonInitTestParaYes.Checked = false;
                    radioButtonInitTestParaNo.Checked  = true;

                    break;

                case b:
                    radioButtonInitTestParaYes.Checked = true;
                    radioButtonInitTestParaNo.Checked  = false;

                    break;

                default: break;
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("异常:" + ex.ToString(), "方案可能不存在");
            }
        }
        /// <summary>
        /// 写入系统参数到设备
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pictureBoxWrite_Click(object sender, EventArgs e)
        {
            try
            {
                CommPort mComPort = CommPort.Instance;
                /// <summary>
                /// 单芯10“PES滤芯的最大扩散流--  2;
                /// 例如:数值 300,显示 30.0
                /// </summary>
                /// <param name="sender"></param>
                /// <param name="e"></param>

                string PES_Dif_max = (Convert.ToInt64(tBPES_Dif_max.Text.Replace(".", ""))).ToString("X4");

                /// <summary>
                ///  PVDF_Dif_max   -------   单芯10“尼龙滤芯的最大扩散流--  2
                ///  例如:数值 200,显示 20.0
                /// </summary>
                /// <param name="sender"></param>
                /// <param name="e"></param>
                string PVDF_Dif_max = (Convert.ToInt64(tBPVDF_Dif_max.Text.Replace(".", ""))).ToString("X4");


                /// <summary>
                ///  PTFE_Dif_max ------- 单芯10“聚四氟乙烯滤芯的最大扩散流 --  2;
                ///  例如:数值 160,显示 16.0
                /// </summary>
                /// <param name="sender"></param>
                /// <param name="e"></param>
                string PTFE_Dif_max = (Convert.ToInt64(tBPTFE_Dif_max.Text.Replace(".", ""))).ToString("X4");

                /// <summary>
                /// NYLON_Dif_max  ------- 单芯10“尼龙滤芯的最大扩散流 --  2 ;
                /// 例如:数值 180,显示 18.0
                /// </summary>
                /// <param name="sender"></param>
                /// <param name="e"></param>
                string NYLON_Dif_max = (Convert.ToInt64(tBNYLON_Dif_max.Text.Replace(".", ""))).ToString("X4");

                /// <summary>
                ///OTHER_Dif_max -------  单芯10“其它材质的扩散流--  2 ;
                ///例如:数值 260,显示 26.0
                /// </summary>
                /// <param name="sender"></param>
                /// <param name="e"></param>
                string OTHER_Dif_max = (Convert.ToInt32(tBOTHER_Dif_max.Text.Replace(".", ""))).ToString("X4");

                /// <summary>
                /// Exter_Volm    -----   外部缓冲罐的体积  (0)      ---  4  ;
                /// </summary>
                /// <param name="sender"></param>
                /// <param name="e"></param>
                string Exter_Volm = (Convert.ToInt32(tBExter_Volm.Text.Replace(".", ""))).ToString("X8");

                /// <summary>
                /// SourceP       -----   外部的气源压力     (6000)     --   2     ;
                /// </summary>
                /// <param name="sender"></param>
                /// <param name="e"></param>
                string SourceP = (Convert.ToInt32(tBSourceP.Text.Replace(".", ""))).ToString("X4");

                /// <summary>
                /// AddP_extent   -----   对滤芯的压力增幅   (60)  --   2     ;
                /// </summary>
                /// <param name="sender"></param>
                /// <param name="e"></param>
                string AddP_extent = (Convert.ToInt32(tBAddP_extent.Text.Replace(".", ""))).ToString("X4");

                string Print_Setup    = "00";
                string Over_ModeSetup = "00";
                string Language_Setup = "00";
                string Default_Load   = "00";
                string InitTestPara   = "00";

                //打印设置

                if ((radioButtonPrint_SetupAuto.Checked == false) && (radioButtonPrint_SetupManual.Checked == true))
                {
                    Print_Setup = (0).ToString("X2");
                }
                else if ((radioButtonPrint_SetupAuto.Checked == true) && (radioButtonPrint_SetupManual.Checked == false))
                {
                    Print_Setup = (1).ToString("X2");
                }
                //结束还是询问


                if ((radioButtonOver_ModeSetupM.Checked == false) && (radioButtonOver_ModeSetupA.Checked == true))
                {
                    Over_ModeSetup = (0).ToString("X2");
                }
                else if ((radioButtonOver_ModeSetupM.Checked == true) && (radioButtonOver_ModeSetupA.Checked == false))
                {
                    Over_ModeSetup = (1).ToString("X2");
                }
                //语言选择,中文还是英文

                if ((radioButtonLanguage_SetupC.Checked == false) && (radioButtonLanguage_SetupE.Checked == true))
                {
                    Language_Setup = (0).ToString("X2");
                }
                else if ((radioButtonLanguage_SetupC.Checked == true) && (radioButtonLanguage_SetupE.Checked == false))
                {
                    Language_Setup = (1).ToString("X2");
                }
                //是否加载缺省值

                if ((radioButtonDefault_LoadYes.Checked == false) && (radioButtonDefault_LoadNo.Checked == true))
                {
                    Default_Load = (0).ToString("X2");
                }
                else if ((radioButtonDefault_LoadYes.Checked == true) && (radioButtonDefault_LoadNo.Checked == false))
                {
                    Default_Load = (1).ToString("X2");
                }
                //是否初始化测试参数

                if ((radioButtonInitTestParaYes.Checked == false) && (radioButtonInitTestParaNo.Checked == true))
                {
                    InitTestPara = (0).ToString("X2");
                }
                else if ((radioButtonInitTestParaYes.Checked == true) && (radioButtonInitTestParaNo.Checked == false))
                {
                    InitTestPara = (1).ToString("X2");
                }



                try
                {
                    mComPort.SearchDeviceAddress();
                    string str = "ff" + "{0}" + "1C" + "06" + PES_Dif_max + PVDF_Dif_max + PTFE_Dif_max + NYLON_Dif_max + OTHER_Dif_max + Exter_Volm + SourceP + AddP_extent + Print_Setup + Over_ModeSetup + Language_Setup + Default_Load + InitTestPara + "00";

                    str = string.Format(str, CommPort.mDeviceAddress.ToString("X2"));
                    byte[] sendData = mComPort.convertstringtobyte(str);
                    int    sum      = 0;
                    foreach (int i in sendData)
                    {
                        sum += i;
                    }
                    sendData[sendData.Length - 1] = (byte)(sum % 256);
                    mComPort.Send(sendData);
                }

                catch (Exception er)
                {
                    MessageBox.Show(er.Message);
                }
            }

            catch (Exception er)
            {
                MessageBox.Show(er.Message);
            }
        }