Yamaha Yamaha Robot Controller CC-Link Unit Robotics User Manual


 
5-13
5
Specifications
4. Sample program
[Robot program]
1st unit’s RCX40
‘INIT ROUTINE
RESET SO2()
RESET SO4()
RESET DO4()
A=101
‘MAIN ROUTINE
MOVE P,P100,Z=0
GOSUB *PICK
*ST1:
MOVE P,P[A],Z=0
GOSUB *PLACE
MOVE P,P100,Z=0
SO(41)=1
WAIT SI(41)=1
SO(41)=0
WAIT SI(41)=0
SO(23,22,21,20)=A-100
SO(40)=1
WAIT SI(40)=1
SO(40)=0
WAIT SI(40)=0
SO(23,22,21,20)=0
GOSUB *PICK
WAIT SI(42)=1
SO(42)=1
WAIT SI(42)=0
SO(42)=0
A=A+1
IF A>108 THEN
A=101
DO(47)=1
WAIT DI(47)=1
DO(47)=0
ENDIF
GOTO *ST1
HALT
‘SUB ROUTINE FOR PICK
*PICK:
DO(40)=1
DRIVE(3,P121),S=20
WAIT ARM(3)
DO(40)=0
DELAY 500
RETURN
‘‘SUB ROUTINE FOR PLACE
*PLACE:
DRIVE(3,P122),S=20
WAIT ARM(3)
DO(40)=1
DELAY 500
RETURN
2nd unit’s RCX142
‘INIT ROUTINE
RESET SO2()
RESET SO4()
RESET DO4()
B=201
‘MAIN ROUTINE
MOVE P,P200,Z=0
GOSUB *PICK
*ST2:
WAIT SI(41)=1
SO(41)=1
WAIT SI(41)=0
SO(41)=0
WAIT SI(40)=1
B=SI(23,22,21,20)
SO(40)=1
WAIT SI(40)=0
SO(40)=0
B=B+200
MOVE P,P[B],Z=0
GOSUB *PLACE
MOVE P,P200,Z=0
SO(42)=1
WAIT SI(42)=1
SO(42)=0
WAIT SI(42)=0
GOSUB *PICK
GOTO *ST2
HALT
‘SUB ROUTINE FOR PICK
*PICK:
DO(40)=1
DRIVE(3,P221),S=20
WAIT ARM(3)
DO(40)=0
DELAY 500
RETURN
‘SUB ROUTINE FOR PLACE
*PLACE:
DRIVE(3,P222),S=20
WAIT ARM(3)
DO(40)=1
DELAY 500
RETURN