Activating outputs based on tool number

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

Post Reply
dbunyip
Posts: 11
Joined: Sun Nov 12, 2017 12:08 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: No

Activating outputs based on tool number

Post by dbunyip »

Is it possible to activate an output by which tool number is called?

When T1 is called I want to pause program for 1sec, activate output 7 then continue program.

Same with T2 and output 8

And If any other tool number is called, fault out
diycncscott

Re: Activating outputs based on tool number

Post by diycncscott »

Yes. You will need to create a custom mfunc6.mac (M6 is called during a tool change) and put and if then statement in there based on the tool #.

There are Mfunctions defined for OUTPUT1-OUTPUT8.

;OUTPUT1-8
IF M61 THEN (OUTPUT1)
IF M62 THEN (OUTPUT2)
IF M63 THEN (OUTPUT3)
IF M64 THEN (OUTPUT4)
IF M65 THEN (OUTPUT5)
IF M66 THEN (OUTPUT6)
IF M67 THEN (OUTPUT7)
IF M68 THEN (OUTPUT8)

First, use the Wizard to assign out7 as OUTPUT7 (and 8 as 8)

Then add something like this to your mfunc6.mac -create one in c:\cncm if it does not exist using an existing mfunc as a template. I'll use mfunc66.mac in this example and rename as mfunc6.mac:

Original mfunc66.mac

;------------------------------------------------------------------------------
; Filename: mfunc66.mac <---- Rename as mfunc6.mac
; OUTPUT1 (NOT the same as OUT6) macro <--- remove this comment line
; Description: User Customizable Macro <---- change description to "tool change macro"
; Notes:
; Requires:
; Please see TB300 for tips on writing custom macros.
;------------------------------------------------------------------------------

IF #50010 ;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 ;Skip macro if graphing or searching

N100 ;Insert your code between N100 and N1000

M94 /66 ;Request OUTPUT6 <----- remove this line

N1000 ;End of Macro

New mfunc6.mac

;------------------------------------------------------------------------------
; Filename: mfunc6.mac
; Description: Tool change macro
; Notes:
; Requires:
; Please see TB300 for tips on writing custom macros.
;------------------------------------------------------------------------------

IF #50010 ;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 ;Skip macro if graphing or searching

N100 ;Insert your code between N100 and N1000

;Note this will only turn off outputs assigned as OUTPUT1-OUTPUT8. It will NOT effect the
;ouput if it was assigned as something else
IF 1 == 1 THEN M81 ;Probably want to turn off outputs set by previous tool change(s) turn off OUTPUT1
IF 1 == 1 THEN M82 ;Probably want to turn off outputs set by previous tool change(s) turn off OUTPUT2
IF 1 == 1 THEN M83 ;Probably want to turn off outputs set by previous tool change(s) turn off OUTPUT3
IF 1 == 1 THEN M84 ;Probably want to turn off outputs set by previous tool change(s) turn off OUTPUT4
IF 1 == 1 THEN M85 ;Probably want to turn off outputs set by previous tool change(s) turn off OUTPUT5
IF 1 == 1 THEN M86 ;Probably want to turn off outputs set by previous tool change(s) turn off OUTPUT6
IF 1 == 1 THEN M87 ;Probably want to turn off outputs set by previous tool change(s) turn off OUTPUT7
IF 1 == 1 THEN M88 ;Probably want to turn off outputs set by previous tool change(s) turn off OUTPUT8

;#4120 stores the value of the requested tool #
IF #4120 == 1 THEN G4 P1 ;Wait 1 second
IF #4120 == 1 THEN M67 ;Turn on OUTPUT7

IF #4120 == 2 THEN M68 ;Turn on OUTPUT8

N1000 ;End of Macro

Don't forget to save as mfunc6.mac in c:\cncm

If you want the output to turn off at end of program you will need to add M87, M88 etc.. to end of you program
martyscncgarage
Posts: 9912
Joined: Tue Mar 28, 2017 12:01 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: Yes
CPU10 or CPU7: Yes
Location: Mesa, AZ

Re: Activating outputs based on tool number

Post by martyscncgarage »

diycncscott wrote: Fri Dec 01, 2017 8:53 am Yes. You will need to create a custom mfunc6.mac (M6 is called during a tool change) and put and if then statement in there based on the tool #.

There are Mfunctions defined for OUTPUT1-OUTPUT8.

