⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainfrm.pas

📁 可测试Panel Gamma曲线
💻 PAS
📖 第 1 页 / 共 3 页
字号:
     end;
end;
//------------------------------------------------------------------------------
procedure TForm1.SendStringToCom2(const str: string);
begin
  if Comm2.WriteCommData(Pchar(str),Length(str)) then
  begin
    FTXNum:=FTXNum+Length(str);
  end;
end;
//------------------------------------------------------------------------------
procedure TForm1.BeginMesClick(Sender: TObject);
begin
     if not (Ca210On and Com2On) then
     begin
        ShowMessage('Pls open the Ca210 or Com2 first');
        exit;
     end;
     if (SerialNum.Text = '') then
     begin
         ShowMessage('Pls input the serial number!');
         exit;
     end;

     ClearData;
     bStop := false;
     bError := false;
     ShowStatus(0);
     SSx.Clear;
     SSy.Clear;
     SSLv.Clear;
     Memo1.Clear;

     if  MeasGamma and (not bError) and (not bStop) then
     begin
        ShowStatus(2);
     end
   else
     begin
        ShowStatus(1);
     end;
     WriteToTxt;
     SerialNum.Clear;
     ClearGammaData.Enabled := true;
end;
//------------------------------------------------------------------------------
procedure TForm1.MinMaxShow;
begin
    GammaTable.Cells[1,11] := FloatToStr(Lv);
    GammaTable.Cells[1,10] :=  FloatToStr(CompGamma(Lv,1.9,90));
    GammaTable.Cells[1,9] :=  FloatToStr(CompGamma(Lv,1.9,80));
    GammaTable.Cells[1,8] :=  FloatToStr(CompGamma(Lv,1.9,70));
    GammaTable.Cells[1,7] :=  FloatToStr(CompGamma(Lv,1.9,60));
    GammaTable.Cells[1,6] :=  FloatToStr(CompGamma(Lv,1.9,50));
    GammaTable.Cells[1,5] :=  FloatToStr(CompGamma(Lv,1.9,40));
    GammaTable.Cells[1,4] :=  FloatToStr(CompGamma(Lv,1.9,30));
    GammaTable.Cells[1,3] :=  FloatToStr(CompGamma(Lv,1.9,20));
    GammaTable.Cells[1,2] :=  FloatToStr(CompGamma(Lv,1.9,10));

    GammaTable.Cells[3,11] := FloatToStr(Lv);
    GammaTable.Cells[3,10] :=  FloatToStr(CompGamma(Lv,3.0,90));
    GammaTable.Cells[3,9] :=  FloatToStr(CompGamma(Lv,3.0,80));
    GammaTable.Cells[3,8] :=  FloatToStr(CompGamma(Lv,3.0,70));
    GammaTable.Cells[3,7] :=  FloatToStr(CompGamma(Lv,3.0,60));
    GammaTable.Cells[3,6] :=  FloatToStr(CompGamma(Lv,3.0,50));
    GammaTable.Cells[3,5] :=  FloatToStr(CompGamma(Lv,3.0,40));
    GammaTable.Cells[3,4] :=  FloatToStr(CompGamma(Lv,3.0,30));
    GammaTable.Cells[3,3] :=  FloatToStr(CompGamma(Lv,3.0,20));
    GammaTable.Cells[3,2] :=  FloatToStr(CompGamma(Lv,3.0,10));

    GammaTable.Cells[4,11] := FloatToStr(Lv);
end;
//------------------------------------------------------------------------------

procedure TForm1.FormDestroy(Sender: TObject);
begin
    Comm2.StopComm;
    if Ca210On then
       DestroyConnect;
end;
//------------------------------------------------------------------------------

procedure TForm1.StopMesClick(Sender: TObject);
begin
    bStop := true;
end;
//------------------------------------------------------------------------------
function TForm1.MeasIRE:real;
//var
//  i : Integer;
begin
     //i:=0;
     Measure_Ca210;
     {while Lv < 0 do
     begin
           if Lv < 0 then
           begin
              ShowInf('Source Delay...');
              Delay(3000);
              Measure_Ca210;
           end;
           Inc(i);
           if i>5 then
           begin
               ShowMessage('Pls check the source cable and signal');
               bStop := true;
           end;
      end;
      Measure_Ca210;
      Delay(200);    }
      result := Lv;
