

'My Yamaha Robot Program
'My Name Is, 01-01-2010
'*************************
'Initialize Program
ARCH 15000 'Round the Corners
MOVE P, P0 'Move Robot to Home Position
RESET MO(20) 'reset flag bit
RESET DO(22) 'reset alarm bit
'
'*************************
'Start Main Loop
*Top:
WAIT DO(25) = 1 'Wait for PLC Start Signal
SET DO(21) 'Send Busy Signal to PLC
MOVE P, P1 'Move Robot to Above Pick Position
FOR Count% = 1 TO 4 'Do Pick and Place 4 Times
MOVE P, P2, A3=0.00 'Arch Move Robot Down to Pick Position
GOSUB *Close_Gripper 'Close Gripper
MOVE P, P4, A3=0.00 'Arch Move Robot just Above Place
GOSUB *Insert_Part 'Call Insert
GOSUB *Reject_Check 'Check if part is jammed and recover
NEXT Count% 'Increment For Loop Counter
MOVE P, P1, A3=0.00 'Move Robot to Above Pick Position
RESET DO(21) 'Turn off Busy Signal to PLC
GOTO *Top 'Return to Top of Loop
'
'*************************
'Sub Routines
*Close_Gripper:
SET DO(20) 'Close Part Gripper
DELAY 500 'Delay / Wait for Gripper to Close
RETURN
'
*Open_Gripper:
RESET DO(20) 'Open Part Gripper
DELAY 500 'Delay / Wait for Gripper to Open
RETURN
'
*Insert_Part:
SPEED 50 'changed global speed to 50%
PSHTIME(3)=2000 'torque is held for 2secs before moving away
PUSH(3,P5),F=25 'move down torque controlled
IF PSHRSLT(3)=1 THEN
MO(20)=1 'set the jammed flag bit
ELSE
MO(20)=0 'not jammed? reset flag bit
ENDIF
SPEED 100 'restore global speed to 100%
PSHFRC(3)=100 'restore torque to 100%
RETURN
'
*Reject_Check:
IF MO(20)=1 THEN
DRIVE(3,0.00) 'Retract Z holding part
MOVE P, P6 'Move to Reject position
GOSUB *Open_Gripper 'Open Gripper
SET DO(22) 'Turn on alarm bit
Count% = 4 'Update For Loop count
ELSE
GOSUB *Open_Gripper 'Open Gripper / Normal
ENDIF
RETURN
Comments
0 comments
Article is closed for comments.