21 Appendix
21.5.3. For RH-3S*HR
(1) 1.Prg
1 '### Ver.A3 #################################
2 '# Conveyer tracking, robot operation program(for RH-3SDHR)
3 '# Program type : 1.prg
4 '# Date of creation/version : 2012.07.31 A3
5 '# MITSUBISHI ELECTRIC CORPORATION.
6 '############################################
7 '
8 '### Main processing ###
9 *S00MAIN
10 GoSub *S90HOME 'Origin return processing
11 GoSub *S10INIT 'Initialization processing
12 *LOOP
13 GoSub *S20TRGET 'Tracked workpiece takeout processing
14 GoSub *S30WKPUT 'Workpiece placing processing
15 GoTo *LOOP
16 End
17 '
18 '### Initialization processing ###
19 *S10INIT
20 '/// Speed related ///
21 Accel 100,100 'Acceleration/deceleration setting
22 Ovrd 100 'Speed setting
23 Loadset 1,1 'Optimal acceleration/deceleration specification
24 OAdl On 'Turning optimal acceleration/deceleration ON
25 Cnt 0
26 Clr 1
27 HOpen 1
28 '/// Initial value setting ///
29 TrClr 1 'Clear tracking buffer 1
30 MWAIT1=0 'Clear workpiece wait flag 1
31 '/// The processing to singular point of RH-3S*HR ///
32 MTUPPOS=P3HR.X 'Move time to midair position(measurement time that the slowest
J1 axis rotated from -225 to 225 degrees)
33 MTWKPOS=1000 * PUP1.Y / P3HR.Y 'Move time to suction position(calculation from speed and move
amount of J3)
34 MTWKUP=1000 * PUP1.Z / P3HR.Y 'Move time to midair position(calculation from speed and move
amount of J3)
35 MTRSTT=MTUPPOS 'Move time to midair position
36 MTREND=MTUPPOS + MTWKPOS + (PDLY1.X * 1000) + MTWKUP 'Necessary time for tracking before
it passes over singular point
37 '/// The processing to singular point of RH-3S*HR ///
38 '/// Multitask startup ///
39 M_09#=PWK.X 'Model number specification
40 If M_Run(2)=0 Then 'Confirmation of conveyer 1 multitasking
41 XRun 2,"CM1",1 'Multitasking setting
42 Wait M_Run(2)=1
43 EndIf
44 Priority PRI.X,1
45 Priority PRI.Y,2
46 Return
47 '
48 '### Tracked workpiece takeout processing ###
49 *S20TRGET
50 '/// Tracking buffer check ///
51 *LBFCHK
52 If M_Trbfct(1)>=1 Then GoTo *LREAD 'If a workpiece exists
53 Mov P1 'Move to the pull-off location
54 MWAIT1=0
Sample Programs 21-139