Hello Guest it is October 26, 2021, 08:17:14 PM

Author Topic: ATC Macro Help  (Read 5761 times)

0 Members and 1 Guest are viewing this topic.

ATC Macro Help
« on: September 10, 2014, 09:03:27 AM »
 Hi all,

 I thought someone may of done a similar ATC to me but cant seem to find much, I'm struggling to find a starting point for a Macro, I know absolutely nothing about writing a macro but had thought about integrating two macro's, one that had been written for a boxford tcl ATC, and one that had been written for a Denford starturn/orac ATC ect, thing is these look very different to me and i wouldn't know where to start tbh, or which of any parts of the macro's i would need.

 I have a denford 8 pos ATC which i'm currently controlling via jog,

its driven by worm indexing CW and then CCW to lock onto a ratchet and pawl, I currently have it driven by a stepper on the A-axis, the stepper has to make 5 rotations to drive the worm to index 1 tool position.
I have 3 positional sensors (photo-electric) which detect the 8 tool positions and feedback to the breakout like limits on input 1,2 & 3.

T1: off off off (000)
T2: off off on (001)
T3: on off on (101)
T4: on on on (111)
T5: off on on (011)
T6: off on off (010)
T7: on on off (110)
T8: on off off (100)

is it possible to get this running with a macro the way i'm setup?

possible similar macro in an old thread on deford forum here http://www.denfordata.com/bb/viewtopic.php?p=13665&sid=b93494ce7b8722ea769056c819862bc3#p1366

believe that one was running from a dc motor (24vdc/12vdc) possibly other components,

can anyone point me in the right direction please

Dave

Re: ATC Macro Help
« Reply #1 on: September 11, 2014, 05:38:57 AM »
I've tried using that macro somebody wrote for the Denford with a standard dc motor controlling the turret but with a couple of alterations to run the stepper as A-axis (angular with 360 rollover) and sleep delays reduced as the stepper moves considerably quicker than the old DC motor.

the turret will rotate under tool call (m6t101) ect but does not stop on the input pin configurations.

turret stepper is set up so a call of 64 degrees will equate to one full rotation of the turret (8 degrees per tool index @ 8 positions)

I cant be that far away can I?

modified code i've tried and failed:


Tool = GetSelectedTool()
OldTool = GetCurrentTool()
NewTool = Tool
MaxToolNum = 8 'Max number of tools for the changer

While NewTool > MaxToolNum
NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend

Call StartTool

While SelectedTool <> NewTool
Call CheckPins
sleep(20)
Wend

sleep(200) 'delay in ms to over-run selected tool position
SelectedTool = NewTool

Call StopTool

sleep(600) 'delay to allow turret to lock into position
Call CheckPins
If SelectedTool <> NewTool Then 'verify that correct tool has locked in-place. Beep, announce and stop program if not
Beep
MsgBox ("Toolchange has FAILED!!! Try adjusting the over-run delay")
code "M00"
End If

SetCurrentTool(NewTool )

'//// Subroutines ////

Sub StartTool
Code " G91 G0 A-64"
End Sub

Sub CheckPins
If Not IsActive(Input1) And Not IsActive(Input2) And IsActive(Input3) Then
SelectedTool = 1
End If
If IsActive(Input1) And Not IsActive(Input2) And IsActive(Input3) Then
SelectedTool = 2
End If
If IsActive(Input1) And IsActive(Input2) And IsActive(Input3) Then
SelectedTool = 3
End If
If Not IsActive(Input1) And IsActive(Input2) And IsActive(Input3) Then
SelectedTool = 4
End If
If Not IsActive(Input1) And IsActive(Input2) And Not IsActive(Input3) Then
SelectedTool = 5
End If
If IsActive(Input1) And IsActive(Input2) And Not IsActive(Input3) Then
SelectedTool = 6
End If
If IsActive(Input1) And Not IsActive(Input2) And Not IsActive(Input3) Then
SelectedTool = 7
End If
If Not IsActive(Input1) And Not IsActive(Input2) And Not IsActive(Input3) Then
SelectedTool = 8
End If
End Sub

Sub Stoptool
Code " G91 G0 A2"
End Sub
« Last Edit: September 11, 2014, 05:40:28 AM by speckled »

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: ATC Macro Help
« Reply #2 on: September 11, 2014, 08:25:40 AM »
the turret will rotate under tool call (m6t101) ect but does not stop on the input pin configurations.

