.PROGRAM main() REACTI (1001), sub.gate ; Check the safety gate input continuously FLASH=0 ; Initialize "flash" variable OPENI ; Default position for the gripper RESET DEPART 100 ; Prepare to move to #home MOVE #home ; Start program at this precision location FOR a = 0 TO 1 FOR b = 0 TO 3 SET sdrop = SHIFT(drop BY b*49, -a*59, 0) ; Shifted locations CALL sub.load() ; Load the pallet with parts END END MOVE #home WAIT SIG(1034) ; Wait for button before proceeding TYPE /C20, /X10, "Push green button to unload parts", /C20 FOR c = 0 TO 1 FOR d = 0 TO 3 SET sdrop = SHIFT(drop BY d*49, -c*59, 0) ; Shifted locations CALL sub.unload() ; Unload parts from the pallet END END MOVE #home ; End program at this pecision location TYPE /C20, /X10, "Program finished - Eight parts moved into hopper", /C20 .END .PROGRAM sub.gate() DETACH () ; No power to the robot TYPE /C20, /X20, "The safety gate has become open!", /C20 10 CALL sub.flasher IF SIG(1001) GOTO 10 ; Loop if gate still open TYPE /C20, /X25, "Safety gate closed" ; Continue program if closed TYPE /X20, "Workcell was open for ", FLASH, " seconds." TYPE /X24, "Waiting for green button...", /C20 WAIT SIG(1034) ; Wait for button confirmation before proceeding ATTACH () ; Reactivate power to the robot REACTI (1001), sub.gate ; Reactivate the safety gate SPEED SPEED(3) MOVE DEST ; Go back to the main program RETURN .END .PROGRAM sub.flasher() FLASH=FLASH+1 ; Increment variable each time this loops SIG 34 ; Flash this output on then off WAIT.EVENT , 0.5 SIG -34 WAIT.EVENT , 0.5 RETURN .END .PROGRAM sub.load() ; Moves 8 parts from the loader into the pallet. APPRO pick, 40 SIG 38 ; Extend the loader piston WAIT.EVENT, 1.5 IF SIG(-1040) THEN ; If prox switch is empty, goto sub.NOPARTS CALL sub.nopats() END ; If part in position, extend piston and continue v v v SPEED 20 MOVES pick BREAK CLOSEI ; Grab the part SIG -38 ; Retract the piston DEPART 100 ; Remove part from the loader APPRO sdrop, 40 SPEED 20 MOVES sdrop BREAK OPENI ; Let the part go DEPART 60 RETURN ; One part moved from loader to pallet. .END .PROGRAM sub.noparts() ; Use this program to feed additional parts through the loader. SIG -38 ; The piston is still extended - retract it now 70 TYPE /C20, /X15, "Load more parts into the piston..." TYPE /X20, "Push 1038 to actuate piston.", /C20 WHILE SIG(1038) DO SIG 38 ; Piston extended as long as switch pressed END SIG -38 ; Retract piston when switch released IF SIG(-1040) GOTO 70 ; if loader still empty, loop and do again TYPE /C20, /X10, "Part loaded - program proceeding...", /C20 RETURN .END .PROGRAM sub.unload() ; Moves 8 parts from the pallet to the hopper. APPRO sdrop, 60 SPEED 20 MOVES sdrop BREAK CLOSEI ; Grab the part DEPART 100 ; Remove the part from pallet MOVE hopper BREAK OPENI ; Let the part go RETURN .END .LOCATIONS drop 0.986443102 -0.164103657 0 -0.164103657 -0.986443102 0 0 0 -1 391.981323242 -500.673736572 863.316711426 #home -27.958593369 119.3828125 5.398309708 115.184768677 hopper 0.964565277 -0.263844252 0 -0.263844252 -0.964565277 0 0 0 -1 556.110168457 -489.142974854 863.316711426 pick -0.528752863 0.848775864 0 -0.848775864 -0.528752863 0 0 0 -1 229.09526062 424.637481689 756.860290527 .END .REALS a 2 b 4 c 2 d 1 FLASH 0 .END .DOUBLES .END .STRINGS .END