586,052 active members*
3,935 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Mach Software (ArtSoft software) > M6 Command only works one time now with new computer setup
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2005
    Posts
    344

    M6 Command only works one time now with new computer setup

    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 with Mach3 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 one use. Nothing but a computer reboot will make it work again (and then it still works just once). 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).
    I did not change the M6Start file from what was working before, it was just copied and pasted in on the new computer. It works fine once, but only once, and then no more M6....Other M codes still work and the machine still jogs, and seamingly works fine otherwise.
    I am stuck until this is figured out and I am not sure what else I can try.

    See this post for more explanation and history and my macro:

    Macro for turret tool change on Z axis

  2. #2
    Join Date
    Feb 2005
    Posts
    344
    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

Similar Threads

  1. best computer setup for EMC?
    By RP Designs in forum LinuxCNC (formerly EMC2)
    Replies: 10
    Last Post: 03-24-2012, 03:34 AM
  2. Time delay command for tool changer?
    By greeder88 in forum LinuxCNC (formerly EMC2)
    Replies: 18
    Last Post: 05-15-2009, 10:46 AM
  3. time for new computer
    By goofin in forum Mach Software (ArtSoft software)
    Replies: 5
    Last Post: 02-13-2008, 04:47 AM
  4. Canadian seeking machining/computer setup
    By halton tool in forum Community Club House
    Replies: 2
    Last Post: 09-26-2006, 04:59 PM
  5. CNCZone Computer setup
    By PEU in forum Community Club House
    Replies: 0
    Last Post: 01-10-2006, 04:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •