Hi,
I have prepared an M6 compatible ATC macro for a test, it shows the error message "not allowed in state HW-V" What is the meaning?
Thanks,
Some of the M6 macro is below, it did not let me attach it, it is simply a test for now w/2 tools.
;This example shows how to make your own tool_changer work.
;It is made for 6 tools
;First current tool is dropped, then the new tool is picked
;There is a check whether selected tool is already in the spindle
;Also a check that the tool is within 1-6
;There is a picktool subroutine for each tool and a droptool subroutine for each tool.
;These routines need to be modified to fit your machine and tool changer
sub change_tool
;Switch off guard for tool change area collision
TCAGuard off
;Check ZHeight comp and switch off when on, remember the state in #5019
;#5151 indicates that ZHeight comp is on
#5019 = #5151
if [#5019 == 1]
ZHC off
endif
;Switch off spindle
m5
;Use #5015 to indicate succesfull toolchange
#5015 = 0 ; Tool change not performed
; check tool in spindle and exit sub
If [ [#5011] <> [#5008] ]
if [[#5011] > 2 ]
errmsg "Please select a tool from 1 to 2."
else
;Drop current tool
If [[#5008] == 0]
GoSub DropTool0
endif
If [[#5008] == 1]
GoSub DropTool1
endif
If [[#5008] == 2]
GoSub DropTool2
;Pick new tool
if [[#5011] == 0]
GoSub PickTool0
endif
if [[#5011] == 1]
GoSub PickTool1
endif
if [[#5011] == 2]
GoSub PickTool2
endif
endif
else
msg "Tool already in spindle"
#5015 = 1 ;indicate tool change performed
endif
If [[#5015] == 1]
msg "Tool "#5008" Replaced by tool "#5011" G43 switched on"
m6t[#5011]
if [#5011 <> 0]
G43 ;we use tool-length compensation.
else
G49 ;tool length compensation off for tool 0.
endif
else
errmsg "tool change failed"
endif
;Set default motion type to G1
g1
;Switch on guard for tool change area collision
TCAGuard on
;Check if ZHeight comp was on before and switch ON again if it was.
if [#5019 == 1]
ZHC on
endif
EndSub
;Drop tool subroutines
Sub DropTool0
;Tool 0 is nothing, we could open the tool
;magazine here if needed for the following PickTool
msg "Dropping tool 0"
;Tool 0 is no tool, so we just open yhe tool station here for PickTool which comes next
M54P3 ;Open toolstation OUTPUT AUX3
G4P1 ;Wait 1 seconds
endsub
Sub DropTool1
msg "Dropping tool 1"
M5
G53G0Z-2 ;Z up 110 is and machinebed is zero
G53G0X400Y120 ;Move just before drop place
M54P3 ;Open toolstation
G4P01 ;Wait 1 seconds
G53G1X400Y121F220 ;Move into drop place
g53G0Z-3 ;Move down fast but not fully to the endposition
g53G01Z-4F120 ;Move down the last mm slower
M54P1 ;AUX1 ON air pressure toolchange
G4P1 ;Wait 1 second
G53G01Z-2f100 ;Move up slowly to move free from toolstation
M55P1 ;AUX1 off, tool dropped
G53G0Z-1 ;Further up and done with dropping tool
endsub
Sub DropTool2
msg "Dropping tool 2"
M5
G53G0Z-2 ;Z up 110 is and machinebed is zero
G53G0X400Y120 ;Move just before drop place
M54P3 ;Open toolstation
G4P01 ;Wait 1 seconds
G53G1X400Y121F220 ;Move into drop place
g53G0Z-3 ;Move down fast but not fully to the endposition
g53G01Z-4F120 ;Move down the last mm slower
M54P1 ;AUX1 ON air pressure toolchange
G4P1 ;Wait 1 second
G53G01Z-2f100 ;Move up slowly to move free from toolstation
M55P1 ;AUX1 off, tool dropped
G53G0Z-1 ;Further up and done with dropping tool
endsub
;Pick tool subroutines
Sub PickTool0
msg "Picking tool 0" ;Tool 0 is nothing, just close the tool station
M55P3 ;OUT3 off, closes toolstation
#5015 = 1 ;toolchange succes
endsub
Sub PickTool1
msg "Picking tool 1"
M5 ;Be sure that spindle is off
G53G0Z-1 ;Z up where zero is machinebed and 110 is top
G53G0X400Y125.00 ;Move before pick place
M54P3 ;Open toolstation
G4P01 ;Wait 1 second
G53G1X400Y125F220 ;Move into pick place
G53G0Z-2 ;Move down fast but not fully to the end
M54P1 ;AUX1 ON for opening collet clamp
G4P01 ;wait 1 second
G53G01Z-3F120 ;Move down last mm down slower to pick up toolholder
G4P0.5 ;Wait 1 second
M55P1 ;AUX1 off, tool picked
G53G01Z-2F120 ;Move slowly up to pick up tool and move free
G53G0X400Z-1 ;Further up and done with dropping
M55P3 ;OUT3 off, closes toolstation
#5015 = 1 ;toolchange succes
endsub
Sub PickTool2
msg "Picking tool 2"
M5 ;Be sure that spindle is off
G53G0Z-1 ;Z up where zero is machinebed and 110 is top
G53G0X400Y125.00 ;Move before pick place
M54P3 ;Open toolstation
G4P01 ;Wait 1 second
G53G1X400Y125F220 ;Move into pick place
G53G0Z-2 ;Move down fast but not fully to the end
M54P1 ;AUX1 ON for opening collet clamp
G4P01 ;wait 1 second
G53G01Z-3F120 ;Move down last mm down slower to pick up toolholder
G4P0.5 ;Wait 1 second
M55P1 ;AUX1 off, tool picked
G53G01Z-2F120 ;Move slowly up to pick up tool and move free
G53G0X400Z-1 ;Further up and done with dropping
M55P3 ;OUT3 off, closes toolstation
#5015 = 1 ;toolchange succes
endsub