Thanks again. You and this forum have been a great resource.
Now to just get my lathe here and buy my Acorn.....
ATC Macro / PLC Help please <success!>
Moderator: cnckeith
-
- 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
After being fairly ill for a few weeks and sub zero temps, Ive tried again. No joy, it doesnt seem to follow the correct logic. Ive packed up so cant access the PC now but will paste the code I am try and all the report bits.
-
- 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
I would love to be able to run this on my home PC and get the code working. But without a board, it cant be done One of the few advantage Mach 3 seems to have.
-
- 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
Can I also just check.
This comment.
; Notes: Turns/rev must be configured 1 = 1 turret position change
I take it this assumes that moving from A1 to A2 is one tool step move? So T08 = A08, it doesnt matter how I get this to work as long as I use the correct parameters in the motor setup and get the ratio working?
This comment.
; Notes: Turns/rev must be configured 1 = 1 turret position change
I take it this assumes that moving from A1 to A2 is one tool step move? So T08 = A08, it doesnt matter how I get this to work as long as I use the correct parameters in the motor setup and get the ratio working?
Re: ATC Macro / PLC Help please
Yes that is correct. If you command A1 it goes to turret position 1, A2 = 2 etc..
Yes, you can often "crowbar" the steps/rev and revs/unit back and forth and achieve the similar positioning results but I would strongly suggest setting the steps per/rev to what your drive is configured to (and can handle). Then adjust only revs/unit (or units/rev if metric) as needed.
Also, for positioning a turret, you will want to set A as a linear axis in the Wizard.
Yes, you can often "crowbar" the steps/rev and revs/unit back and forth and achieve the similar positioning results but I would strongly suggest setting the steps per/rev to what your drive is configured to (and can handle). Then adjust only revs/unit (or units/rev if metric) as needed.
Also, for positioning a turret, you will want to set A as a linear axis in the Wizard.
-
- 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
Thanks. I dont think mine is set up as Linear, I wonder if that is causing problems. Will try again this weekend.diycncscott wrote: ↑Tue Mar 06, 2018 7:51 am Yes that is correct. If you command A1 it goes to turret position 1, A2 = 2 etc..
Yes, you can often "crowbar" the steps/rev and revs/unit back and forth and achieve the similar positioning results but I would strongly suggest setting the steps per/rev to what your drive is configured to (and can handle). Then adjust only revs/unit (or units/rev if metric) as needed.
Also, for positioning a turret, you will want to set A as a linear axis in the Wizard.
-
- 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
Finally working. I swapped my numbers to increment to make it easier but it wasnt that.
Its the format of the IF THEN ELSE statement. So simple in the end. Ill copy / paste it later, hopefully it can help someone else.
Its the format of the IF THEN ELSE statement. So simple in the end. Ill copy / paste it later, hopefully it can help someone else.
-
- 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
Working Macro.
;------------------------------------------------------------------------------
; 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 = 8 ;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.
;
;#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
IF #5023 > #4120 THEN #101 = [8 + #4120] ELSE #101 = #4120
G53 A[#101 + 0.5]
G53 A[#101 - 0.5]
M26 /A L[#4120*#20603]
N1000 ;Macro finished
;------------------------------------------------------------------------------
; 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 = 8 ;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.
;
;#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
IF #5023 > #4120 THEN #101 = [8 + #4120] ELSE #101 = #4120
G53 A[#101 + 0.5]
G53 A[#101 - 0.5]
M26 /A L[#4120*#20603]
N1000 ;Macro finished
Last edited by Chaz on Sun Mar 11, 2018 1:57 pm, edited 1 time in total.
-
- 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
The +0.5 and -0.5 on the G53 movements is to get past a pawl and then lock against it by reversing.
Re: ATC Macro / PLC Help please
Good job. To prevent unexpected behavior, you should place:
IF #50001
The line before any line that assigns a value to a variable to prevent look-ahead from assigning the value prematurely.
It doesn't do anything except stop parsing beyond the IF #50001 line until the program is actually at that line.
IF #50001
The line before any line that assigns a value to a variable to prevent look-ahead from assigning the value prematurely.
It doesn't do anything except stop parsing beyond the IF #50001 line until the program is actually at that line.