M6 execution if valid tool is loaded in spindle

More
4 years 9 months ago #232550 by MichalHK
Hi,

I would ask how to check that tool must be changed? I have M6 remapped and random tool changer.
My M6 code work grat If I call M6 tool is changed. But problem si that Gcode program have only one tool for using.

For example
G54
T1
M6
some milling
M30

If I run program first all is OK. But second run of this couses me change tool for another that I have in pocket so I start milling with different tool.
So I need some condition that tall me, yes change tool, or no correct tool is in spindle, dont change tool.

Thanks for ideas

Please Log in to join the conversation.

More
4 years 9 months ago #232569 by cmorley
we need more information. Linuxcnc usual does as you want by default.
We need to see your remap.

I don't understand if you run the program again you get a different tool.

Please Log in to join the conversation.

More
4 years 9 months ago #232608 by MichalHK
Ok here is my ini hal and toolchange file. Yes if I run program again tool is changed becouse M6 change it.

Please Log in to join the conversation.

More
4 years 9 months ago #232620 by cmorley
Ok it would be helpful to explain the remap code - it looks quite complicated.

Please Log in to join the conversation.

More
4 years 9 months ago #232625 by MichalHK
I do some photos of machine for better explanation and rewrite toolchange into english language. There is no magic.
At the start I reset iocontrol.0.tool-changed (M65 P8)
Then simple setting hydraulic valve for tool arm moving by M64 and M65 commands and checking induction sensors by M66 command.
If tool change is succesful I set M64 P8 whitch is iocontrol.0.tool-changed

I think there is no mistake. Tool change macro works great. But I dont understand why linuxcnc call M6 if Im set correct tool in spindle.

 

Please Log in to join the conversation.

More
4 years 9 months ago #232630 by MaHa
You can try this at the beginning of o<toolchange>
But program will start immediately, otherwise you need to insert a message and M0 also.
Code:
o100 IF [#<selected_tool> EQ #<tool_in_spindle>] o<toolchange> RETURN [1] o100 ENDIF

Please Log in to join the conversation.

Time to create page: 0.924 seconds
Powered by Kunena Forum