ATC Macro / PLC Help please <success!>

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

Post Reply
Chaz
Posts: 392
Joined: Thu Feb 08, 2018 7:57 am
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

ATC Macro / PLC Help please <success!>

Post by Chaz »

So Ive been asked to start a new topic.

Just installed the Acorn board, really happy thus far but not sure how to get the ATC to work. Here is the logic of the ATC (from the Mach 3 macro code).

Video of one working on Mach 3.

https://www.youtube.com/watch?v=-cCDulVashA

Some of the guys on the UK forum have also been helping here:-

http://www.mycncuk.com/threads/11430-Ce ... -one/page6

I use the A Axis to rotate the ATC, no sensors.

The essence of the macro is as follows:-

I use the A Axis, set to rotational. 8 tool positions. The turret can only move one direction, in reverse it stops against a ratchet / pawl.

There are a number of variables set however these could all be hard-coded. Before any of this happens, the tool changer is moved to a suitable position.

Dim Num_Tools As Integer
Dim CW_Steps_Per_Tool As Integer
Dim CCW_Steps As Integer
Dim HoldingDRO As Integer
Dim Requested_Tool As Integer
Dim Current_Tool As Integer
Dim CW_Feed As Integer
Dim CCW_Feed As Integer

Dim moves As Integer
Dim total_move As Integer

Num_Tools = 8
CW_Move_Per_Tool = 360/Num_Tools
CCW_Move = 10
HoldingDRO = 1050
Requested_Tool = GetSelectedTool()
Current_Tool = GetUserDRO(HoldingDRO)
CW_Feed = 1500
CCW_Feed = 1000
Current_Feed = GetOEMDRO(818)


In this macro's case what it does is the following:-

Declares the variables and the variable type (as per above)

It then starts a tool change and checks some conditions.

If the tool change number requested is higher than the Num_Tools, then MSG the user that the Requested tool number is invalid and quit the routine.
If the tool change number is < 1, do the same.
If the tool change number is the same as the existing tool, do nothing.

Otherwise / Else, do the following.

Some quick maths to determine how many tool positions to move. Two conditions exist below (one to go from a lower number to a higher number) and one to go from a higher number to a lower number, keep in mind that the tool changer cannot reverse.

If Requested_Tool > Current_Tool Then moves = Requested_Tool -Current_Tool
If Requested_Tool < Current_Tool Then moves = Num_Tools - Current_Tool +Requested_Tool

The calculation then says:-

total_move = (moves * CW_Move_Per_Tool)+(CCW_Move/2)

So lets use an example. Say we want to go from Tool 4 to tool 7.

Based on this, moves = 7 - 4 which is 3.
total_move = (3 * 45 degrees (calculated from 360 degree / 8 tools)) + (10/2). The extra bit at the end is to get it to go past the ratchet / pawl.

The system then does the following code:-

Code "G91 G94" 'incremental & Feed per minute
Code "G0 A" & total_move '& "F" & CW_Feed
Code "G0 A" & "-" & CCW_Move '& "F" & CCW_Feed

Basically, sets incremental and sets G94
Then does G0 A Total_move at a set feed rate
Then does G0 A -10 to set against the ratchet / pawl.

That's all there is to it.

If the tool changer wants to go from tool 7 to tool 1, the sum will be

If Requested_Tool < Current_Tool Then moves = Num_Tools - Current_Tool +Requested_Tool

Which will be 8 - 7 + 1

Which means that it will move 2 sets of clockwise direction, then reverse 10 for the Pawl / ratchet.

Of course, once the move is done, the new tool now being used is updated whereever it is stored.

Many thanks, really liking this board, if I can get around this issue, any of my future retrofits will be done with this board / software.

If not bought the pro software yet, I believe I need this for M107? I dont mind buying the software but kinda pointless if I cant get the ATC to work, so a bit catch 22.

Thanks
diycncscott

Re: ATC Macro / PLC Help please

Post by diycncscott »

Because your turret is uni-directional, you will need to calculate the "rolled over position"
and command a move to that position. Once there, you will need to change the machine position
to reflect the turret position.

You don't nee the M107 for this since the tool number is the axis machine position. M107 is to send the tool number to the PLC

For the example(s) below:

Start cnctch.mac with a header for comments etc..

;------------------------------------------------------------------------------
; Filename: cnctch.mac
; Description: Axis driven tool change macro for lathe
; Notes: Turns/rev must be configured 1 = 1 turret position change
; Turret is on 3rd axis, positions are in machine position.
; Requires: Machine home must be set prior to use.
;
#100 = 12 ;Number turret positions
#101 = ;Calculated position to move to when requested position < current position.
#4120 = requested tool
#20601-#20604 = Counts per unit for axes1-4
#5021-#5024 is the current machine position for axes 1(#5021) through 4(#5024)


