机械手自动化程序0915Word格式文档下载.docx
《机械手自动化程序0915Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《机械手自动化程序0915Word格式文档下载.docx(32页珍藏版)》请在冰豆网上搜索。
ENDFOLD(BASISTECHINI)
FOLDUSERINI
Makeyourmodificationshere
ENDFOLD(USERINI)
GLOBALINTERRUPTDECL4WHEN$IN[10]==FALSEDOItrpt1()
GLOBALINTERRUPTDECL5WHEN$IN[11]==FALSEDOItrpt1()
INTERRUPTDECL6WHEN$IN[9]==TRUEDOItrpt1();
地轨异常进入中断
INTERRUPTON6;
开地轨监视中断6
IFNOTGripper_ChkStatus(1,"
C"
)THEN
Gripper_SetStatus(1,"
O"
)
Part0InLeft=FALSE
Part2InLeft=FALSE
ENDIF
IFNOTGripper_ChkStatus(2,"
Gripper_SetStatus(2,"
Part1InRight=FALSE
FORl=1TO14
$OUT[l]=FALSE
ENDFOR;
此循环语句在初始化时把所有端口清零复位。
IF$IN[5]THEN
Machine1_OnlyDrop=TRUE
Machine2_OnlyDrop=TRUE;
机台1有首件信号时,机台1与机台2第一次响应只放标志位置1
ELSE
Machine1_OnlyDrop=FALSE
Machine2_OnlyDrop=FALSE
$FLAG[8]=FALSE;
FLAG[8]是干什么用的?
ENDFOLD(INI);
初始化完成
$OV_PRO=70;
限定系统运行速度
FOLDPTPHOMEVel=100%DEFAULT;
%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VPTP,%P1:
PTP,2:
HOME,3:
5:
100,7:
DEFAULT
$BWDSTART=FALSE
PDAT_ACT=PDEFAULT
FDAT_ACT=FHOME
BAS(#PTP_PARAMS,100)
$H_POS=XHOME
PTPXHOME
ENDFOLD
IF$IN_HOMETHEN
$OUT[5]=FALSE
$OUT[8]=FALSE
$OUT[11]=FALSE
LOOP
WAITSEC0.05
IF$IN[1]ANDNOTPart0InLeftANDGripper_ChkStatus(3,"
)THENToPick_Search()
ENDIF
IFPart0InLeftAND($IN[3]ORMachine1_OnlyDrop)ANDGripper_ChkStatus(1,"
)ANDGripper_ChkStatus(2,"
Machine1()
IFPart1InRightAND($IN[6]ORMachine2_OnlyDrop)ANDGripper_ChkStatus(2,"
)ANDGripper_ChkStatus(1,"
Machine2()
IFPart2InLeftAND($IN[8]ORMachine3_OnlyDrop)ANDGripper_ChkStatus(1,"
Machine3()
ENDLOOP
END
DEFItrpt1()
HALT
BRAKE
2、取料程序(采用中断的方法自动探料,完成取料作业)
ACCESSRVO2
DEFToPick_Search()
GLOBALINTERRUPTDECL3WHEN$STOPMESS==TRUEDOIR_STOPM();
单独用了一个系统中断?
ENDFOLD(INI)
INTERRUPTDECL1WHEN$IN[10]==TRUEDOFOUND()
SevenAxis_Run
(1)
GOTOMARK
FOLDPTPP1CONTVel=100%PDAT2Tool[1]Base[0];
P1,3:
C_DIS,5:
PDAT2
PDAT_ACT=PPDAT2
FDAT_ACT=FP1
PTPXP1C_DIS
FOLDPTPP3CONTVel=100%PDAT8Tool[1]Base[0];
P3,3:
PDAT8
PDAT_ACT=PPDAT8
FDAT_ACT=FP3
PTPXP3C_DIS
FOLDLINP2CONTVel=2m/sCPDAT2Tool[1]Base[0];
%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VLIN,%P1:
LIN,2:
P2,3:
C_DISC_DIS,5:
2,7:
CPDAT2
LDAT_ACT=LCPDAT2
FDAT_ACT=FP2
BAS(#CP_PARAMS,2)
LINXP2C_DISC_DIS
FOLDLINP1Vel=0.05m/sCPDAT1Tool[1]Base[0];
0.05,7:
CPDAT1
LDAT_ACT=LCPDAT1
BAS(#CP_PARAMS,0.05)
LINXP1
mark:
Search()
INTERRUPTOFF1
WAITSEC0
XP4=$POS_ACT
FOLDLINP4CONTVel=2m/sCPDAT10Tool[1]Base[0];
P4,3:
CPDAT10
LDAT_ACT=LCPDAT10
FDAT_ACT=FP4
LINXP4C_DISC_DIS
Gripper_SetStatus(1,"
LIN_REL{Z15}
LIN_REL{Z-17}
Part0InLeft=TRUE
XP0=$POS_ACT
XP0.Z=XP0.Z+25;
看一下寻料程序到底是怎么运转的!
FOLDLINP0CONTVel=0.025m/sCPDAT8Tool[1]Base[0];
P0,3:
0.025,7:
CPDAT8
LDAT_ACT=LCPDAT8
FDAT_ACT=FP0
BAS(#CP_PARAMS,0.025)
LINXP0C_DISC_DIS
IFNOT$IN[10]THEN
GOTOmark
FOLDLINP1CONTVel=2m/sCPDAT7Tool[1]Base[0];
CPDAT7
LDAT_ACT=LCPDAT7
LINXP1C_DISC_DIS
DEFSearch()
GLOBALINTERRUPTDECL3WHEN$STOPMESS==TRUEDOIR_STOPM()
INTERRUPTON3
BAS(#INITMOV,0)
;
INTERRUPTON1
FOLDPTPP1CONTVel=100%PDAT6Tool[1]Base[0];
PDAT6
PDAT_ACT=PPDAT6
PTPXP