First bigger step to automation
- Aligned X and Y NC Axis with aligner camera coordination system - Added robot plc jobs and feedback - Began Meca500 robot interface - Changed hotplate control to slow PWM - PackML statemachine now starts in aborted state - Fixed StateML start method
This commit is contained in:
87
PLC/01_Stationen/Aligner/FB_Aligner.TcPOU
Normal file
87
PLC/01_Stationen/Aligner/FB_Aligner.TcPOU
Normal file
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<POU Name="FB_Aligner" Id="{5be6cab7-2294-48e5-869c-33773329143e}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[FUNCTION_BLOCK FB_Aligner EXTENDS FB_PackMLGeneric
|
||||
VAR_INPUT
|
||||
xEnableVacuum : BOOL;
|
||||
xAlign : BOOL;
|
||||
|
||||
xConfirmAlarms : BOOL;
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
xVacuumEnabled : BOOL;
|
||||
END_VAR
|
||||
VAR
|
||||
_fbXAxis : FB_AxisPTP;
|
||||
_fbYAxis : FB_AxisPTP;
|
||||
|
||||
_xEnableVacuum AT %Q* : BOOL := FALSE;
|
||||
_xDisableVacuum AT %Q* : BOOL := TRUE;
|
||||
_xVacuumOk AT %I* : BOOL;
|
||||
|
||||
_udiXOffset AT %I* : UDINT;
|
||||
_udiYOffset AT %I* : UDINT;
|
||||
|
||||
_rXPosToGo : REAL;
|
||||
_rYPosToGo : REAL;
|
||||
|
||||
_iState : INT := 0;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[_fbXAxis(
|
||||
xEnable:= TRUE,
|
||||
xInvertCalibrationCam:= FALSE,
|
||||
xEnablePositive:= TRUE,
|
||||
xEnableNegative:= TRUE,
|
||||
rOverride:= 100.0,
|
||||
lrVelocity:= 2.5,
|
||||
lrAcceleration:= 0,
|
||||
lrDecelleration:= 0,
|
||||
lrJerk:= 0,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
xEnabled=> ,
|
||||
xHomed=> ,
|
||||
lrActPosition=> ,
|
||||
xIsStopped=> ,
|
||||
xBusy=> ,
|
||||
xError=> );
|
||||
|
||||
_fbYAxis(
|
||||
xEnable:= TRUE,
|
||||
xInvertCalibrationCam:= FALSE,
|
||||
xEnablePositive:= TRUE,
|
||||
xEnableNegative:= TRUE,
|
||||
rOverride:= 100.0,
|
||||
lrVelocity:= 2.5,
|
||||
lrAcceleration:= 0,
|
||||
lrDecelleration:= 0,
|
||||
lrJerk:= 0,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
xEnabled=> ,
|
||||
xHomed=> ,
|
||||
lrActPosition=> ,
|
||||
xIsStopped=> ,
|
||||
xBusy=> ,
|
||||
xError=> );
|
||||
|
||||
// Drei mal ausführen damit die Position genau ist
|
||||
IF xAlign THEN
|
||||
xAlign := FALSE;
|
||||
|
||||
_rXPosToGo := UDINT_TO_REAL(_udiXOffset) * -0.001;
|
||||
_rYPosToGo := ((UDINT_TO_REAL(_udiYOffset) * 0.001) - 37.5) * -1;
|
||||
|
||||
IF (ABS(_rXPosToGo) < 10.0) AND (ABS(_rYPosToGo) < 10.0) AND (NOT _fbXAxis.xError) AND (NOT _fbYAxis.xError) THEN
|
||||
_fbXAxis.M_MoveRel(lrRelDist := _rXPosToGo);
|
||||
_fbYAxis.M_MoveRel(lrRelDist := _rYPosToGo);
|
||||
END_IF
|
||||
END_IF
|
||||
|
||||
// Handle enable disable vacuum command
|
||||
_xEnableVacuum := xEnableVacuum;
|
||||
_xDisableVacuum := (NOT xEnableVacuum);
|
||||
xVacuumEnabled := _xVacuumOk;]]></ST>
|
||||
</Implementation>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
Reference in New Issue
Block a user