(M06 - Tool change macro procedure) (#5400 - Current Tool number) (#5409 - Next Tool Number) G10 L81 P200 Q5021 (X)(Save Current Program Position in Registers 200,202) G10 L81 P202 Q5023 (Z) #100=1000 (XY speed) #110=1000 (Z speed) #120=100 (C/Rotation speed) IF [ #5400 EQ #5409 ] 400 (Desired tool is the same as current, goto the End) IF [ #5409 LT 0 ] 400 (Desired tool<0, error, goto the End) ;G53 G90 G0 Z [#5433 - 1.0 ] F#110 (Move to safe position) ;G53 G90 G0 X [#5433 - 1.0 ] F#100 (Move to safe position) (Register 300 to store tool difference) #300= #5409-#5400 if [ #300 GT 0 ] 100 #300=#300+6 (add 6 if next tool less than current tool) N100 #300=#300*60 (multiply 60 degrees) M7 (unlock the drum locker) G91 G0 C5 F#120 (rotate 5 degrees to release the drum lock) G91 G0 C#300 F#120 (move rotate to the next tool) G91 G0 C-5 F#120 (lock the drum by reverse revolving to 5 degrees) M9 (lock the drum locker) G10 L81 P5400 Q5409 (set current tool number) N300 G10 L81 P5400 Q5409 (set current tool number) ;G53 G90 G0 X#200 Z#202 F#100 (Move to initial position stored in registers #200, #202) N400 (The end label)