Hello Guest it is January 19, 2020, 12:37:16 PM

Author Topic: Tool changer macro help  (Read 9140 times)

0 Members and 1 Guest are viewing this topic.

Tool changer macro help
« on: April 08, 2007, 01:01:21 AM »
Hi All
 I can't seem to get Mach3 2.00.061 to wait for my plc to change the tool when the config screen is set to automatic tool changer. It works fine if I set it to stop spindle and wait but I have to be there to push the cycle start after each tool change is complete. Any help would be much appreciated, Here is my m6start.m1s macro.



Num_Positions = 16
Code ("G53 g0 z0")
While IsMoving()
Wend
'SystemWaitfor ( INPUT4 )'toolchange complete signal
OldTool = GetOemDRO (1200) 'Tool In spindle DRO
While OldTool > Num_Positions Or OldTool <= 0     ' Check for a valid tool   
OldTool = Question ("Invalid Tool , Current Tool Number?")   
Wend
tool = GetSelectedTool() 
While Tool > Num_Positions Or Tool <= 0 ' Check for a valid tool   
Tool = Question ("Invalid Tool Requested, New Tool Number?")   
Wend   
NewTool = Tool
If NewTool = OldTool Then
   Exit Sub
End if
ToolDif1 = NewTool - OldTool 
ToolDif2 = OldTool - NewTool
If ToolDif1 < ToolDif2 Then
CarMove = ToolDif2
ActivateSignal( 8 )           'set carrosel to turn cw
Else
CarMove = ToolDif1
DeActivateSignal( 8 )         'set carrosel to turn ccw
End If
setmodoutput ( 64 , CarMove ) ' set plc counter to rotate number of positions
ActivateSignal( 9 )           ' activate toolchange
While IsActive (20)           ' wait for counter
Wend
DeActivateSignal( 9 )         ' insert tool and retract
Call SetUserDRO (1200,NewTool) 


Thanks
Steve
SKFab             
 

Offline poppabear

*
  • *
  •  2,233 2,233
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: Tool changer macro help
« Reply #1 on: April 08, 2007, 09:33:05 AM »
You need to put your "SystemWait()" at the END of your Macro, in where your PLC can send a "tool change done bit" to you input 4
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/
Re: Tool changer macro help
« Reply #2 on: April 08, 2007, 01:23:01 PM »
Thanks I will give that a try later today. MY tool change bit is only on about .5 second after the tool change is this ok?
Re: Tool changer macro help
« Reply #3 on: April 09, 2007, 01:08:25 AM »
I got it to work by putting a pause after the (g53 g0 z0) that let the plc engage and lockout the input1. I could not get SystemWaitFor ( INPUT4 ) to let the system go even with the input signal working. Is there additional code that goes with systemwaitfor ()  that makes it work?

Offline poppabear

*
  • *
  •  2,233 2,233
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: Tool changer macro help
« Reply #4 on: April 09, 2007, 11:27:05 PM »
Swap you active hi/low setting on imput4 and see if you see it then, when input 4 is active, and see if systemwait drops out.
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/