User Tools

Site Tools


mycnc:m6_tool_change_macro:m6_tool_change_macro

This is an old revision of the document!


M6 Tool Change Macro

T-code of G-codes has higher priority than M6. For a command

M6T2

T2 will be executed first, then M6.

T1 … T99 are defined as macros in myCNC software. T-macro normally contains jsut 1 line to setup Global register #5409 - The Next Tool Number. Examples -

T1
G10 L80 P5409 Q1
T2
G10 L80 P5409 Q2
T3
G10 L80 P5409 Q3
T4
G10 L80 P5409 Q4
T5
G10 L80 P5409 Q5
T6
G10 L80 P5409 Q6

As a result, M6 macro procedure has information about both

  • Current Tool Number #5400 and
  • The Next Tool Number #5409

and able to handle correct Tool change

Beside tool changing operations M6 macro should have code line at the End of the macro to change The Current Tool Number Register itself.

G10 L81 P5400 Q5409 (Copy value from "Next Tool Number" to "Current Tool Number")

If The Current Tool Number register changed the myCNC control applies all offsets and Tool Length for new Tool Number

M06 Tool Change for Lathe/Turning machine (v1)

  • Lathe machine has drum-style Tool changer for 6 tools.
  • The drum rotated by stepper driver/motor. The driver connected to C-axis of a myCNC controller.
  • The drum has a Home sensor to find the initial position.
  • The drum rotated in positive (CCW) direction only.
  • The drum should be rotated in opposite direction to 5 degrees to lock it.
M6
(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)
mycnc/m6_tool_change_macro/m6_tool_change_macro.1522938996.txt.gz · Last modified: 2018/04/05 10:36 by skirillov

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki