Hello Guest it is March 19, 2024, 01:27:03 AM

Author Topic: M6 Command only works one time now with new computer setup  (Read 3178 times)

0 Members and 1 Guest are viewing this topic.

Offline jevs

*
  •  315 315
    • View Profile
M6 Command only works one time now with new computer setup
« on: February 12, 2013, 11:30:39 PM »
I finally got my machine up and running and now my M6 command will only work one time. I know the Mach3 I have now is a newer version than when I created the macro. Did something change that it will no longer work now or any ideas why this is happening? Other command still work and everything else still works, just the M6 stops working after once use. Nothing but a computer reboot will make it work once again. Restarting mach does not make it work again, and even restarting the smoothstepper and then restarting mach will not make it work again. A reboot will though (once).

See this post for more explanation and to see my macro:

http://www.machsupport.com/forum/index.php/topic,18069.0.html

Offline jevs

*
  •  315 315
    • View Profile
Re: M6 Command only works one time now with new computer setup
« Reply #1 on: February 14, 2013, 12:50:50 AM »
Solved!

What was happening is that I was just typing in M6 and the first time you do this my macro had no idea what the "GetSelectedTool" Value was since no tool had ever been selected since last boot up. I assume this defaults the value to 0 which would initiate the "Invalid tool chosen..." question. Upon the next time only M6 was entered it would ignore it because it would have the last good tool number used set as the "GetSelectedTool" Value so it would not initiate the question and just beep with seemingly nothing happening. It has been so long I forgot you should specify the tool number as a T# and I was trying either a M6 which would do something only the first time, or I was typing in M6 5 and forgetting that I need a T in front of the tool number (dumb I know).

Anyway, I solved all this so you always know what is going on by adding a message "Tool already loaded or tool not specified with T# (ex:M6 T4)" . This pops up if you select the same tool number that is already loaded or if you do not use a "T" command to designate a different tool. So now even if I do not use this for a very long time I will be reminded of what I am doing wrong.

Here is the updated Macro:
 
'Tool change macro for 7 tool turret
Sub Main()
   'Sets variable OldTool to what is currently loaded
   OldTool=GetCurrentTool()
   
   'Sets Variable MaxToolNum to the max number of tools possible
   MaxToolNum=7
   
   'Sets variable Newtool to the one being selected with M6 T#
   NewTool=GetSelectedTool()   
   
   'Get positions before moving to do tool change
   x = GetToolChangeStart( 0 )
   y = GetToolChangeStart( 1 )
   z = GetToolChangeStart( 2 )
   a = GetToolChangeStart( 3 )
   b = GetToolChangeStart( 4 )
   c = GetToolChangeStart( 5 )
   
   'If the current tool loaded is 0 or greater than 7 then tool has been lost
   'so need to ask what tool is currently loaded
   While OldTool=0 Or OldTool>7
   OldTool=Question ("Current tool unknown, enter tool in spindle 1 to " & MaxToolNum)
   Wend
   
   'Sets CurrentTool to Oldtool in case it was lost and entered above
   SetCurrentTool(OldTool)

   'When the tool asked for is invalid then this makes you select a valid tool
   While NewTool > MaxToolNum Or NewTool <1
   NewTool = Question ("Invalid tool chosen, enter tool number 1 to " & MaxToolNum)
   Wend
   
        'If the tool asked for is the same one that is already loaded then exit macro
   If NewTool=OldTool Then
   Message "Tool already loaded or tool not specified with T# (ex:M6 T4)"
      Exit Sub
   End If

'Turn off soft limits if they are on
If GetOEMLED(23) Then
DoOEMButton(119)
End If

'Moves To Z home from where ever it is
code "G53G0Z0"
While IsMoving()
Wend

'Sets ChangeNums to 0 for safety in case it is not at 0
ChangeNums=0

'Makes the magic happen and moves the proper number of times if new tool is higher than old
If NewTool>OldTool Then
   For ChangeNums=1 To NewTool-OldTool
   
   'Moves Z axis to the top of tool change
   code "G53 G1 F70 Z5.800"
   While IsMoving()
   Wend

   'Moves back to bottom of tool change area
   code "G53 G1 F70 Z3.8"
   While IsMoving()
   Wend
   
   Next
   
'Makes the magic happen and moves the proper number of times if new tool is lower than old   
Else
   For ChangeNums=(OldTool-NewTool) To 6
   
   'Moves Z axis to the top of tool change
   code "G53 G1 F70 Z5.800"
   While IsMoving()
   Wend

   'Moves back to bottom of tool change area
   code "G53 G1 F70 Z3.8"
   While IsMoving()
   Wend
   
   Next
End If

'Move Back to Z Home
code "G53 G1 F70 Z0"
While IsMoving()
Wend
   
'Should be a succesful tool change at this point so this sets the NewTool as the current tool
SetCurrentTool(NewTool)

'Turn back on soft limits
DoOEMButton(119)
End Sub           

Offline rcaffin

*
  •  1,052 1,052
    • View Profile
Re: M6 Command only works one time now with new computer setup
« Reply #2 on: February 14, 2013, 04:58:04 AM »
Quote
I finally got my machine up and running and now my M6 command will only work one time.
Methinks you are running a lathe?
M6 (comment) works just fine many times for the mill.

Cheers

Offline jevs

*
  •  315 315
    • View Profile
Re: M6 Command only works one time now with new computer setup
« Reply #3 on: February 14, 2013, 08:33:36 AM »
Quote
I finally got my machine up and running and now my M6 command will only work one time.
Methinks you are running a lathe?
M6 (comment) works just fine many times for the mill.

Cheers


Not sure what you mean, as you see above I already solved this :)

Offline rcaffin

*
  •  1,052 1,052
    • View Profile
Re: M6 Command only works one time now with new computer setup
« Reply #4 on: February 14, 2013, 03:49:18 PM »
Quote
Not sure what you mean, as you see above I already solved this :)

Well, yes, I can see that, BUT...
For my mill I use the shipped M6 macros to change a tool. No problem. (No ATC either - sigh.)
For my lathe I use Tn0n to change from one fixed tool post to another, with no M6 at all. Extremely simple.
So I was wondering at the complexity.

Cheers