Hello Guest it is April 16, 2024, 07:00:46 AM

Author Topic: Tool changer routine with hot swap  (Read 34555 times)

0 Members and 1 Guest are viewing this topic.

vmax549

*
Re: Tool changer routine with hot swap
« Reply #70 on: March 28, 2008, 02:47:15 PM »
HI IAN,     I am quickly starting to SEE the simplicity of YOUR solution (:-) (;-) If I can just figure out how to make it UPdate the dros on the page but yet work like your solution.

(;-) TP

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Tool changer routine with hot swap
« Reply #71 on: March 28, 2008, 03:30:06 PM »
Hi Terry

No problem. I order by tool, you order by slot. Just loop through my tools and read each slot. Then use the slot to index the appropriate DRO.

e.g.

assuming your first gcode var is #1000 and your slot 1 DRO number is 1000 AND that you use consecative vars and DROs (which would be weird if you didn't)

numTools=8
gcodeVarBase=999 (or whatever i.e. 1 less than the first you use)
droBase=999 (or whatever i.e. 1 less than the first you use)

for tool = 1 to numTools
  slot = GetVar(gcodeVarBase + tool)
  SetUserDRO(droBase + slot, tool)
next

Ian

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Tool changer routine with hot swap
« Reply #72 on: March 28, 2008, 04:42:03 PM »
Very Nice work!!

Here is a pic of the ATC setup page on my "Night Vision" flash Screens, it is set up for the Swap Arm type ATC.

Scott
fun times

vmax549

*
Re: Tool changer routine with hot swap
« Reply #73 on: March 28, 2008, 05:19:20 PM »
Scott that is a really nice looking page.

IAN, I think I am lost BUT, mach is crashing the vb and program run and mdi so I can't tell if it is me or mach that is crazy.

I guess I will have to wait untill Brian sorts this out OR back up to an OLD version. 

I am not sure if I have the last piece of the code in the right place yet. I beat on it for a while then change it and beat on it some more.(;-)

(;-) TP

vmax549

*
Re: Tool changer routine with hot swap
« Reply #74 on: March 28, 2008, 06:20:03 PM »
OK I have the tool changer INITIALIZATION Button working , I can load up the tool slots and push the button and set all the neccasary VARS correctly.

THe hotswap is still eluding me brain.  One thing I noticed is that when I remove a tool from the slot it needs to reset to zero until the next cycle occurs where it gets set back to the returned tool number. That will show the slot vacant when a tool is in the spindle. THat way IF I have to stop incycle the tool slots will be correct and SHOW the empty slot.

(;-) TP

vmax549

*
Re: Tool changer routine with hot swap
« Reply #75 on: March 28, 2008, 09:11:53 PM »
YEP just as I thought, Hopelessly lost in LOGIC again(;-) I have tried various ways that I could think of to tie it together but NOT.



THe original intention was to fill in the dros on the page to match up the slots and tool#. Then press the initialize Button to set the system VARs .

In A program the first T# would set the Next Tool Up dro. Then the m6start will transfer the NTU over to the Tool In Spindle dro. As the next T3 is read it will again fill in the NTU dro. As the NTU dro changes then the BRAINS will trigger a holding relay to RELEASE and start a motor to turn the carousel. The Brains will then monitor the encoder on the carousel untill it sees the proper ID code then STOP the motor and lock the carousel in position.

THen the m6start macro would do the actual swap based on the t#s being held by the
macro

So far i have everything working BUT the actual hotswapping of the DROs.

Listed are the parts of the m6start macro I have to work with: THe brains part I have not listed.

********************************************************************************


********************************************************************************


Tool = GetSelectedTool()                 '* Original code in M6start from mach
Setcurrenttool(tool)
Setuserdro(1300,tool)

'***************************************************************

Option Explicit                                 '* Code to run hotswap

Const numTools=8

Dim currentTool As Integer
Dim selectedTool As Integer
Dim selectedSlot As Integer
Dim crlf As String
Dim msg As String
Dim i As Integer

                                                          ' what is the selected tool?
selectedTool = GetSelectedTool()

                                                          ' in which slot in the carousel is the  required tool?

selectedSlot = GetVar(1000 + SelectedTool)

                                                            ' remind ourselves what the current tool  is
currentTool = GetVar(1000)

                                                            ' stick the current tool in the selected tool's slot

SetVar(1000 + currentTool, selectedSlot)

                                                             ' remember for next time which tool we're   now using
SetVar(1000, selectedTool)

                                                             ' tell Mach which tool is selected
SetCurrentTool( selectedTool )

                                                              ' dump the carousel state for our reading    Pleasure
crlf = Chr(13) & Chr(10)

If currentTool = 0 Then
  msg = "Getting tool " & selectedTool & " from slot " & selectedSlot
Else
  msg = "Swapping tool " & currentTool & " for tool " & selectedTool & " in slot " & selectedSlot
End If

msg = msg & crlf & crlf

'for each tool
For i=1 To numTools
  If i = selectedTool Then
    msg = msg & "Tool " & i & " is in the spindle" & crlf
  Else
    msg = msg & "Tool " & i & " is in slot " & GetVar(1000 + i) & crlf
  End If
Next

'******************************************************************************
                                         '* Last piece of code to update DROs
                                           
                                                '* assuming your first gcode var is #1000  and your slot 1 DRO number is 1000 AND 
                                                 '* that you use consecative vars and DROs (which would be weird if you didn't)

numTools=8
gcodeVarBase=1000                    '* (or whatever i.e. 1 less than the  first you use)
droBase=1149                            '* (or whatever i.e. 1 less than the   first you use)

for tool = 1 to numTools
  slot = GetVar(gcodeVarBase + tool)
  SetUserDRO(droBase + slot, tool)
next



*********************** For now I am at a stalemate that is limited by my faulty programer GENE If you can help out please do and please notate for better understanding if you can.

Thanks (;--) TP
« Last Edit: March 28, 2008, 09:17:19 PM by vmax549 »

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Tool changer routine with hot swap
« Reply #76 on: March 31, 2008, 08:11:39 AM »
Hi Terry - Have you got the actual tool changer mechanics built yet? if not, would it be poss for you to do that?

I will get back to you asap but at the moment I'm pretty tied up time wise.

Cheers

Ian

vmax549

*
Re: Tool changer routine with hot swap
« Reply #77 on: March 31, 2008, 10:25:36 AM »
Hi IAN, THere is NO hurry(;-). I am in the process of finishing up the carousel. I am starting to see the logic picture the more I work with the pieces so it may CLICK on its own(;-). That has always been my flaw, I seem to be missing the logic GENE.  Once I have a logic pattern to work with I can do just fine with modifications and add ons.

Again NO HURRY,  Thanks for all the help

(;-) TP