;OUTPUT1-8
IF M61 THEN (OUTPUT1)
IF M62 THEN (OUTPUT2)
IF M63 THEN (OUTPUT3)
IF M64 THEN (OUTPUT4)
IF M65 THEN (OUTPUT5)
IF M66 THEN (OUTPUT6)
IF M67 THEN (OUTPUT7)
IF M68 THEN (OUTPUT8)

First, use the Wizard to assign out7 as OUTPUT7 (and 8 as 8)

Then add something like this to your mfunc6.mac -create one in c:\cncm if it does not exist using an existing mfunc as a template. I'll use mfunc66.mac in this example and rename as mfunc6.mac:

Original mfunc66.mac

;------------------------------------------------------------------------------
; Filename: mfunc66.mac <---- Rename as mfunc6.mac
; OUTPUT1 (NOT the same as OUT6) macro <--- remove this comment line
; Description: User Customizable Macro <---- change description to "tool change macro"
; Notes:
; Requires:
; Please see TB300 for tips on writing custom macros.
;------------------------------------------------------------------------------

IF #50010 ;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 ;Skip macro if graphing or searching

N100 ;Insert your code between N100 and N1000

M94 /66 ;Request OUTPUT6 <----- remove this line

N1000 ;End of Macro

New mfunc6.mac

;------------------------------------------------------------------------------
; Filename: mfunc6.mac
; Description: Tool change macro
; Notes:
; Requires:
; Please see TB300 for tips on writing custom macros.
;------------------------------------------------------------------------------

IF #50010 ;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 ;Skip macro if graphing or searching

N100 ;Insert your code between N100 and N1000

;Note this will only turn off outputs assigned as OUTPUT1-OUTPUT8. It will NOT effect the
;ouput if it was assigned as something else
IF 1 == 1 THEN M81 ;Probably want to turn off outputs set by previous tool change(s) turn off OUTPUT1
IF 1 == 1 THEN M82 ;Probably want to turn off outputs set by previous tool change(s) turn off OUTPUT2
IF 1 == 1 THEN M83 ;Probably want to turn off outputs set by previous tool change(s) turn off OUTPUT3
IF 1 == 1 THEN M84 ;Probably want to turn off outputs set by previous tool change(s) turn off OUTPUT4
IF 1 == 1 THEN M85 ;Probably want to turn off outputs set by previous tool change(s) turn off OUTPUT5
IF 1 == 1 THEN M86 ;Probably want to turn off outputs set by previous tool change(s) turn off OUTPUT6
IF 1 == 1 THEN M87 ;Probably want to turn off outputs set by previous tool change(s) turn off OUTPUT7
IF 1 == 1 THEN M88 ;Probably want to turn off outputs set by previous tool change(s) turn off OUTPUT8

;#4120 stores the value of the requested tool #
IF #4120 == 1 THEN G4 P1 ;Wait 1 second
IF #4120 == 1 THEN M67 ;Turn on OUTPUT7

IF #4120 == 2 THEN M68 ;Turn on OUTPUT8

N1000 ;End of Macro

Don't forget to save as mfunc6.mac in c:\cncm

If you want the output to turn off at end of program you will need to add M87, M88 etc.. to end of you program
Great stuff! Thanks for sharing it Scott!
Marty
Reminder, for support please follow this post: viewtopic.php?f=20&t=383
We can't "SEE" what you see...
Mesa, AZ
dbunyip
Posts: 11
Joined: Sun Nov 12, 2017 12:08 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: No

Re: Activating outputs based on tool number

Post by dbunyip »

Thank you very much. Do I have to set the parameters for atc to use the mfunc6.mac?
dbunyip
Posts: 11
Joined: Sun Nov 12, 2017 12:08 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: No

Re: Activating outputs based on tool number

Post by dbunyip »

another question, If I used

"IF #4120 == 1 THEN #5041 = #5041 + 2"

would that shift my WCS by 2in? I'm not in front of my machine right now but I'm going to try in a few hours and see if I can figure out that part. I know I'm going to need more to have a way to put it back but I need to move WCS by 2in if calling T1 and by 10in if calling T2.

Am I on the right track with #5041? I'm guessing I need to store my original WCS as a variable and then modify #5041 based off that
diycncscott

Re: Activating outputs based on tool number

Post by diycncscott »

No you don't need to set the atc parm (6). If there is an mfunc6.mac present in c:\cncm, the control will automatically run it during a tool change. If it's not there it just does the defualt action(s) -move to Z home (M25) and prompt you to change tool.

To change the current X axis position by +2 for tool #1, you would add :

IF #4120 == 1 THEN G92 x[#5041 + 2]


Be aware that this will do it every time you do a tool change to T1. It will compound..... 2,4,6,8...
Post Reply