Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: mc on February 25, 2014, 06:29:58 PM

Title: ATC and selecting tool issue
Post by: mc on February 25, 2014, 06:29:58 PM
I'm finally getting around to finishing of my cyclone, but during testing various things, I've discovered an issue with selecting tools.

If I issue a full tool change command i.e.T0101, things work fine, however if I command an abreviated version i.e. T01, then it requests tool 0 which is invalid (it has also highlighted an issue with my PLC logic, but that's another issue).
Is this how Mach turn usually works?
Or have I missed something?

Here's my toolchange macro-
Code: [Select]
oldtool = GetUserDRO(1202) 'Get the current tool position (we could use GetCurrentTool, but UserDRO1202 is updated directly from KFLOP via the macropump)
newtool = GetSelectedTool() 'Get the new tool position
if oldtool = newtool Then 'if we've already got the requested tool loaded
End 'then we can quit this macro without doing anything
End If
ActivateSignal(Output10) 'this activates the tool change allowed signal from the KFlop to PLC (KFlop bit 144 - Port2Pin16)
SetOEMDRO(1006,newtool) 'transfer the new tool position to the OEMDRO (transfers to KFlop persist, where it gets transferred via MODbus to the PLC)
NotifyPlugins(19006)
While Isactive(Input1) 'wait for tool changer OK signal to turn of (this is so we know the new tool position has been transfered)
Wend
While not Isactive(Input1) 'then wait for tool change ok signal to turn back on - KFlop bit 141/port2pin13
Wend
DeactivateSignal(Output10) 'turn of tool change allowed signal
SetCurrentTool(newtool)
End
I'm using a KFlop, which communicates with a PLC via modbus to control the toolchanger.
I've checked and the KFlop is being sent a request for position 0, so I'm sure this is something Mach is doing.


One other quick question while I'm here.
If I add code into the Macro to check for a valid position, what code is needed to halt the current program if an invalid position is requested?
i.e.
If newtool < 1 or newtool > 6   Then
   What goes here to bring everything to a halt?
End If
Title: Re: ATC and selecting tool issue
Post by: Hood on February 25, 2014, 07:10:30 PM
Never called t01 or the likes before on the lathes but in simulation here it does seem to set Tool 0, I am not sure what would happen on the big lathe with the macro I have but if I get a chance I will test tomorrow.

regarding the VB, something as simple as below should work, the message box being added just so you know what went wrong.

DoOemButton(1003)
MsgBox "Tool call out of range"

Hood
Title: Re: ATC and selecting tool issue
Post by: mc on February 26, 2014, 04:31:45 PM
Thanks for that.

It's probably bad habit on my part, as I just type T0 via the MDI on the small lathe prior to moving everything to zero with a G0 prior to shutting it down.
Now I think about it, I can't remember trying anything above T0, as all the other tool changes are done in the g-code files.


I'll add that code into my M6 macro as a safety net, but I still need to sort out the PLC. If a T0 is commanded, the changer starts spinning endlessly even when the tool change allowed signal is removed, and the only way to stop it is to stop the PLC, or send a valid tool number and cycle the change allowed signal which has to be done directly via the KFlop Kmotion manual controls. I thought I had a sanity check in the ladder, but I''ve obviously missed something :-/
Title: Re: ATC and selecting tool issue
Post by: Hood on February 26, 2014, 04:57:58 PM
I tested it out today and sure enough it set the tool and offset to zero, unlikely that is by design.

Hood