end;
//------------------------------------------------------------------------------
procedure TForm1.ClearData;
begin
    GammaTable.Cells[1,11] := '';
    GammaTable.Cells[1,10] := '';
    GammaTable.Cells[1,9] :=  '';
    GammaTable.Cells[1,8] :=  '';
    GammaTable.Cells[1,7] :=  '';
    GammaTable.Cells[1,6] :=  '';
    GammaTable.Cells[1,5] :=  '';
    GammaTable.Cells[1,4] :=  '';
    GammaTable.Cells[1,3] :=  '';
    GammaTable.Cells[1,2] :=  '';
    GammaTable.Cells[1,1] :=  '';

    GammaTable.Cells[2,11] := '';
    GammaTable.Cells[2,10] := '';
    GammaTable.Cells[2,9] :=  '';
    GammaTable.Cells[2,8] :=  '';
    GammaTable.Cells[2,7] :=  '';
    GammaTable.Cells[2,6] :=  '';
    GammaTable.Cells[2,5] :=  '';
    GammaTable.Cells[2,4] :=  '';
    GammaTable.Cells[2,3] :=  '';
    GammaTable.Cells[2,2] :=  '';
    GammaTable.Cells[2,1] :=  '';

    GammaTable.Cells[3,11] := '';
    GammaTable.Cells[3,10] := '';
    GammaTable.Cells[3,9] :=  '';
    GammaTable.Cells[3,8] :=  '';
    GammaTable.Cells[3,7] :=  '';
    GammaTable.Cells[3,6] :=  '';
    GammaTable.Cells[3,5] :=  '';
    GammaTable.Cells[3,4] :=  '';
    GammaTable.Cells[3,3] :=  '';
    GammaTable.Cells[3,2] :=  '';
    GammaTable.Cells[3,1] :=  '';

    GammaTable.Cells[4,11] := '';
    GammaTable.Cells[4,10] := '';
    GammaTable.Cells[4,9] :=  '';
    GammaTable.Cells[4,8] :=  '';
    GammaTable.Cells[4,7] :=  '';
    GammaTable.Cells[4,6] :=  '';
    GammaTable.Cells[4,5] :=  '';
    GammaTable.Cells[4,4] :=  '';
    GammaTable.Cells[4,3] :=  '';
    GammaTable.Cells[4,2] :=  '';
    GammaTable.Cells[4,1] :=  '';
