Help with tool change macro
Posted: Mon Apr 15, 2024 11:33 pm
I've been slowly working through some issues and finally have my tool changes almost working. My tool change is 90% in the PLC code and initiated with:
the ATCStage then handles running the tool change and sends a `RST M6_SV`
If you need more I can of course provide it.
My M6 macro file looks like:
for some reason the M5 seems to get skipped over and the spindle tries to go into the tool changer while spinning.
My two questions would be why isn't my M5 stopping the spindle prior to going to Z0?
My second has to do with the fall back since Z 0.0 - Z -2.1(ish) is actually inside the tool changer I need to make sure the spindle is not spinning in that range. I have an input that does track it `ATC_Z_ClearedToolChanger_I` it is enabled when the Z is outside the tool changer and spindle is good to go.
the code:
but not sure how to stop Z axis movement if there's any RPM on the spindle, since there's about 1-2 seconds of spin down this can pass the tool ring while spinning. This causes nothing good to happen.
basically I need something like:
Thanks, I hope this is enough.
Code: Select all
IF M6_SV THEN ChangeToTool_W = SV_TOOL_NUMBER, SET ATCStage
If you need more I can of course provide it.
My M6 macro file looks like:
Code: Select all
;Skip if graphing or searching
IF #4202 || #4201 THEN GOTO 1000
IF #50001 ; Prevent lookahead
M109 /1/2 ; Disable overrides
M5 ; stop spindle
M9 ; Turn off coolant
G28 G91 Z0 ; Move Z to tool change position
M107 ; Send tool number
G4 P.1 ; wait .1 second
M94 /8 ; Set M6_SV to start tool change stage
G4 p1 ; wait 1 second (can I shorten this wait?)
M100 /60018 ; ATCUnlock_O off is locked
M100 /60017 ; ATCMotor_O off
M95 /8 ; reset M6_SV to stop tool change stage when done
N1000 ; end of program
My two questions would be why isn't my M5 stopping the spindle prior to going to Z0?
My second has to do with the fall back since Z 0.0 - Z -2.1(ish) is actually inside the tool changer I need to make sure the spindle is not spinning in that range. I have an input that does track it `ATC_Z_ClearedToolChanger_I` it is enabled when the Z is outside the tool changer and spindle is good to go.
the code:
Code: Select all
; Acroloc Make sure spindle stops before entering tool changer
IF !ATC_Z_ClearedToolChanger_I THEN
RST SpindleEnableOut_O
basically I need something like:
Code: Select all
If !ATC_Z_ClearedToolChanger_I THEN
stop z movement <- how to do this
RST spindleEnableOut_O
If !ATC_Z_ClearedToolChanger_IO && spindle_at_zero_speed THEN
contine z movement <- how to do this