;------------------------------------------------------------------------------

follow with a block that skips if graphing or searching
IF #50001 ;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 ;Skip macro if graphing or searching

If not searching or graphing, check to make sure the turret is not already
at the requested position. If it is, skip the macro

IF [ABS[#4120-#5023] < .002] THEN GOTO 1000

; Notes: Turns/rev must be configured 1 = 1 turret position change
; Turret is on 3rd axis, positions are in machine position.
; Requires: Machine home must be set prior to use.
;
;#100 = 12 ;Number turret positions
;#101 = ;Calculated position to move to when requested position < current position
;#20601-#20604 = Counts per unit for axes1-4
;#5021-#5024 is the current machine position for axes 1(#5021) through 4(#5024)
;#4120 = requested turret position from g code

Example 1
ie.. Max position = 12. Sitting on 8, requested 3 Assuming direction always counts up when moving from tool to tool.


;If current machine position of turret is > requested position:
;subtract current position from max 12 - 8 = 4, then add the requested position 3, then add max position 12:
IF #5023 > #4120 THEN #101 = [[#100 - #5023] +[ #4120 + #100]

;Above to get to 3 from 8, you need to command a move to 19. 7 positions greater than current position.
;G53 A19 =
G53 A[#101]

;You may need a short move to go past this position and then reverse back to lock

;Once at requested position and locked, reset position for DRO display and prevent position windup
;Set current machine position to requested position
M26 /A L[#4120*#20603]

Example2
ie.. Max position = 12. Sitting on 8, requested 11 Assuming direction always counts up when moving from tool to tool.


;If current machine position of turret is < requested position:
;simply command a move to requested position
G53 A#4120

;You may need a short move to go past this position and then reverse back to lock

;Once at requested position and locked, reset position for DRO display and prevent position windup
;Set current machine position to requested position
M26 /A L[#4120*#20603]

N1000 ;Macro finished
Chaz
Posts: 392
Joined: Thu Feb 08, 2018 7:57 am
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Re: ATC Macro / PLC Help please

Post by Chaz »

Many thanks. Will try that ASAP.
diycncscott

Re: ATC Macro / PLC Help please

Post by diycncscott »

On second thought, I've changed the example to use the 3rd axis so you don't need pro.
Chaz
Posts: 392
Joined: Thu Feb 08, 2018 7:57 am
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Re: ATC Macro / PLC Help please

Post by Chaz »

diycncscott wrote: Tue Feb 20, 2018 2:15 pm On second thought, I've changed the example to use the 3rd axis so you don't need pro.
Thanks. I take it also then that the parameter 6 = 1, doesnt then also need parameter 830 set to anything?

Taking a quick look, this doesnt need any PLC code then?

Another user on this forum with his Emco120 will also benefit from this code, the Emcos use the same type of turret design.
diycncscott

Re: ATC Macro / PLC Help please

Post by diycncscott »

This requires no PLC code. The Emco's are typically just driven with a motor with absolute sensors to report turret position to the PLC. They DO require PLC changes. There is a pr0gram here somewhere for them as well as the cnctch.mac file
Chaz
Posts: 392
Joined: Thu Feb 08, 2018 7:57 am
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Re: ATC Macro / PLC Help please

Post by Chaz »

diycncscott wrote: Tue Feb 20, 2018 3:08 pm This requires no PLC code. The Emco's are typically just driven with a motor with absolute sensors to report turret position to the PLC. They DO require PLC changes. There is a pr0gram here somewhere for them as well as the cnctch.mac file
Thanks. The Emco 120 I had (which now belongs to another forum member here) doesnt use sensors. Its ratchet and pawl like this .... unless its been modded (it looks standard), ill find a video of them.
Chaz
Posts: 392
Joined: Thu Feb 08, 2018 7:57 am
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Re: ATC Macro / PLC Help please

Post by Chaz »

You can see here - https://youtu.be/nrv3IdI14_g?t=2m - it sends the turret forward then reverses to set against the pawl. I dont believe these have any sensors.
Chaz
Posts: 392
Joined: Thu Feb 08, 2018 7:57 am
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Re: ATC Macro / PLC Help please

Post by Chaz »

Also, can I ask, these numbers like #5023 etc, are these in a manual somewhere? Is there any way that we could have worked this out ourselves?

thanks
diycncscott

Re: ATC Macro / PLC Help please

Post by diycncscott »

Sorry. I usually try to include that information in any code I post.

#5021-#5024 is the current machine position for axes 1(#5021) through 4(#5024)

Yes they are. Search on 50001 and it will take you to the system variable section.

http://www.centroidcnc.com/downloads/ce ... manual.pdf
Post Reply