机械手自动化程序0915.docx
- 文档编号:23886564
- 上传时间:2023-05-21
- 格式:DOCX
- 页数:38
- 大小:19.50KB
机械手自动化程序0915.docx
《机械手自动化程序0915.docx》由会员分享,可在线阅读,更多相关《机械手自动化程序0915.docx(38页珍藏版)》请在冰豆网上搜索。
机械手自动化程序0915
1、主程序main
&ACCESSRVP1
&REL1
&PARAMDISKPATH=KRC:
\R1\Program
DEFPro_main()
INTl
;FOLDINI;%{PE}
;FOLDBASISTECHINI
GLOBALINTERRUPTDECL3WHEN$STOPMESS==TRUEDOIR_STOPM()
INTERRUPTON3
BAS(#INITMOV,0)
;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,"C")THEN
Gripper_SetStatus(2,"O")
Part1InRight=FALSE
ENDIF
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
ENDIF
$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
ENDIF
LOOP
WAITSEC0.05
IF$IN[1]ANDNOTPart0InLeftANDGripper_ChkStatus(3,"O")THENToPick_Search()
ENDIF
IFPart0InLeftAND($IN[3]ORMachine1_OnlyDrop)ANDGripper_ChkStatus(1,"C")ANDGripper_ChkStatus(2,"O")THEN
Machine1()
ENDIF
IFPart1InRightAND($IN[6]ORMachine2_OnlyDrop)ANDGripper_ChkStatus(2,"C")ANDGripper_ChkStatus(1,"O")THEN
Machine2()
ENDIF
IFPart2InLeftAND($IN[8]ORMachine3_OnlyDrop)ANDGripper_ChkStatus(1,"C")THEN
Machine3()
ENDIF
ENDLOOP
END
DEFItrpt1()
HALT
BRAKE
END
2、取料程序(采用中断的方法自动探料,完成取料作业)
&ACCESSRVO2
&REL1
&PARAMDISKPATH=KRC:
\R1\Program
DEFToPick_Search()
;FOLDINI;%{PE}
;FOLDBASISTECHINI
GLOBALINTERRUPTDECL3WHEN$STOPMESS==TRUEDOIR_STOPM();单独用了一个系统中断?
INTERRUPTON3
BAS(#INITMOV,0)
;ENDFOLD(BASISTECHINI)
;FOLDUSERINI
;Makeyourmodificationshere
;ENDFOLD(USERINI)
;ENDFOLD(INI)
INTERRUPTDECL1WHEN$IN[10]==TRUEDOFOUND()
SevenAxis_Run
(1)
GOTOMARK
;FOLDPTPP1CONTVel=100%PDAT2Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VPTP,%P1:
PTP,2:
P1,3:
C_DIS,5:
100,7:
PDAT2
$BWDSTART=FALSE
PDAT_ACT=PPDAT2
FDAT_ACT=FP1
BAS(#PTP_PARAMS,100)
PTPXP1C_DIS
;ENDFOLD
;FOLDPTPP3CONTVel=100%PDAT8Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VPTP,%P1:
PTP,2:
P3,3:
C_DIS,5:
100,7:
PDAT8
$BWDSTART=FALSE
PDAT_ACT=PPDAT8
FDAT_ACT=FP3
BAS(#PTP_PARAMS,100)
PTPXP3C_DIS
;ENDFOLD
;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
$BWDSTART=FALSE
LDAT_ACT=LCPDAT2
FDAT_ACT=FP2
BAS(#CP_PARAMS,2)
LINXP2C_DISC_DIS
;ENDFOLD
;FOLDLINP1Vel=0.05m/sCPDAT1Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VLIN,%P1:
LIN,2:
P1,3:
5:
0.05,7:
CPDAT1
$BWDSTART=FALSE
LDAT_ACT=LCPDAT1
FDAT_ACT=FP1
BAS(#CP_PARAMS,0.05)
LINXP1
;ENDFOLD
;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
mark:
Search()
INTERRUPTOFF1
WAITSEC0
XP4=$POS_ACT
;FOLDLINP4CONTVel=2m/sCPDAT10Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VLIN,%P1:
LIN,2:
P4,3:
C_DISC_DIS,5:
2,7:
CPDAT10
$BWDSTART=FALSE
LDAT_ACT=LCPDAT10
FDAT_ACT=FP4
BAS(#CP_PARAMS,2)
LINXP4C_DISC_DIS
;ENDFOLD
Gripper_SetStatus(1,"O")
LIN_REL{Z15}
LIN_REL{Z-17}
Gripper_SetStatus(1,"C")
Part0InLeft=TRUE
WAITSEC0
XP0=$POS_ACT
XP0.Z=XP0.Z+25;看一下寻料程序到底是怎么运转的!
;FOLDLINP0CONTVel=0.025m/sCPDAT8Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VLIN,%P1:
LIN,2:
P0,3:
C_DISC_DIS,5:
0.025,7:
CPDAT8
$BWDSTART=FALSE
LDAT_ACT=LCPDAT8
FDAT_ACT=FP0
BAS(#CP_PARAMS,0.025)
LINXP0C_DISC_DIS
;ENDFOLD
WAITSEC0
IFNOT$IN[10]THEN
GOTOmark
ENDIF
;FOLDLINP1CONTVel=2m/sCPDAT7Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VLIN,%P1:
LIN,2:
P1,3:
C_DISC_DIS,5:
2,7:
CPDAT7
$BWDSTART=FALSE
LDAT_ACT=LCPDAT7
FDAT_ACT=FP1
BAS(#CP_PARAMS,2)
LINXP1C_DISC_DIS
;ENDFOLD
END
DEFSearch()
;FOLDINI;%{PE}
;FOLDBASISTECHINI
GLOBALINTERRUPTDECL3WHEN$STOPMESS==TRUEDOIR_STOPM()
INTERRUPTON3
BAS(#INITMOV,0)
;ENDFOLD(BASISTECHINI)
;FOLDUSERINI
;Makeyourmodificationshere
;ENDFOLD(USERINI)
;ENDFOLD(INI)
INTERRUPTON1
;FOLDPTPP1CONTVel=100%PDAT6Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VPTP,%P1:
PTP,2:
P1,3:
C_DIS,5:
100,7:
PDAT6
$BWDSTART=FALSE
PDAT_ACT=PPDAT6
FDAT_ACT=FP1
BAS(#PTP_PARAMS,100)
PTPXP1C_DIS
;ENDFOLD
$OUT[16]=TRUE
;FOLDLINP3CONTVel=2m/sCPDAT11Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VLIN,%P1:
LIN,2:
P3,3:
C_DISC_DIS,5:
2,7:
CPDAT11
$BWDSTART=FALSE
LDAT_ACT=LCPDAT11
FDAT_ACT=FP3
BAS(#CP_PARAMS,2)
LINXP3C_DISC_DIS
;ENDFOLD
;FOLDLINP2CONTVel=0.05m/sCPDAT5Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VLIN,%P1:
LIN,2:
P2,3:
C_DISC_DIS,5:
0.05,7:
CPDAT5
$BWDSTART=FALSE
LDAT_ACT=LCPDAT5
FDAT_ACT=FP2
BAS(#CP_PARAMS,0.05)
LINXP2C_DISC_DIS
;ENDFOLD
;FOLDLINP1Vel=0.02m/sCPDAT6Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VLIN,%P1:
LIN,2:
P1,3:
5:
0.02,7:
CPDAT6
$BWDSTART=FALSE
LDAT_ACT=LCPDAT6
FDAT_ACT=FP1
BAS(#CP_PARAMS,0.02)
LINXP1
;ENDFOLD
WAITSEC0
END
DEFFOUND()
BRAKE
LIN$POS_INT;risealittle
RESUME
END
3、机台1取放料程序(完成机台1取放料动作与信号交互)
&ACCESSRVO2
&REL1
&PARAMDISKPATH=KRC:
\R1\Program
DEFMachine1()
;FOLDINI;%{PE}
;FOLDBASISTECHINI
GLOBALINTERRUPTDECL3WHEN$STOPMESS==TRUEDOIR_STOPM()
INTERRUPTON3
BAS(#INITMOV,0)
;ENDFOLD(BASISTECHINI)
;FOLDUSERINI
;Makeyourmodificationshere
;ENDFOLD(USERINI)
;ENDFOLD(INI)
SevenAxis_Run
(1)
;FOLDOUT5''State=TRUE;%{PE}%R8.3.40,%MKUKATPBASIS,%COUT,%VOUTX,%P2:
5,3:
5:
TRUE,6:
$OUT[5]=TRUE
;ENDFOLD
IFNOTMachine1_OnlyDropTHEN
;FOLDPTPP1CONTVel=100%PDAT4Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VPTP,%P1:
PTP,2:
P1,3:
C_DIS,5:
100,7:
PDAT4
$BWDSTART=FALSE
PDAT_ACT=PPDAT4
FDAT_ACT=FP1
BAS(#PTP_PARAMS,100)
PTPXP1C_DIS
;ENDFOLD
mark:
;FOLDLINP2CONTVel=2m/sCPDAT4Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VLIN,%P1:
LIN,2:
P2,3:
C_DISC_DIS,5:
2,7:
CPDAT4
$BWDSTART=FALSE
LDAT_ACT=LCPDAT4
FDAT_ACT=FP2
BAS(#CP_PARAMS,2)
LINXP2C_DISC_DIS
;ENDFOLD
;FOLDLINP3CONTVel=2m/sCPDAT5Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VLIN,%P1:
LIN,2:
P3,3:
C_DISC_DIS,5:
2,7:
CPDAT5
$BWDSTART=FALSE
LDAT_ACT=LCPDAT5
FDAT_ACT=FP3
BAS(#CP_PARAMS,2)
LINXP3C_DISC_DIS
;ENDFOLD
Gripper_SetStatus(2,"C")
LIN_REL{Z7.5}
Gripper_SetStatus(2,"O")
;FOLDLINP3Vel=2m/sCPDAT1Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VLIN,%P1:
LIN,2:
P3,3:
5:
2,7:
CPDAT1
$BWDSTART=FALSE
LDAT_ACT=LCPDAT1
FDAT_ACT=FP3
BAS(#CP_PARAMS,2)
LINXP3
;ENDFOLD
Gripper_SetStatus(2,"C")
Part1InRight=TRUE
;FOLDLINP2Vel=0.05m/sCPDAT6Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VLIN,%P1:
LIN,2:
P2,3:
5:
0.05,7:
CPDAT6
$BWDSTART=FALSE
LDAT_ACT=LCPDAT6
FDAT_ACT=FP2
BAS(#CP_PARAMS,0.05)
LINXP2
;ENDFOLD
IFNOT$IN[11]THEN
GOTOmark
ENDIF
;FOLDPTPP4CONTVel=100%PDAT6Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VPTP,%P1:
PTP,2:
P4,3:
C_DIS,5:
100,7:
PDAT6
$BWDSTART=FALSE
PDAT_ACT=PPDAT6
FDAT_ACT=FP4
BAS(#PTP_PARAMS,100)
PTPXP4C_DIS
;ENDFOLD
;FOLDPTPP5CONTVel=100%PDAT10Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VPTP,%P1:
PTP,2:
P5,3:
C_DIS,5:
100,7:
PDAT10
$BWDSTART=FALSE
PDAT_ACT=PPDAT10
FDAT_ACT=FP5
BAS(#PTP_PARAMS,100)
PTPXP5C_DIS
;ENDFOLD
;FOLDPTPP6CONTVel=100%PDAT8Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VPTP,%P1:
PTP,2:
P6,3:
C_DIS,5:
100,7:
PDAT8
$BWDSTART=FALSE
PDAT_ACT=PPDAT8
FDAT_ACT=FP6
BAS(#PTP_PARAMS,100)
PTPXP6C_DIS
;ENDFOLD
;FOLDLINP7Vel=0.25m/sCPDAT7Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VLIN,%P1:
LIN,2:
P7,3:
5:
0.25,7:
CPDAT7
$BWDSTART=FALSE
LDAT_ACT=LCPDAT7
FDAT_ACT=FP7
BAS(#CP_PARAMS,0.25)
LINXP7
;ENDFOLD
Gripper_SetStatus(1,"O")
;FOLDPTPP6CONTVel=100%PDAT14Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VPTP,%P1:
PTP,2:
P6,3:
C_DIS,5:
100,7:
PDAT14
$BWDSTART=FALSE
PDAT_ACT=PPDAT14
FDAT_ACT=FP6
BAS(#PTP_PARAMS,100)
PTPXP6C_DIS
;ENDFOLD
;FOLDPTPP8CONTVel=100%PDAT9Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VPTP,%P1:
PTP,2:
P8,3:
C_DIS,5:
100,7:
PDAT9
$BWDSTART=FALSE
PDAT_ACT=PPDAT9
FDAT_ACT=FP8
BAS(#PTP_PARAMS,100)
PTPXP8C_DIS
;ENDFOLD
ELSE
;FOLDPTPP5CONTVel=100%PDAT2Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VPTP,%P1:
PTP,2:
P5,3:
C_DIS,5:
100,7:
PDAT2
$BWDSTART=FALSE
PDAT_ACT=PPDAT2
FDAT_ACT=FP5
BAS(#PTP_PARAMS,100)
PTPXP5C_DIS
;ENDFOLD
;FOLDPTPP6CONTVel=100%PDAT13Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VPTP,%P1:
PTP,2:
P6,3:
C_DIS,5:
100,7:
PDAT13
$BWDSTART=FALSE
PDAT_ACT=PPDAT13
FDAT_ACT=FP6
BAS(#PTP_PARAMS,100)
PTPXP6C_DIS
;ENDFOLD
;FOLDLINP7Vel=0.25m/sCPDAT9Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VLIN,%P1:
LIN,2:
P7,3:
5:
0.25,7:
CPDAT9
$BWDSTART=FALSE
LDAT_ACT=LCPDAT9
FDAT_ACT=FP7
BAS(#CP_PARAMS,0.25)
LINXP7
;ENDFOLD
Gripper_SetStatus(1,"O")
;FOLDPTPP6Vel=100%PDAT12Tool[1]Base[0];%{PE}%R8.3.40,%MKUKATPBASIS,%CMOVE,%VPTP,%P1:
PTP,2:
P6,3:
5:
100,7:
PDAT12
$BWDSTART=FALSE
PDAT_ACT=PPDAT12
FDAT_ACT=FP6
BAS(#PTP_PARAMS,100)
PTPXP6
;ENDFOLD
;FOLDPTPP8CONTVel=100%PDAT7Tool[
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 机械手 自动化 程序 0915