《三菱机器人程序》由会员分享,可在线阅读,更多相关《三菱机器人程序(30页珍藏版)》请在金锄头文库上搜索。
1、/ 定义输入 /DefIo in0=Bit,0DefIo in1=Bit,1DefIo in3=Bit,3DefIo in4=Bit,4DefIo in5=Bit,5DefIo in6=Bit,6DefIo in7=Bit,7DefIo in8=Bit,8DefIo in9=Bit,9DefIo in10=Bit,10DefIo in11=Bit,11DefIo in12=Bit,12DefIo in13=Bit,13DefIo in14=Bit,14DefIo in15=Bit,15/定义 / 输出 /DefIo out0=Bit,0DefIo out1=Bit,1DefIo out3=Bi
2、t,3DefIo out4=Bit,4DefIo out5=Bit,5DefIo out6=Bit,6DefIo out7=Bit,7DefIo out8=Bit,8DefIo out9=Bit,9DefIo out10=Bit,10DefIo out11=Bit,11DefIo out12=Bit,12DefIo out13=Bit,13DefIo out14=Bit,14DefIo out15=Bit,15 定义 安全点定义托盘点/ 定义变量 /Def Jnt jydDef Plt 1 ,p11,p17,p71,p77, 4,4,1 j1=(+ 1.11 ,- 60.00 ,+ 145.0
3、0 ,+ 0.00 ,+ 0.00 ,+ 86.61 ) jyd=(+ 0.00 ,- 60.00 ,+ 145.00 ,+ 0.00 ,+ 0.00 ,-90.00 ) p0=(+ 0.00 ,+ 0.00 ,+ 20.00 ,+ 0.00 ,+ 0.00 ,+ 0.00 )(0,0) p200=(+ 0.00 ,+ 0.00 ,+ 5.00 ,+ 0.00 ,+ 0.00 ,+ 0.00 )(0,0) p201=(+ 0.00 ,+ 0.00 ,+ 150.00 ,+ 0.00 ,+ 0.00 ,+ 0.00 )(0,0) p202=(+ 0.00 ,+ 135.00 ,+ 0.00 ,+
4、 0.00 ,+ 0.00 ,+ 0.00 )(0,0) p203=(+ 0.00 ,+ 0.00 ,+ 60.00 ,+ 0.00 ,+ 0.00 ,+ 0.00 )( 0,0) p204=(+ 0.00 ,+ 20.00 ,+ 0.00 ,+ 0.00 ,+ 0.00 ,+ 0.00 )( 0,0) / 托盘点 / p12=p11p21=p11p22=p11p12.Y=p11.Y+12p21.X=p11.X+12p22.X=p11.X+12p22.Y=p11.Y+12p15=( Plt 1,3)p16=p15p25=p15p26=p15p16.Y=p15.Y+12p25.X=p15.X+1
5、2p26.X=p15.X+12p26.Y=p15.Y+12p31=( Plt 1,8)p32=p31p41=p31p42=p31p32.Y=p31.Y+12p41.X=p31.X+12p42.X=p31.X+12p42.Y=p31.Y+12p35=( Plt 1,6)p36=p35p45=p35p46=p35p36.Y=p35.Y+12p45.X=p35.X+12p46.X=p35.X+12p46.Y=p35.Y+12p51=( Plt 1,9)p52=p51p61=p51p62=p51p52.Y=p51.Y+12p61.X=p51.X+12p62.X=p51.X+12p62.Y=p51.Y+
6、12p55=( Plt 1,11)p56=p55p65=p55p66=p55p56.Y=p55.Y+12p65.X=p55.X+12p66.X=p55.X+12p66.Y=p55.Y+12p75=( Plt 1,14)p76=p75判断 3个夹具是否在原位程序 fw判断 1夹具是否在原位夹具 1复位 判断夹具 2是否在原位 夹具 2复位 判断夹具 3是否在原位夹具 3复位一次装机二次装机三次装机p85=p75p86=p75p76.Y=p75.Y+ 12p85.X=p75.X+ 12p86.X=p75.X+ 12p86.Y=p75.Y+ 12p72=p71p81=p71p82=p71p72.Y=
7、p71.Y+ 12p81.X=p71.X+ 12p82.X=p71.X+ 12p81.Y=p71.Y+ 12/ 判断 /If M_In (9)= 1 And M_In (10)= 0 ThenIf M_In (11)= 0 And M_In (13)= 0 ThenGoSub *fwEndIfEndIfIf M_In (9)= 1 And M_In (10)= 1 ThenIf M_In (11)= 0 And M_In (13)= 0 ThenGoSub *fw1EndIfEndIfIf M_In (9)= 1 And M_In (10)= 0 ThenIf M_In (11)= 1 And
8、 M_In (13)= 0 ThenGoSub *fw2EndIfEndIfIf M_In (9)= 1 And M_In (10)= 0 ThenIf M_In (11)= 0 And M_In (13)= 1 ThenGoSub *fw3EndIfEndIfIf M_05# 3 Thenout14= 1M_05#= 0EndIfIf M_In (6)= 1 And M_05#= 0 ThenGoSub *ks1EndIfIf M_In (6)= 1 And M_05#= 1 ThenGoSub *ks2EndIfIf M_In (6)= 1 And M_05#= 2 ThenGoSub *
9、ks3EndIfIf M_In (6)= 1 And M_05#= 3 ThenGoSub *ks4EndIfEnd/ 复位程序 /*fwOvrd 80j1= J_Currj1.J2=jyd.J2j1.J3=jyd.J3j1.J4=jyd.J4j1.J5=jyd.J5Mov j1Mov jyd out5= 1 m_outb (6)= 0M_00#= 0M_05#= 0M_01#= 0Return /四次装机程序复位将输出信号 6- 13的8个位关闭复位 1/复位 2/ *fw1 Ovrd 70 j1= J_Curr j1.J2=jyd.J2 j1.J3=jyd.J3 j1.J4=jyd.J4
10、j1.J5=jyd.J5 Mov j1 Mov jyd out12= 0 out13= 0 Mov p1 Mov p23 ovrd 50 Spd 400 Mvs p20-p204 Mvs p20 Dly 0.2 out11= 1 Dly 0.2 Mvs p20+p203 out11= 0 GoSub *fw4 Return / *fw2Ovrd 70 j1= J_Currj1.J2=jyd.J2 j1.J3=jyd.J3 j1.J4=jyd.J4 j1.J5=jyd.J5 Mov j1 Mov jyd out12= 0 out13= 0 ovrd 50 Mov p40+p201 Spd 400
11、 Mvs p40 Dly 0.2 out11= 1 Dly 0.2 Mvs p40+p203 out11= 0 GoSub *fw4 Return / / 复位 3/ *fw3 Ovrd 70 j1= J_Curr j1.J2=jyd.J2 j1.J3=jyd.J3 j1.J4=jyd.J4 j1.J5=jyd.J5 Mov j1 Mov jyd out12= 1 out13= 0 Mov p5 out12= 0 ovrd 51 Mov p2 Spd 600 Mvs p33Mvs p30+p200Mvs p30Dly 0.2 out11= 1 Dly 0.2 Mvs p30+p203 out1
12、1= 0 M_05#=M_05#+ 1 If M_In (6)= 0 Then GoTo *fw4 Return / / 正常复位 / *fw4 Ovrd 50 j1= J_Curr j1.J2=jyd.J2 j1.J3=jyd.J3 j1.J4=jyd.J4 j1.J5=jyd.J5Mov j1 Mov jyd out11= 0 out12= 0 out13= 0 out15= 0 out7= 0 out6= 0 out14= 0 Return / 取夹具 1/ *jj1Wait M_In (10)= 0 Wait M_In (11)= 0 Wait M_In (13)= 0Ovrd 50Mov p20+p201Spd 700Mov p20+p203Spd 300 out11= 1Mvs p20 Dly 0.2 out11= 0 Dly 0.2Mvs p20+p200 p23= P_CurrMvs p23-p204 p23= P_CurrMvs p23+p201 p23= P_Curr Return / 取夹具 2/ *jj2Spd 400Wait M_In (10)= 0 Wait M_In (11)= 0 Wait M_In (13)= 0 Mvs p40+p203 out11= 1Mvs p40D