dc-jiang
級別: 略有小成
精華主題: 0
發(fā)帖數(shù)量: 71 個
工控威望: 243 點
下載積分: 1209 分
在線時間: 156(小時)
注冊時間: 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;
(*----------------------------------------------------------------------------*)
本帖最近評分記錄:
  • 下載積分:+3(菜鳥入行) 看不懂。
    mall9002
    級別: 略有小成
    精華主題: 0
    發(fā)帖數(shù)量: 137 個
    工控威望: 248 點
    下載積分: 921 分
    在線時間: 182(小時)
    注冊時間: 2017-11-30
    最后登錄: 2024-10-28
    查看mall9002的 主題 / 回貼
    1樓  發(fā)表于: 2019-05-24 10:56