4. Sample program

 

 

[Robot program]

 

1st unit’s RCX40

2nd unit’s RCX142

‘INIT ROUTINE

‘INIT ROUTINE

RESET SO2()

RESET SO2()

RESET SO4()

RESET SO4()

RESET DO4()

RESET DO4()

A=101

B=201

‘MAIN ROUTINE

‘MAIN ROUTINE

MOVE P,P100,Z=0

MOVE P,P200,Z=0

GOSUB *PICK

GOSUB *PICK

*ST1:

*ST2:

MOVE P,P[A],Z=0

WAIT SI(41)=1

GOSUB *PLACE

SO(41)=1

MOVE P,P100,Z=0

WAIT SI(41)=0

SO(41)=1

SO(41)=0

WAIT SI(41)=1

WAIT SI(40)=1

SO(41)=0

B=SI(23,22,21,20)

WAIT SI(41)=0

SO(40)=1

SO(23,22,21,20)=A-100

WAIT SI(40)=0

SO(40)=1

SO(40)=0

WAIT SI(40)=1

B=B+200

SO(40)=0

MOVE P,P[B],Z=0

WAIT SI(40)=0

GOSUB *PLACE

SO(23,22,21,20)=0

MOVE P,P200,Z=0

GOSUB *PICK

SO(42)=1

WAIT SI(42)=1

WAIT SI(42)=1

SO(42)=1

SO(42)=0

WAIT SI(42)=0

WAIT SI(42)=0

SO(42)=0

GOSUB *PICK

A=A+1

GOTO *ST2

IF A>108 THEN

HALT

A=101

‘SUB ROUTINE FOR PICK

DO(47)=1

*PICK:

WAIT DI(47)=1

DO(40)=1

DO(47)=0

DRIVE(3,P221),S=20

ENDIF

WAIT ARM(3)

GOTO *ST1

DO(40)=0

HALT

DELAY 500

‘SUB ROUTINE FOR PICK

RETURN

*PICK:

‘SUB ROUTINE FOR PLACE

DO(40)=1

*PLACE:

DRIVE(3,P121),S=20

DRIVE(3,P222),S=20

WAIT ARM(3)

WAIT ARM(3)

DO(40)=0

DO(40)=1

DELAY 500

DELAY 500

RETURN

RETURN

‘‘SUB ROUTINE FOR PLACE

 

*PLACE:

 

DRIVE(3,P122),S=20

 

WAIT ARM(3)

 

DO(40)=1

 

DELAY 500

 

RETURN

 

5

Specifications

5-13

Page 67
Image 67
Yamaha Yamaha Robot Controller CC-Link Unit, RCX Series Robot program 1st unit’s RCX40 2nd unit’s RCX142, Gosub *PLACE