private void Stop_Cal_Click(object sender, EventArgs e)
        {
            if (CalWorker.IsBusy)
            {
                CalWorker.CancelAsync();
            }
            Thread.Sleep(5000);

            Contra_Gif.Visible = false;
            Stop_Cal.Enabled   = false;
            Start_Cal.Enabled  = true;
        }
        private void Start_Cal_Click(object sender, EventArgs e)
        {
            tools.send_commnad("CPA0000", 1);
            if (!CalWorker.IsBusy)
            {
                CalWorker.RunWorkerAsync();
            }

            if (CalWorker.IsBusy)
            {
                Contra_Gif.Visible = true;
                Stop_Cal.Enabled   = true;
                Start_Cal.Enabled  = false;
            }
        }
        private void CalWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            string command;



            for (; ;)
            {
                if (CalWorker.CancellationPending)
                {
                    e.Cancel = true;
                    return;
                }


                ///////////


                for (int k = 0; k < 4; k++)
                {
                    R_J10x[k] = 0;
                }
                temperature = 0;


                // for (int p = 0; p < AVG_SAMPLES; p++)
                // {
                //  MessageBox.Show(therm.Measure().ToString());
                //Thread.Sleep(100);
                temperature = therm.Measure();
                // }
                // temperature = temperature / AVG_SAMPLES;
                // MessageBox.Show(temperature.ToString());



                for (int k = 0; k < 4; k++)
                {
                    command = "SPA" + Convert.ToString(k * 4, 2).PadLeft(4, '0');;
                    // MessageBox.Show(command);
                    tools.send_commnad(command, 1);
                    Thread.Sleep(SAMPLE_DELAY);
                    for (int p = 0; p < AVG_SAMPLES; p++)
                    {
                        //  MessageBox.Show(command + "\n" + tools.read_command("RUC01", 1));
                        R_J10x[k] += convert_data_to_R(Convert.ToDouble(tools.read_command("RUC01", 1)), 1.25, 10000);
                        //Thread.Sleep(SAMPLE_DELAY * 10);
                    }
                    R_J10x[k] = R_J10x[k] / AVG_SAMPLES;
                }

                for (int k = 0; k < 4; k++)
                {
                    R_J10x_q[k] = R_J10x[k];
                }
                temperature_q = temperature;

                CalWorker.ReportProgress(0);
                //Thread.Sleep(100);
                //////////
            }
        }