dc-jiang
級(jí)別: 略有小成
精華主題: 0
發(fā)帖數(shù)量: 71 個(gè)
工控威望: 243 點(diǎn)
下載積分: 1209 分
在線時(shí)間: 156(小時(shí))
注冊(cè)時(shí)間: 2008-03-10
最后登錄: 2024-10-11
查看dc-jiang的 主題 / 回貼
樓主  發(fā)表于: 2019-05-23 23:36
(*----------------------------------------------------------------------------*)
IF  NOT EmergencyStop    THEN
    VisionXYAlignmentBusy       := FALSE;
    VisionXYAlignmentComplete := FALSE;
    AxisRun1                   := FALSE;
    AxisRun2                   := FALSE;
    AxisRun3                   := FALSE;
END_IF;

(*----------------------------------------------------------------------------*)
IF     SaveBasePoint THEN
    InspectBasePos[0] := InspectResultPos[0];
    InspectBasePos[1] := InspectResultPos[1];
    InspectBasePos[2] := InspectResultPos[2];
    InspectBasePos[3] := InspectResultPos[3];
END_IF;

(*----------------------------------------------------------------------------*)
IF     VisionXYAlignmentStart AND NOT VisionXYAlignmentBusy    THEN
    VisionXYAlignmentBusy := TRUE;
    VisionXYAlignmentComplete := FALSE;
    VisionXYAlignmentStep := 0;
    RETURN;
END_IF;

(*----------------------------------------------------------------------------*)
IF     VisionXYAlignmentBusy    THEN
    IF     VisionXYAlignmentStep = 0    THEN
        TempFloatValue1 := InspectResultPos[0] - InspectBasePos[0];
        TempFloatValue2 := InspectResultPos[2] - InspectBasePos[2];
        TempFloatValue3 := ((TempFloatValue1 + TempFloatValue2) / 2.0) * 3.7;
        TempRunPos1 := CurrentAxisPos1 - REAL_TO_DINT(TempFloatValue3);
        
        TempFloatValue1 := InspectResultPos[1] - InspectBasePos[1];
        TempFloatValue2 := InspectResultPos[3] - InspectBasePos[3];
        TempFloatValue3 := ((TempFloatValue1 + TempFloatValue2) / 2.0) * 3.7;
        TempIntegerValue3 := ABS(REAL_TO_DINT(TempFloatValue3));
        
        IF TempFloatValue3 >= 0.0    THEN
            TempRunPos2 := CurrentAxisPos2 - TempIntegerValue3;
            TempRunPos3 := CurrentAxisPos3 + TempIntegerValue3;
        ELSE
            TempRunPos2 := CurrentAxisPos2 + TempIntegerValue3;
            TempRunPos3 := CurrentAxisPos3 - TempIntegerValue3;
        END_IF;
        
        AxisRunPos1 := TempRunPos1;
        AxisRun1 := TRUE;        
        AxisRunPos2 := TempRunPos2;
        AxisRun2 := TRUE;
        AxisRunPos3 := TempRunPos3;
        AxisRun3 := TRUE;

        VisionXYAlignmentStep := 1;
        RETURN;
    END_IF;

    IF     VisionXYAlignmentStep = 1    THEN
        IF    CurrentAxisPos1 = AxisRunPos1 AND IsAxisInPos1 AND NOT IsAxisMoving1    AND
            CurrentAxisPos2 = AxisRunPos2 AND IsAxisInPos2 AND NOT IsAxisMoving2    AND
            CurrentAxisPos3 = AxisRunPos3 AND IsAxisInPos3 AND NOT IsAxisMoving3    THEN
            AxisRun1 := FALSE;
            AxisRun2 := FALSE;
            AxisRun3 := FALSE;
        
            VisionXYAlignmentBusy := FALSE;
            VisionXYAlignmentComplete := TRUE;
        END_IF;
        RETURN;
    END_IF;
END_IF;
(*----------------------------------------------------------------------------*)
本帖最近評(píng)分記錄:
  • 下載積分:+3(菜鳥入行) 看不懂。
    baiyangfy
    交流與學(xué)習(xí)
    級(jí)別: 探索解密
    精華主題: 0
    發(fā)帖數(shù)量: 72 個(gè)
    工控威望: 136 點(diǎn)
    下載積分: 937 分
    在線時(shí)間: 44(小時(shí))
    注冊(cè)時(shí)間: 2019-04-19
    最后登錄: 2024-09-26
    查看baiyangfy的 主題 / 回貼
    1樓  發(fā)表于: 2019-05-24 22:26
    大神寫程序從來(lái)不加漢語(yǔ)注釋,直接用標(biāo)簽表達(dá)釋義。大神果然適合膜拜