Initial
This commit is contained in:
444
PLC/6 Aligner/POUs/ALIGNER_MAIN_FB.TcPOU
Normal file
444
PLC/6 Aligner/POUs/ALIGNER_MAIN_FB.TcPOU
Normal file
@@ -0,0 +1,444 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4026.13">
|
||||
<POU Name="ALIGNER_MAIN_FB" Id="{776bb155-78b6-4cd1-a38b-c250c1e10738}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[FUNCTION_BLOCK ALIGNER_MAIN_FB EXTENDS Station_GENERAL_MAIN_FB IMPLEMENTS I_STATION_CMD_CALL
|
||||
VAR_INPUT
|
||||
IO : ALIGNER_IO_FB;
|
||||
|
||||
bCalibration : BOOL;
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
Center : sPoint;
|
||||
Diameter : LREAL;
|
||||
Roundness : LREAL;
|
||||
END_VAR
|
||||
VAR
|
||||
TMX_5000 : TMX_5000_FB;
|
||||
|
||||
|
||||
XAxis : AXIS_FB;
|
||||
YAxis : AXIS_FB;
|
||||
|
||||
Config : sAlignerConfig;
|
||||
ConfigOld : sAlignerConfig;
|
||||
|
||||
XAxis_DefaultPosition : LREAL;
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[]]></ST>
|
||||
</Implementation>
|
||||
<Method Name="CloseInOut" Id="{a0336e32-2f81-4f51-b564-9eda8a3acf8b}">
|
||||
<Declaration><![CDATA[METHOD CloseInOut : BOOL
|
||||
VAR_INST
|
||||
GripperSize : INT;
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[CASE _Step OF
|
||||
0:
|
||||
GripperSize := ROBOT_MAIN.GetGripperSize(iStationStatus.WaferInfo[0].Size);
|
||||
CASE iCMD OF
|
||||
CloseInCMD:
|
||||
_Step := 10;
|
||||
CloseOutCMD:
|
||||
_Step := 50;
|
||||
END_CASE
|
||||
10:
|
||||
Center.X := 0;
|
||||
Center.Y := 0;
|
||||
|
||||
Diameter := 0;
|
||||
Roundness := 0;
|
||||
|
||||
|
||||
IF TMX_5000.ProgramChange(GripperSize) THEN
|
||||
_Step := 0;
|
||||
CloseInOut := TRUE;
|
||||
END_IF
|
||||
50:
|
||||
XAxis.rInTargetPosition := Config.RobotHandlingPosition[GripperSize].X;
|
||||
XAxis.rInTargetVelocity := Config.X_DefaultVelocity;
|
||||
|
||||
YAxis.rInTargetPosition := Config.RobotHandlingPosition[GripperSize].Y;
|
||||
YAxis.rInTargetVelocity := Config.Y_DefaultVelocity;
|
||||
|
||||
_Step := 60;
|
||||
60:
|
||||
IF XAxis.MoveAbsolute() AND YAxis.MoveAbsolute() THEN
|
||||
_Step := 0;
|
||||
CloseInOut := TRUE;
|
||||
END_IF
|
||||
END_CASE
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="FB_Init" Id="{0eee1379-e597-4345-b84b-dc11d41915ec}">
|
||||
<Declaration><![CDATA[//FB_Init is always available implicitly and it is used primarily for initialization.
|
||||
//The return value is not evaluated. For a specific influence, you can also declare the
|
||||
//methods explicitly and provide additional code there with the standard initialization
|
||||
//code. You can evaluate the return value.
|
||||
METHOD FB_Init: BOOL
|
||||
VAR_INPUT
|
||||
bInitRetains: BOOL; // TRUE: the retain variables are initialized (reset warm / reset cold)
|
||||
bInCopyCode: BOOL; // TRUE: the instance will be copied to the copy code afterward (online change)
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[_DataLogger := TRUE;
|
||||
_VisuName := 'ALIGNER';
|
||||
_SchedulerManagement := TRUE;
|
||||
_ManualSizeSelectionAvailable := TRUE;]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="INIT" Id="{6a26cf46-6760-4e2a-968a-62bc5a2d5c0d}">
|
||||
<Declaration><![CDATA[METHOD INIT : BOOL
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[CASE _Step OF
|
||||
0:
|
||||
IF TMX_5000.RunMode(TRUE) THEN
|
||||
XAxis.bOutInitDone := FALSE;
|
||||
YAxis.bOutInitDone := FALSE;
|
||||
_Step := 10;
|
||||
END_IF
|
||||
10:
|
||||
IO.ChuckVacuum.Up(TRUE);
|
||||
IF NOT XAxis.bOutInitDone THEN
|
||||
XAxis.Init();
|
||||
END_IF
|
||||
|
||||
IF NOT YAxis.bOutInitDone THEN
|
||||
YAxis.Init();
|
||||
END_IF
|
||||
|
||||
IF XAxis.bOutInitDone AND YAxis.bOutInitDone THEN
|
||||
_Step := 20;
|
||||
END_IF
|
||||
20:
|
||||
XAxis.rInTargetPosition := 0;
|
||||
XAxis.rInTargetVelocity := Config.X_DefaultVelocity;
|
||||
|
||||
YAxis.rInTargetPosition := 0;
|
||||
YAxis.rInTargetVelocity := Config.Y_DefaultVelocity;
|
||||
|
||||
IF XAxis.MoveAbsolute() AND YAxis.MoveAbsolute() THEN
|
||||
_Step := 30;
|
||||
END_IF
|
||||
30:
|
||||
IF IO.ChuckVacuum.bInUp THEN
|
||||
iStationStatus.WaferInfo[0].Number := 100;
|
||||
ELSE
|
||||
IO.ChuckVacuum.Down(TRUE);
|
||||
END_IF
|
||||
_Step := 0;
|
||||
INIT := TRUE;
|
||||
END_CASE]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="Initialization" Id="{25efd6e4-2ecd-4902-81d2-339bdb708353}">
|
||||
<Declaration><![CDATA[METHOD Initialization : BOOL
|
||||
VAR_INPUT
|
||||
iStation : INT;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[InitializationExt(iStation);
|
||||
|
||||
iStationStatus.NoScan := TRUE;
|
||||
iStationStatus.NoRecipe := TRUE;
|
||||
|
||||
IO.Initialization(iStation);
|
||||
|
||||
iStationStatus.StationName := 'Aligner';
|
||||
RecipeStationName[iStation] := 'Aligner';
|
||||
iStationStatus.ErrorList := 'ALIGNER_ErrorNr';
|
||||
|
||||
ConfigManagement.Initialization(ADR(Config), ADR(ConfigOld), SIZEOF(Config), 'sAlignerConfig', 'Aligner');
|
||||
ConfigPlausibility REF= Config.ConfigPlausibility;
|
||||
|
||||
TMX_5000.Initialization(iStation);
|
||||
|
||||
|
||||
{region "X Axis"}
|
||||
XAxis.Config.sInName := 'X';
|
||||
XAxis.Config.DeviceID := 1;
|
||||
XAxis.Config.sInPositionUnit := 'mm';
|
||||
XAxis.Config.sInVelocityUnit := 'mm/s';
|
||||
XAxis.Config.sInAccelerationUnit := 'mm/s²';
|
||||
XAxis.Config.rInMinPosition := -10;
|
||||
XAxis.Config.rInMaxPosition := 10;
|
||||
XAxis.Config.rInMaxVelocity := 10;
|
||||
XAxis.Config.rInMinVelocity := 0.1;
|
||||
XAxis.Config.rInMaxAcceleration := 50;
|
||||
XAxis.Config.rInMinAcceleration := 0.1;
|
||||
XAxis.Config.bInNoEncoder := TRUE;
|
||||
XAxis.Config.bInRelativeEncoder := TRUE;
|
||||
XAxis.Config.bInService := TRUE;
|
||||
XAxis.Config.rInOffset REF= Config.X_Offset;
|
||||
XAxis.Config.rInDefaultPosition REF= XAxis_DefaultPosition;
|
||||
XAxis.Config.rInDefaultVelocity REF= Config.X_DefaultVelocity;
|
||||
XAxis.Initialization(iStation);
|
||||
|
||||
XAxis.bInEnablePositive := TRUE;
|
||||
XAxis.bInEnableNegative := TRUE;
|
||||
{endregion}
|
||||
|
||||
{region "Y Axis"}
|
||||
YAxis.Config.sInName := 'Y';
|
||||
YAxis.Config.DeviceID := 2;
|
||||
YAxis.Config.sInPositionUnit := 'mm';
|
||||
YAxis.Config.sInVelocityUnit := 'mm/s';
|
||||
YAxis.Config.sInAccelerationUnit := 'mm/s²';
|
||||
YAxis.Config.rInMinPosition := -10;
|
||||
YAxis.Config.rInMaxPosition := 10;
|
||||
YAxis.Config.rInMaxVelocity := 10;
|
||||
YAxis.Config.rInMinVelocity := 0.1;
|
||||
YAxis.Config.rInMaxAcceleration := 50;
|
||||
YAxis.Config.rInMinAcceleration := 0.1;
|
||||
YAxis.Config.bInNoEncoder := TRUE;
|
||||
YAxis.Config.bInRelativeEncoder := TRUE;
|
||||
YAxis.Config.bInService := TRUE;
|
||||
YAxis.Config.rInOffset REF= Config.Y_Offset;
|
||||
YAxis.Config.rInDefaultPosition REF= XAxis_DefaultPosition;
|
||||
YAxis.Config.rInDefaultVelocity REF= Config.Y_DefaultVelocity;
|
||||
YAxis.Initialization(iStation);
|
||||
|
||||
YAxis.bInEnablePositive := TRUE;
|
||||
YAxis.bInEnableNegative := TRUE;
|
||||
{endregion}
|
||||
|
||||
|
||||
|
||||
|
||||
ConfigManagement.FileName := 'Aligner';
|
||||
|
||||
DataLogger.format := '%0.3f;%0.3f;%0.3f;%0.3f;$N';
|
||||
|
||||
DataLogger.Data[1].Name := 'X (mm)';
|
||||
DataLogger.Data[1].Value REF= Center.X;
|
||||
DataLogger.Data[1].Tolerence := 0.01;
|
||||
|
||||
DataLogger.Data[2].Name := 'Y (mm)';
|
||||
DataLogger.Data[2].Value REF= Center.Y;
|
||||
DataLogger.Data[2].Tolerence := 0.001;
|
||||
|
||||
DataLogger.Data[3].Name := 'Diameter (mm)';
|
||||
DataLogger.Data[3].Value REF= Diameter;
|
||||
DataLogger.Data[3].Tolerence := 0.1;
|
||||
|
||||
DataLogger.Data[4].Name := 'Roundness (mm)';
|
||||
DataLogger.Data[4].Value REF= Roundness;
|
||||
DataLogger.Data[4].Tolerence := 0.1;]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="MAIN" Id="{9cf7526a-d13d-4844-b4ad-6d8c783ce101}">
|
||||
<Declaration><![CDATA[METHOD MAIN : BOOL
|
||||
VAR_INPUT
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[IO();
|
||||
XAxis();
|
||||
YAxis();
|
||||
|
||||
TMX_5000();]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="PrepInOut" Id="{0a96881a-2ba5-4bf7-8c73-d1adb06b73bf}">
|
||||
<Declaration><![CDATA[METHOD PrepInOut : BOOL
|
||||
VAR_INST
|
||||
GripperSize : USINT;
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[CASE _Step OF
|
||||
0:
|
||||
CASE iCMD OF
|
||||
PrepInCMD:
|
||||
_Step := 10;
|
||||
PrepOutCMD:
|
||||
PrepInOut := TRUE;
|
||||
END_CASE
|
||||
10:
|
||||
GripperSize := ROBOT_MAIN.GetGripperSize(iStationStatus.WaferInfo[0].Size);
|
||||
|
||||
XAxis.rInTargetPosition := Config.RobotHandlingPosition[GripperSize].X;
|
||||
XAxis.rInTargetVelocity := Config.X_DefaultVelocity;
|
||||
|
||||
YAxis.rInTargetPosition := Config.RobotHandlingPosition[GripperSize].Y;
|
||||
YAxis.rInTargetVelocity := Config.Y_DefaultVelocity;
|
||||
|
||||
_Step := 20;
|
||||
20:
|
||||
IF XAxis.MoveAbsolute() AND YAxis.MoveAbsolute() THEN
|
||||
_Step := 0;
|
||||
PrepInOut := TRUE;
|
||||
END_IF
|
||||
END_CASE]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="SetCalibration" Id="{711e4cb2-8003-42e7-a4d8-c18dc3d54615}">
|
||||
<Declaration><![CDATA[METHOD SetCalibration
|
||||
VAR_INPUT
|
||||
TargetStation : INT;
|
||||
TargetSize : INT;
|
||||
TargetPaddle : INT;
|
||||
Center : sPoint;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[Config.CalibrationPosition[TargetStation][TargetSize][TargetPaddle] := Center;
|
||||
|
||||
ConfigManagement.CMD := eConfigCMD.Save;]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="Start" Id="{f2375d07-415a-4633-9dd2-e516d604a136}">
|
||||
<Declaration><![CDATA[METHOD Start : BOOL
|
||||
VAR
|
||||
In : ARRAY[0..7] OF DINT;
|
||||
i : INT;
|
||||
END_VAR
|
||||
VAR_INST
|
||||
RefPoint : sPoint;
|
||||
|
||||
CassetteNumber : INT;
|
||||
NextProcess : INT;
|
||||
|
||||
TargetEtcher : INT;
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[CASE _Step OF
|
||||
0:
|
||||
FOR i := 0 TO 7 DO
|
||||
In[i] := UDINT_TO_DINT(TMX_5000.rInResult[i+7]);
|
||||
END_FOR
|
||||
|
||||
Diameter := In[0];
|
||||
Diameter := Diameter;
|
||||
Diameter := Diameter /1000;
|
||||
|
||||
|
||||
IF NOT ROBOT_MAIN.CheckDiameter(Diameter, iStationStatus.WaferInfo[0].Size) THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
Roundness := In[1];
|
||||
Roundness := Roundness/1000;
|
||||
|
||||
Center.X := In[2];
|
||||
Center.X := Center.X/1000;
|
||||
|
||||
IF ABS(Center.X) > 120 THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
Center.Y := In[3];
|
||||
Center.Y := Center.Y/1000;
|
||||
|
||||
|
||||
IF bCalibration THEN
|
||||
bCalibration := FALSE;
|
||||
_Step := 100;
|
||||
ELSE
|
||||
_Step := 10;
|
||||
END_IF
|
||||
10:
|
||||
CASE CMD[FirstStation] OF
|
||||
StartCMD:
|
||||
CassetteNumber := iStationStatus.WaferInfo[0].CassetteNumber;
|
||||
NextProcess := iStationStatus.WaferInfo[0].FlowStepNumber +1;
|
||||
|
||||
TargetEtcher := CASSETTE_PROCESS[CassetteNumber][iStationStatus.WaferInfo[0].Number][NextProcess].TargetStation;
|
||||
CASE TargetEtcher OF
|
||||
20,21:
|
||||
CASSETTE_PROCESS[CassetteNumber][iStationStatus.WaferInfo[0].Number][NextProcess].Alternative[1] := TargetEtcher;
|
||||
CASSETTE_PROCESS[CassetteNumber][iStationStatus.WaferInfo[0].Number][NextProcess].Alternative[2] := TargetEtcher;
|
||||
RefPoint := Config.CalibrationPosition[TargetEtcher][iStationStatus.WaferInfo[0].Size][0];
|
||||
ELSE
|
||||
RefPoint := Config.CalibrationPosition[FirstSpinner][iStationStatus.WaferInfo[0].Size][0];
|
||||
END_CASE
|
||||
ELSE
|
||||
RefPoint := Config.CalibrationPosition[FirstSpinner][iStationStatus.WaferInfo[0].Size][0];
|
||||
END_CASE
|
||||
|
||||
_Step := 20;
|
||||
20:
|
||||
FOR i := 0 TO 7 DO
|
||||
In[i] := UDINT_TO_DINT(TMX_5000.rInResult[i+7]);
|
||||
END_FOR
|
||||
|
||||
Center.X := In[2];
|
||||
Center.X := Center.X/1000;
|
||||
|
||||
Center.Y := In[3];
|
||||
Center.Y := Center.Y/1000;
|
||||
|
||||
IF ABS(RefPoint.X - Center.X) > 0.001 THEN
|
||||
IF RefPoint.X < Center.X THEN
|
||||
YAxis.bInJogNegative := TRUE;
|
||||
YAxis.bInJogPositive := FALSE;
|
||||
YAxis.rInTargetVelocity := ABS(RefPoint.X - Center.X);
|
||||
ELSIF RefPoint.X > Center.X THEN
|
||||
YAxis.bInJogNegative := FALSE;
|
||||
YAxis.bInJogPositive := TRUE;
|
||||
YAxis.rInTargetVelocity := ABS(RefPoint.X - Center.X);
|
||||
ELSE
|
||||
YAxis.bInJogNegative := FALSE;
|
||||
YAxis.bInJogPositive := FALSE;
|
||||
END_IF
|
||||
END_IF
|
||||
|
||||
IF ABS(RefPoint.Y - Center.Y) > 0.001 THEN
|
||||
IF RefPoint.Y < Center.Y THEN
|
||||
XAxis.bInJogNegative := TRUE;
|
||||
XAxis.bInJogPositive := FALSE;
|
||||
XAxis.rInTargetVelocity := ABS(RefPoint.Y - Center.Y);
|
||||
ELSIF RefPoint.Y > Center.Y THEN
|
||||
XAxis.bInJogNegative := FALSE;
|
||||
XAxis.bInJogPositive := TRUE;
|
||||
XAxis.rInTargetVelocity := ABS(RefPoint.Y - Center.Y);
|
||||
ELSE
|
||||
XAxis.bInJogNegative := FALSE;
|
||||
XAxis.bInJogPositive := FALSE;
|
||||
END_IF
|
||||
END_IF
|
||||
|
||||
IF XAxis.rInTargetVelocity < 0.005 THEN
|
||||
XAxis.rInTargetVelocity := 0.005;
|
||||
END_IF
|
||||
IF YAxis.rInTargetVelocity < 0.005 THEN
|
||||
YAxis.rInTargetVelocity := 0.005;
|
||||
END_IF
|
||||
|
||||
DelayTimer(IN := ABS(RefPoint.X - Center.X)<= 0.001 AND ABS(RefPoint.Y - Center.Y) <=0.001, PT := T#100MS);
|
||||
IF DelayTimer.Q THEN
|
||||
DelayTimer(IN := FALSE);
|
||||
YAxis.bInJogNegative := FALSE;
|
||||
YAxis.bInJogPositive := FALSE;
|
||||
|
||||
XAxis.bInJogNegative := FALSE;
|
||||
XAxis.bInJogPositive := FALSE;
|
||||
|
||||
XAxis.rInTargetVelocity := Config.X_DefaultVelocity;
|
||||
YAxis.rInTargetVelocity := Config.Y_DefaultVelocity;
|
||||
_Step := 30;
|
||||
END_IF
|
||||
30:
|
||||
_Step := 100;
|
||||
40:
|
||||
FOR i := 0 TO 7 DO
|
||||
In[i] := UDINT_TO_DINT(TMX_5000.rInResult[i+7]);
|
||||
END_FOR
|
||||
|
||||
Center.X := In[2];
|
||||
Center.X := Center.X/1000;
|
||||
|
||||
Center.Y := In[3];
|
||||
Center.Y := Center.Y/1000;
|
||||
100:
|
||||
_Step := 0;
|
||||
Start := TRUE;
|
||||
END_CASE
|
||||
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
Reference in New Issue
Block a user