PROC main()
Label1:
Inital;
WHILETRUEDO
Pick;
Pallet;
IFpndi13_diection_selet = 1 THEN
Pallet;
ELSE
Pallet_vert;
ENDIF
IF nCount =Totality THEN
MoveL pHome, v800,fine, tool0;
PulseDO\PLength:=1, pndo10_palletOK_part;
IFpndi12_palletOK_all = 1 THEN
PulseDO\PLength:=1,pndo11_palletOK_all;
Stop;
ENDIF
GOTOLabel1;
ENDIF
ENDWHILE
ENDPROC
PROC Inital()
MoveJ pHome, v600, fine, tool0;
Totality := n_Totality;
Row := n_Row;
Height := 1;
Y := 1;
H1 := 1;
H2 := 1;
nCount := 0;
PulseDO\PLength:=0.5, do00_tuici;
Reset do00_tuici;
Reset do01_shangci;
Reset pndo09_pick_ok;
Reset pndo10_palletOK_part;
Reset pndo11_palletOK_all;
ENDPROC
PROC Pallet()
MoveL pPlace_safe10, v600, z100,tool0;
MoveJ pPlace_safe30, v600, z100,tool0;
pPlace := pPlace_base;
IF Height MOD 2= 1 THEN
pPlace :=Offs(pPlace,X_offser,Y_offser - (Y - 1) * 61,Z_offser + (H1 - 1) * 28);
ELSE
pPlace := Offs(pPlace,X_offser,Y_offser+ 15 - (Y - 1) * 61,Z_offser + (H2 - 1) * 26);
ENDIF
MoveL Offs(pPlace,0,0,50), v300,fine, tool0\WObj:=wobj_place;
MoveL pPlace, v20, fine,tool0\WObj:=wobj_place;
PulseDO\PLength:=1, do00_tuici;
WaitTime 1;
WaitDI di01_tuici_OK, 1;
MoveL Offs(pPlace,0,0,300), v300,z30, tool0\WObj:=wobj_place;
MoveL pPlace_safe30, v600, z50,tool0;
Incr nCount;
IF Y = Row THEN
Y := 0;
Incr Height;
IF Height MOD 2= 1 THEN
Incr H1;
ELSE
Incr H2;
ENDIF
ENDIF
Incr Y;
ENDPROC
PROC Pallet_vert()
MoveL pPlace_safe100, v600, z100,tool0;
MoveJ pPlace_safe110, v600, z100,tool0;
MoveJ pPlace_base2, v50, fine,tool0\WObj:=wobj_place;
pPlace := place_base2;
IF Height MOD 2= 1 THEN
pPlace := Offs(pPlace,X_offser,Y_offser- (Y - 1) * 61,Z_offser + (H1 - 1) * 28);
ELSE
pPlace :=Offs(pPlace,X_offser,Y_offser + 15 - (Y - 1) * 61,Z_offser + (H2 - 1) * 26);
ENDIF
MoveL Offs(pPlace,0,0,50), v300,fine, tool0\WObj:=wobj_place;
MoveL pPlace, v20, fine, tool0\WObj:=wobj_place;
PulseDO\PLength:=1, do00_tuici;
WaitTime 1;
WaitDI di01_tuici_OK, 1;
MoveL Offs(pPlace,0,0,300), v300,z30, tool0\WObj:=wobj_place;
MoveL pPlace_safe30, v600, z50,tool0;
Incr nCount;
IF Y = Row THEN
Y := 0;
Incr Height;
IF Height MOD 2= 1 THEN
Incr H1;
ELSE
Incr H2;
ENDIF
ENDIF
Incr Y;
ENDPROC
PROC Pick()
MoveJ p10, v600, fine, tool0;
WaitDI pndi09_can_pick, 1;
MoveL pPick_base, v20, fine,tool0\WObj:=wobj0;
pPick := pPick_base;
pPick := Offs(pPick,0,-L_offser /2,0);
MoveL Offs(pPick,0,0,70), v200,fine, tool0\WObj:=wobj0;
IF Height MOD 2= 1 THEN
MoveL pPick, v20, fine,tool0\WObj:=wobj0;
ELSE
MoveL Offs(pPick,0,0,15),v20, fine, tool0\WObj:=wobj0;
ENDIF
PulseDO\PLength:=1, do01_shangci;
WaitDI di02_shangci_OK, 1;
MoveL Offs(pPick,0,0,100), v150,z50, tool0\WObj:=wobj0;
MoveL Offs(pPick,0,0,400), v400,z50, tool0\WObj:=wobj0;
PulseDO\PLength:=1,pndo09_pick_ok;
ENDPROC
PROC wobj_place0()
MoveL p_x1, v20, fine, tool0;
MoveL p_x2, v20, fine, tool0;
MoveL p_y, v20, fine, tool0;
ENDPROC
PROC set_home()
WZSphDef\Inside, shape1, home_C1,100;
WZDOSet\Temp, home_wz\Before,shape1, pndo07_home, 1;
ENDPROC
PROC ppp()
Idelet intno1;
CONNECT intno1 WITHkkk;
ISignalDI\Single, di01_tuici_OK,1, intno1;
IWatch intno1;
MoveL p30, v100, fine, tool0;
MoveL p40, v20, fine, tool0;
ENDPROC
TRAP kkk
StopMove;
WaitTime 3;
!WaitDI di01_tuici_OK, 0;
StartMove;
MoveJ p50, v100, fine, tool0;
Idelet intno1;
ENDTRAP
ENDMODULE
更多ABB机器人