Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: TTalma on September 09, 2015, 11:05:39 AM
-
Can someone point me to the correct spot for how to write a tool changer script, as well as how to wire it? As well as the best place to ask for help if I need it?
I've made a tool changer for a lathe, and have the controls done except for the interface between mach 3 and the changer.
-
You would have to describe how the turret works and what sensors you have and what the operation sequence would be.
Hood
-
That really doesn't matter. I am using an arduino to control it. Currently I use the serial port to select the tool number (1 though 8 ). If I could use a serial port that would be great, cause then I would be done. How the system works is:
1. Tool changer receives tool number
2. the locking pin is retracted
3. the turret turns to position
4. the locking pin is engaged
I can use any sort of input from Mach 3. Serial, I can clock the number in, I can accept the address of the tool (using 3 lines). The output from Mach 3 really doesn't matter.
I understand it's written in VB. What I need to know is where do I put the file when done, what setup does the file need, What is the list of command that mach3 will accept that are no part of the basic VB library, can it use the standard VB library. I'm just not sure where to look for it.
-
Hi,
have a look for Arduino and Modbus in the forum,
there is a running example for data exchange between
Mach3 and Arduino,
Thomas
-
Just for some additional info, it is the M6Start.m1s macro you need to alter, also on General Config page you need to choose Auto tool change.
I will post the VB I use for my 8pos turret later (once I get back to the workshop) , I use a PLC to do the actual tool positioning so the macro only needs to ask for a tool change and wait for a finished signal. I do it via serial modbus but I dont know if the Arduino supports this or not, so you will have to adapt to suit.
Hood
-
Ok here is the code I have
'Toolchange macro for Computurn 290
tool = GetSelectedTool() Mod 8
SetTool = GetSelectedTool()
Old_tool = GetCurrentTool()
New_Tool = GetSelectedTool()
If tool = 0 Then
tool = 8
End If
Modtoolout = tool - 1
If Tool < 11 then
ModtoolIn = tool - 1
Else
ModtoolIn = tool + 28
end if
If New_Tool = Old_Tool Then 'If selected tool is the same as current tool then end macro
End
End If
Do
Call SetModOutput (Modtoolout,1)
If GetInput (ModtoolIn) Then Exit Do
Loop
SetCurrentTool( Tool )
sleep 10
Call SetModOutput (Modtoolout,0)
Sleep 1000
If GetInput(42) Then
Message ("Toolchange Complete")
Else
MsgBox( "Turret failed to clamp, Programme stopped")
DoOemButton(1003)
End If
Probably the last bit is most relevant, the middle section is just to set the correct values for the Mobus output required.
Hood
-
Thanks guys this is exactly the info I was looking for.
Hood, your macro looks like it will work for my system with only a little modification.
Thanks again. Hopefully I'll have everything working in the next couple of weeks. I plan to post everything, My idea should be pretty simple to build if anyone else wants to copy or improve it.