end;
//------------------------------------------------------------------------------
function TForm1.MeasGamma : Boolean;
begin
     if SelAV.Checked then
     begin
        SendToPGPort('RUN TIM '+IntToStr(AVTiming)+';');
        Delay(TimingDelay);
     end
    else if SelCS.Checked then
     begin
        SendToPGPort('RUN TIM '+IntToStr(CSTiming)+';');
        Delay(TimingDelay);
     end
    else if SelCP.Checked then
     begin
        SendToPGPort('RUN TIM '+IntToStr(CPTiming)+';');
        Delay(TimingDelay);
     end
    else if SelPC.Checked then
     begin
        SendToPGPort('RUN TIM '+IntToStr(PCTiming)+';');
        Delay(TimingDelay);
     end
    else if SelHDMI.Checked then
     begin
        SendToPGPort('RUN TIM '+IntToStr(HDMITiming)+';');
        Delay(TimingDelay);
     end;

     if IRE100Enable then
     begin
     SendToPGPort('RUN PAT '+IntToStr(IREP100)+';');
     Delay(PatternDelay);
     GammaTable.Cells[2,11] :=  FloatToStr(MeasIRE);
     MinMaxShow;
     Colorx[11] := Sx;
     Colory[11] := Sy;
     if Lv < IRE100Lv then
     begin
        bError := true;
        Status[11] := 'FAIL';
     end
    else
     begin
        //bError := false;
        Status[11] := 'PASS';
     end;
     end;
     if IRE90Enable  then
     begin
     SendToPGPort('RUN PAT '+IntToStr(IREP90)+';');
     Delay(PatternDelay);
     GammaTable.Cells[2,10] :=  FloatToStr(MeasIRE);
     Colorx[10] := Sx;
     Colory[10] := Sy;
     if (StrToFloat(GammaTable.Cells[1,10]) < StrToFloat(GammaTable.Cells[2,10])) and (StrToFloat(GammaTable.Cells[2,10]) > StrToFloat(GammaTable.Cells[3,10])) then
     begin
        bError := true;
        Status[10] := 'FAIL';
     end
    else
     begin
        //bError := false;
        Status[10] := 'PASS';
     end;
     if bStop then
     begin
        result := false;
        exit;
     end;
     end;

     if IRE80Enable then
     begin
     SendToPGPort('RUN PAT '+IntToStr(IREP80)+';');
     Delay(PatternDelay);
     GammaTable.Cells[2,9] :=  FloatToStr(MeasIRE);
     Colorx[9] := Sx;
     Colory[9] := Sy;
     if (StrToFloat(GammaTable.Cells[1,9]) < StrToFloat(GammaTable.Cells[2,9])) and (StrToFloat(GammaTable.Cells[2,9]) > StrToFloat(GammaTable.Cells[3,9])) then
     begin
        bError := true;
        Status[9] := 'FAIL';
     end
    else
     begin
        //bError := false;
        Status[9] := 'PASS';
     end;
     if bStop then
     begin
        result := false;
        exit;
     end;
     end;

     if IRE70Enable then
     begin
     SendToPGPort('RUN PAT '+IntToStr(IREP70)+';');
     Delay(PatternDelay);
     GammaTable.Cells[2,8] :=  FloatToStr(MeasIRE);
     Colorx[8] := Sx;
     Colory[8] := Sy;
     if (StrToFloat(GammaTable.Cells[1,8]) < StrToFloat(GammaTable.Cells[2,8])) and (StrToFloat(GammaTable.Cells[2,8]) > StrToFloat(GammaTable.Cells[3,8])) then
     begin
        bError := true;
        Status[8] := 'FAIL';
     end
    else
     begin
        //bError := false;
        Status[8] := 'PASS';
     end;
     if bStop then
     begin
        result := false;
        exit;
     end;
     end;

     if IRE60Enable then
     begin
     SendToPGPort('RUN PAT '+IntToStr(IREP60)+';');
     Delay(PatternDelay);
     GammaTable.Cells[2,7] :=  FloatToStr(MeasIRE);
     Colorx[7] := Sx;
     Colory[7] := Sy;
     if (StrToFloat(GammaTable.Cells[1,7]) < StrToFloat(GammaTable.Cells[2,7])) and (StrToFloat(GammaTable.Cells[2,7]) > StrToFloat(GammaTable.Cells[3,7])) then
     begin
        bError := true;
        Status[7] := 'FAIL';
     end
    else
     begin
        //bError := false;
        Status[7] := 'PASS';
     end;
     if bStop then
     begin
        result := false;
        exit;
     end;
     end;

     if IRE50Enable then
     begin
     SendToPGPort('RUN PAT '+IntToStr(IREP50)+';');
     Delay(PatternDelay);
     GammaTable.Cells[2,6] :=  FloatToStr(MeasIRE);
     Colorx[6] := Sx;
     Colory[6] := Sy;
     if (StrToFloat(GammaTable.Cells[1,6]) < StrToFloat(GammaTable.Cells[2,6])) and (StrToFloat(GammaTable.Cells[2,6]) > StrToFloat(GammaTable.Cells[3,6])) then
     begin
        bError := true;
        Status[6] := 'FAIL';
     end
    else
     begin
        //bError := false;
        Status[6] := 'PASS';
     end;
     if bStop then
     begin
        result := false;
        exit;
     end;
     end;

     if IRE40Enable then
     begin
     SendToPGPort('RUN PAT '+IntToStr(IREP40)+';');
     Delay(PatternDelay);
     GammaTable.Cells[2,5] :=  FloatToStr(MeasIRE);
     Colorx[5] := Sx;
     Colory[5] := Sy;
     if (StrToFloat(GammaTable.Cells[1,5]) < StrToFloat(GammaTable.Cells[2,5])) and (StrToFloat(GammaTable.Cells[2,5]) > StrToFloat(GammaTable.Cells[3,5])) then
     begin
        bError := true;
        Status[5] := 'FAIL';
     end
    else
     begin
        //bError := false;
        Status[5] := 'PASS';
     end;
     if bStop then
     begin
        result := false;
        exit;
     end;
     end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -