Help with tool change macro

All things related to Centroid Oak, Allin1DC, MPU11 and Legacy products

Moderator: cnckeith

Post Reply
TD-4242
Posts: 27
Joined: Sun Apr 12, 2020 11:03 am
Acorn CNC Controller: No
Allin1DC CNC Controller: Yes
Oak CNC controller: No
CNC Control System Serial Number: KI04039
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Contact:

Help with tool change macro

Post by TD-4242 »

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:

Code: Select all

IF M6_SV THEN ChangeToTool_W = SV_TOOL_NUMBER, SET ATCStage
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:

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
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:

Code: Select all

; Acroloc Make sure spindle stops before entering tool changer
IF !ATC_Z_ClearedToolChanger_I THEN
  RST SpindleEnableOut_O
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:

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
Thanks, I hope this is enough.


cncsnw
Posts: 4090
Joined: Wed Mar 24, 2010 5:48 pm

Re: Help with tool change macro

Post by cncsnw »

M5 generally just means "begin stopping the spindle", i.e. turn off the run-forward and run-reverse commands. A typical M5 does not sit around and wait for the spindle to finish decelerating to a stop.

You can, of course, add that. The simplest way is to configure and wire a "zero speed" signal from your VFD to a PLC input. Then you can write an M101 wait into whatever CNC codes you want, to ensure that the spindle is stopped before proceeding with the next step.

Since all of the Z movement is done by commands in the CNC macro, it makes sense to break the move into two parts:

Code: Select all

M5  ; begin stopping the spindle
G53 Z__   ; move Z to just short of the tool changer
M101/__   ; wait there until the spindle is fully stopped
G53 Z__   ; move Z the rest of the way up into the tool changer
Of course you can use G28 and G30 instead of G53, if you prefer.

The PLC program has very limited ability to pause axis motion. While it is theoretically possible to trigger Feed Hold, and then do a Cycle Start to resume motion, that logic ends up being either very convoluted, or not entirely reliable, or both. Setting the feedrate override to some low value is also possible, but has comparable pitfalls. Better to just have an appropriate wait in the CNC macro, prior to moving into the area of concern.


If your current macro does not appear to even begin stopping the spindle before Z moves up into the tool changer, that is probably because, by default, CNC12 moves Z to home (to the G28 position) on any line containing an M6, before it even starts running the M6 macro file. You can prevent that by setting bit 3 of Parameter 10 (i.e. add 8); and/or (probably better) you could set your G28 Z position down below the tool changer.


TD-4242
Posts: 27
Joined: Sun Apr 12, 2020 11:03 am
Acorn CNC Controller: No
Allin1DC CNC Controller: Yes
Oak CNC controller: No
CNC Control System Serial Number: KI04039
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Contact:

Re: Help with tool change macro

Post by TD-4242 »

The original MX-1 controller had a very noticeable stop of the Z when `ATC_Z_ClearedToolChanger_I` turns off just prior to it entering the tool changer.

While I can update the M6 macro to solve the happy path of M6 working. I would still have the risk of a spindle running at speed and something run the Z axis to anywhere between Z0 and Z-2.0 and it unhooking a spinning tool. This was known on Acrolocs to leave a tool bouncing around the coolant pan and requiring the operator to change pants. Also possibly damage the tool carousel.

to see the non-standard tool changer design in action I did this video a few years ago
Jumped to the end where it just shows the tool changer running:



cncsnw
Posts: 4090
Joined: Wed Mar 24, 2010 5:48 pm

Re: Help with tool change macro

Post by cncsnw »

In that case you probably want your PLC program to trigger an immediate Fault if the monitoring switch is tripped and the spindle zero-speed signal is not closed.


cncsnw
Posts: 4090
Joined: Wed Mar 24, 2010 5:48 pm

Re: Help with tool change macro

Post by cncsnw »

You might also want to configure the machine to home using the monitoring switch as a home switch, so that machine zero on the Z axis is just below the carousel.

In your tool-change macro you can set the Z+ software travel limit to a non-zero value (e.g. +2.10") to allow movement above machine zero during the tool change; then you can restore the Z+ software travel limit to zero when the tool change is complete.


TD-4242
Posts: 27
Joined: Sun Apr 12, 2020 11:03 am
Acorn CNC Controller: No
Allin1DC CNC Controller: Yes
Oak CNC controller: No
CNC Control System Serial Number: KI04039
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Contact:

Re: Help with tool change macro

Post by TD-4242 »

cncsnw wrote: Tue Apr 16, 2024 12:31 pm You might also want to configure the machine to home using the monitoring switch as a home switch, so that machine zero on the Z axis is just below the carousel.
I've been thinking about this as a good start too.
In your tool-change macro you can set the Z+ software travel limit to a non-zero value (e.g. +2.10") to allow movement above machine zero during the tool change; then you can restore the Z+ software travel limit to zero when the tool change is complete.
I'll see what I can do with this tonight when I get home.


Post Reply