MODULE MainModule
PROC Main()
TPErase;
TPReadNum nCount1, "Qing Shu Ru Yi Ma Bao Shu!" ;
TPReadNum nJob, "Qing Shu Ru Mo Shi:50KG:=1,25KG:=2!";
InitAll;
WHILE TRUE DO
ReadType;
clock2re;
PickIF;
clock2re;
PlaceOF;
ENDWHILE
ENDPROC
PROC clock2re()
!tempint:=movstat;
IF DI10_1Product0K = 0 or DI10_2TuoPanOK = 0 Then
IF tempint<0.25 then
ClkStart CLK2;
ELSE
ClkStop CLK2;
ENDIF
Else
ClkStop CLK2;
EndIF
Endproc
PROC InitAll()
MoveHome;
Reset DO10_1JiaZhua;
Reset DO10_2YaBan;
Reset DO10_3ZhuaOK;
Reset DO10_4MaDuoOK;
Waittime 0.5;
bPickPart:=FALSE;
ClkReset CLK1;
ClkStart CLK1;
ClkReset CLK2;
MoveL Offs(pPick,0,0,400), vFast, z10, tGripper\WObj:=wobj0;
ENDPROC
PROC PickIF()
IF bPickPart = FALSE AND nJob <> 0 AND DI10_1Product0K = 1 THEN
!CalculatePick;
MoveJ Offs(pPick,0,0,400), vFast, z200, tGripper\WObj:=wobj0;
!MoveLDO Offs(pPick,0,0,100), vFast, z20, tool0\WObj:=wobj0, DO10_1JiaZhua, 1;
MoveL pPick, vFast, fine, tGripper\WObj:=wobj0;
Close1;
GripLoad LoadFull;
Accset 50,50;
HandshakeIF;
bPickPart:=TRUE;
ConfL\Off;
MoveJ pAfterPick, vFast, z60, tGripper\WObj:=wobj0;
ENDIF
ENDPROC
PROC PlaceOF()
IF DI10_2TuoPanOK = 1 AND bPickPart = TRUE THEN
CalculatePlace;
ConfL\Off;
!MoveL Offs(pOver,0,0,nOffsZ2), vFast, z200, tGripper;
IF bTag=true then
Accset 70, 70;
MoveJ pAbovePlace, vFast, z10, tGripper\WObj:=wobj0;
else
Accset 90, 90;
MoveJ pAbovePlace, vFast, z10, tGripper\WObj:=wobj0;
Endif
Accset 100,100;
! place first box
ConfL\Off;
!MoveL Offs(pPlace1,nOffsX1,nOffsY1,nOffsZ1),vTurn,z10,tGripper\WObj:=wobj0;
MoveL pPlace1, vMiddle, fine, tGripper\WObj:=wobj0;
Open1;
ConfL\Off;
MoveL Offs(pPlace1,0,0,nOffsZ1),vMiddle,z5,tGripper\WObj:=wobj0;
GripLoad LoadEmpty;
Accset 100,100;
bPickPart:=FALSE;
Incr nCount1;
HandshakeOF;
MoveJ pAbovePick, vFast, z200, tGripper\WObj:=wobj0;
MoveL Offs(pPick,0,0,400), vFast, z10, tGripper\WObj:=wobj0;
!MoveJ pHome, vFast, z200, tGripper;
ENDIF
ENDPROC
PROC HandshakeIF()
IF nJob=1 THEN
!Set DO10_3ZhuaOK;
ENDIF
IF nJob=2 THE