示例#1
0
 private void ProcCalc()
 {
     CalcFullValues();
     Int16[] coefValues;
     if (!Funs485.RdScaleList(cardAddr, out coefValues))
     {
         AppendText(this.txtMessage, "读取系数失败");
         ShowText(this.btnStartCalc, "自动校准");
         return;
     }
     for (int i = 0; i < coefValues.Length; i++)
     {
         if (coefValues[i] < 0 || coefValues[i] == 0x0)
         {
             coefValues[i] = 1024;
         }
     }
     coefValues.CopyTo(CoeffValues, 0);
     InvalidateCtrl(this.gridValueView);
     for (int i = 0; i < 4; i++)
     {
         DoCalcStep(i, CoeffValues);
     }
     if (!Funs485.WriteCoeff(cardAddr, CoeffValues))
     {
         ShowText(this.txtMessage, "系数写入失败");
     }
     WriteFactoryMessage(cardAddr);
     ShowText(this.btnStartCalc, "自动校准");
 }
示例#2
0
        private void ProcCalc()
        {
            Int16[] coefValues;
            if (!Funs485.RdScaleList(cardAddr, out coefValues))
            {
                AppendText(this.txtMessage, "读取系数失败");
                ShowText(this.btnStartCalc, "自动校准");
                return;
            }
            for (int i = 0; i < coefValues.Length / 2; i++)
            {
                if (coefValues[i * 2 + 1] < 0 || coefValues[i * 2 + 1] == 0x0)
                {
                    coefValues[i] = 1024;
                }
            }
            AppendText(this.txtMessage, String.Format("读取板系数完成\r\n"));
            coefValues.CopyTo(CoeffValues, 0);
            InvalidateCtrl(this.gridValueView);

            DoCalcStep(CoeffValues);

            if (!Funs485.WriteCoeff(cardAddr, CoeffValues))
            {
                ShowText(this.txtMessage, "系数写入失败");
            }
            WriteFactoryMessage(cardAddr);
            AppendText(this.txtMessage, String.Format("校准完成\r\n"));
            ShowText(this.btnStartCalc, "自动校准");
        }
示例#3
0
 private void buttonExt5_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < 4; i++)
     {
         CoeffValues[i * 2]     = 0;
         CoeffValues[i * 2 + 1] = 4095;
     }
     if (!Funs485.WriteCoeff(cardAddr, CoeffValues))
     {
         ShowText(this.txtMessage, "系数写入失败");
     }
 }