Because you've told the stepper to move 64 degrees - and that's what it will do. You're effectively trying to use a closed loop servo system to control an open loop stepper with incidental and "after the fact" positional feedback.
Re: ATC Macro Help
« Reply #3 on: September 11, 2014, 03:34:30 PM »
the turret will rotate under tool call (m6t101) ect but does not stop on the input pin configurations.

Because you've told the stepper to move 64 degrees - and that's what it will do. You're effectively trying to use a closed loop servo system to control an open loop stepper with incidental and "after the fact" positional feedback.

Ok, so is there a command i'm missing to rotate A until it reaches the the required inputs?

could this be achieved by doing a do-loop of 8 degrees (G91 G0 A-8) until the required inputs are met or is there a better method?

Dave

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: ATC Macro Help
« Reply #4 on: September 12, 2014, 03:55:59 AM »
Ok, so is there a command i'm missing to rotate A until it reaches the the required inputs?

Not readily.

could this be achieved by doing a do-loop of 8 degrees (G91 G0 A-8) until the required inputs are met or is there a better method?

You have a stepper system - i.e. a precise open loop positioning system - my suggestion would be to use that to your advantage rather than trying to beat it into a pseudo servo system. YMMV but if you want to give it a shot...

1) set your steps/per in motor tuning so that a command of 360 turns it exactly 1 rotation.
2) Manually set your turret so that it's positioned on tool 1 (we'll come back to this later)
3) Stick the code below in your M6Start macro
4) Make sure you have 360 rollover selected (I think you said you have already).
5) In your code you were using negative rotation values - you may want to swap your DIR pin for A in ports and pins so that you can use positive numbers.

Code: [Select]
selectedTool = getSelectedTool()
currentTool = getCurrentTool()

code "G1 A" & (selectedTool - 1) * 45
While isMoving()
  sleep 10
Wend

SetCurrentTool selectedTool

This should select the appropriate tool after an M6T..... command.

It will rotate at whatever the current feedrate is and is NOT finished yet - I just want to know if I'm on the right track (I'm working blind here remember).

If this does more or less what you want we can ook at locking, auto homing and error handling next.
Re: ATC Macro Help
« Reply #5 on: September 12, 2014, 08:09:22 AM »

1) set your steps/per in motor tuning so that a command of 360 turns it exactly 1 rotation.
2) Manually set your turret so that it's positioned on tool 1 (we'll come back to this later)
3) Stick the code below in your M6Start macro
4) Make sure you have 360 rollover selected (I think you said you have already).
5) In your code you were using negative rotation values - you may want to swap your DIR pin for A in ports and pins so that you can use positive numbers.

Code: [Select]
selectedTool = getSelectedTool()
currentTool = getCurrentTool()

code "G1 A" & (selectedTool - 1) * 45
While isMoving()
  sleep 10
Wend

SetCurrentTool selectedTool

This should select the appropriate tool after an M6T..... command.

It will rotate at whatever the current feedrate is and is NOT finished yet - I just want to know if I'm on the right track (I'm working blind here remember).

If this does more or less what you want we can ook at locking, auto homing and error handling next.


appreciated sterling,

tried/tested the above, on first tool call it will rotate to the called for tool, subsequent tool calls will rotate equvilent indexes to (tool number -1)

so say you call m06t0303 it will move to tool 3, but then if you was then to call m06t0404 it will rotate to tool 6, 3 positions (t4 -1)

Dave

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: ATC Macro Help
« Reply #6 on: September 12, 2014, 10:09:45 AM »
OK - looks like you may have a G91 in effect?

please start again but make sure G90 is in effect before testing.
Re: ATC Macro Help
« Reply #7 on: September 12, 2014, 11:40:07 AM »
right on the button sterling, G91 was in effect,

works as should now, indexes to each position

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: ATC Macro Help
« Reply #8 on: September 12, 2014, 11:57:59 AM »
OK - so you have a basic but working ATC - so over to you - what would you like it to do now that it doesn't do?
Re: ATC Macro Help
« Reply #9 on: September 12, 2014, 05:49:40 PM »
OK - so you have a basic but working ATC - so over to you - what would you like it to do now that it doesn't do?

check inputs for a valid tool, ratchet back to the pawl, handle missed steps that will likely occur via stalling on the pawl.