Macro on AUX13 or AUX14 (Answered)
Moderator: cnckeith
-
- Community Expert
- Posts: 3521
- Joined: Tue Mar 22, 2016 10:03 am
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: Yes
- Oak CNC controller: Yes
- CNC Control System Serial Number: 100505
100327
102696
103432
7804732B977B-0624192192 - DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: Boston, MA
- Contact:
Macro on AUX13 or AUX14 (Answered)
Is there any way to assign a macro to aux key 13 or aux key 14. I know these two extra aux keys can be used in the PLC program (I actually have my worklight controlled by AUX14), but I wasn't sure if a macro could be assigned to them. Somehow, my Elrod Machine M400 control has what appears to be the ABS SET one-shot on AUX14.
I know P188-P199 only handle the first 12 aux keys, but I hoped there might be a way in the PLC program to assign a macro to AUX13.
I know P188-P199 only handle the first 12 aux keys, but I hoped there might be a way in the PLC program to assign a macro to AUX13.
Last edited by tblough on Wed Jan 16, 2019 10:44 am, edited 1 time in total.
Cheers,
Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- Site Admin
- Posts: 8879
- Joined: Wed Mar 03, 2010 4:23 pm
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: Yes
- Oak CNC controller: Yes
- CNC Control System Serial Number: none
- DC3IOB: Yes
- CNC11: Yes
- CPU10 or CPU7: Yes
- Contact:
Re: Macro on AUX13 or AUX14
you can set one shots using 188-199 to aux 1-12
as far as 13 and 14 i think they are used for plc only.. mario can shed some light on this one..
as far as 13 and 14 i think they are used for plc only.. mario can shed some light on this one..
Need support? READ THIS POST first. http://centroidcncforum.com/viewtopic.php?f=60&t=1043
All Acorn Documentation is located here: viewtopic.php?f=60&t=3397
Answers to common questions: viewforum.php?f=63
and here viewforum.php?f=61
Gear we use but don't sell. https://www.centroidcnc.com/centroid_di ... _gear.html
All Acorn Documentation is located here: viewtopic.php?f=60&t=3397
Answers to common questions: viewforum.php?f=63
and here viewforum.php?f=61
Gear we use but don't sell. https://www.centroidcnc.com/centroid_di ... _gear.html
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- Community Expert
- Posts: 3521
- Joined: Tue Mar 22, 2016 10:03 am
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: Yes
- Oak CNC controller: Yes
- CNC Control System Serial Number: 100505
100327
102696
103432
7804732B977B-0624192192 - DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: Boston, MA
- Contact:
Re: Macro on AUX13 or AUX14
Going through Elrod's PLC source it turns out that AUX11 and AUX13 are or'ed together and both execute DoAux11Key. Similarly for AUX12 and AUX14, so AUX14 doesn't really have a macro attached.
I guess I'll have to get rid of one of my existing macros/one-shots so I can create a re-home Z macro to reenable my scale.
I guess I'll have to get rid of one of my existing macros/one-shots so I can create a re-home Z macro to reenable my scale.
Cheers,
Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
Re: Macro on AUX13 or AUX14
If you are using CNC12 v4.12 (or later), you can use SV_SYS_MACRO.
Set SV_SYS_MACRO to a non-zero value to execute a CNC macro file from the c:\cncm\system directory. The macro file should be named "macro__.mac", where __ is the number you set in SV_SYS_MACRO. E.g. set SV_SYS_MACRO = 1 to execute c:\cncm\system\macro1.mac.
Make sure to set SV_SYS_MACRO back to zero in between uses.
Set SV_SYS_MACRO to a non-zero value to execute a CNC macro file from the c:\cncm\system directory. The macro file should be named "macro__.mac", where __ is the number you set in SV_SYS_MACRO. E.g. set SV_SYS_MACRO = 1 to execute c:\cncm\system\macro1.mac.
Make sure to set SV_SYS_MACRO back to zero in between uses.
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- Community Expert
- Posts: 3521
- Joined: Tue Mar 22, 2016 10:03 am
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: Yes
- Oak CNC controller: Yes
- CNC Control System Serial Number: 100505
100327
102696
103432
7804732B977B-0624192192 - DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: Boston, MA
- Contact:
Re: Macro on AUX13 or AUX14
Marc,
Would something like this work? What I'm shooting for is if Aux13 is pressed and Z is not homed, turn Aux13 light on and run macro70. When the macro finishes, turn the light off, and set SV_SYS_MACRO back to 0. I don't really need the light, just though it would be nice to have.
Would something like this work? What I'm shooting for is if Aux13 is pressed and Z is not homed, turn Aux13 light on and run macro70. When the macro finishes, turn the light off, and set SV_SYS_MACRO back to 0. I don't really need the light, just though it would be nice to have.
Code: Select all
;RTB 1/10
;Run macro70.mac to home Z axis when AUX13 pressed
; macro70.mac needs contain exactly the same code as the
; Z section in CNCM.HOM
IF (Aux13Key && !SV_PC_HOME_SET) THEN (Aux13PD)
IF Aux13PD THEN SET Aux13LED, SV_SYS_MACRO = 70
IF (!Aux13PD && SV_SYS_MACRO == 70)
THEN RST Aux13LED, SV_SYS_MACRO = 0
;
Cheers,
Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
Re: Macro on AUX13 or AUX14
The code you have there will work, but the LED will turn off after one scan of the PLC program (ca. 20ms).
You could do essentially the same thing with a little less code, as follows:
You may find that, in your particular application (re-homing Z after it has been disabled and reenabled) that SV_PC_HOME_SET is already 1, so pressing Aux13 would not do anything. In that case, just remove the dependency on SV_PC_HOME_SET.
If you actually want the Aux13 LED to remain on until the macro completes, then the macro will have to send some type of signal to the PLC program (e.g. via M94/M95).
You could do essentially the same thing with a little less code, as follows:
Code: Select all
IF True THEN SV_SYS_MACRO = 0
IF Aux13Key && !SV_PC_HOME_SET THEN SV_SYS_MACRO = 70, (Aux13LED)
If you actually want the Aux13 LED to remain on until the macro completes, then the macro will have to send some type of signal to the PLC program (e.g. via M94/M95).
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- Community Expert
- Posts: 3521
- Joined: Tue Mar 22, 2016 10:03 am
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: Yes
- Oak CNC controller: Yes
- CNC Control System Serial Number: 100505
100327
102696
103432
7804732B977B-0624192192 - DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: Boston, MA
- Contact:
Re: Macro on AUX13 or AUX14
Thanks for all your help Marc. I realized soon after I posted that last message that the light would be shut off almost instantaneously when the PC bit got cleared the next time through the PLC code. I thought about using M94/M95 like you suggested, but then there would be the possibility of the Aux13 light remaining on if the macro was cancelled by the user so I ended up using the PLC code to wait until the macro ended to shut the light off.
I also thought about what you said concerning the machine home condition, and I realized that if I did try to stop the macro execution if the machine were already homed/scale enabled, then I would need to add additional logic to notify the user about why the machine was not doing anything when they kept pushing Aux13. Bottom line is it really doesn't matter if the axis is re-homed even if it didn't need to be so I just took that check out.
Here's what I finally ended up with.
PLC Code in MainStage
And here is \cncm\system\plcmacro1.mac
I also thought about what you said concerning the machine home condition, and I realized that if I did try to stop the macro execution if the machine were already homed/scale enabled, then I would need to add additional logic to notify the user about why the machine was not doing anything when they kept pushing Aux13. Bottom line is it really doesn't matter if the axis is re-homed even if it didn't need to be so I just took that check out.
Here's what I finally ended up with.
PLC Code in MainStage
Code: Select all
; Z-Home
; RTB 1/10
; Run \cncm\system\plcmacro1.mac to home Z axis when AUX13 pressed
; plcmacro1.mac needs contain exactly the same code as the
; Z section in CNCM.HOM
IF true THEN SV_SYS_MACRO = 0
IF Aux13LED && !SV_JOB_IN_PROGRESS THEN RST Aux13LED
IF Aux13Key THEN SV_SYS_MACRO = 1, SET Aux13LED
Code: Select all
;------------------------------------------------------------
; Filename \cncm\system\plcmacro1.mac
; Description: Home Z axis after manual mode to re-enable Z scale feedback
; Called by custom PLC code on AUX13
;------------------------------------------------------------
IF #50010 ; Prevent lookahead from parsing past here
G90 G53 Z0
; --- Code here must match exactly the Z section of CNCM.HOM
M92/Z
G91 G1 G20 Z0.120 F10.0
M26/Z
;----
Cheers,
Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- Community Expert
- Posts: 3521
- Joined: Tue Mar 22, 2016 10:03 am
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: Yes
- Oak CNC controller: Yes
- CNC Control System Serial Number: 100505
100327
102696
103432
7804732B977B-0624192192 - DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: Boston, MA
- Contact:
Re: Macro on AUX13 or AUX14
I edited the above code to reflect a few things learned. First, the macro must be named "plcmacro__.mac" and not "macro__.mac" and should be in the \cncm\system directory as Marc stated. Second, PLC macros do not display code on the screen as regular macros do, therefore, trying to display messages with M200/M223/M224/M225/M290 formatted string commands does not work, and comments in the code are unable to convey information to the user.
Cheers,
Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- Community Expert
- Posts: 3521
- Joined: Tue Mar 22, 2016 10:03 am
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: Yes
- Oak CNC controller: Yes
- CNC Control System Serial Number: 100505
100327
102696
103432
7804732B977B-0624192192 - DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: Boston, MA
- Contact:
Re: Macro on AUX13 or AUX14
One final issue. I cannot find a good indicator of the macro finishing in order to turn off the Aux13LED. I have looked at using both "IF Aux13LED && !SV_JOB_IN_PROGRESS THEN RST Aux13LED" and "IF Aux13LED && !SV_SCALE_INHIBIT_AXIS_3 THEN RST Aux13LED" and both turn off the LED on the next past through the PLC even thought the homing routine is still continuing to run.
SV_JOB_IN_PROGRESS is supposed to be set when CNC11 is running a job or running an MDI command, but not while at the MDI prompt waiting for input. I assumed it would be set while the macro was running, but the test still results in turning off the light on the next pass through.
SV_SCALE_INHIBIT_AXIS_3 is supposed to be set when scale compensation for the axis is disabled. Either this is not set when the z scale is disabled, or it is being cleared as soon as the macro starts.
Anyone have any ideas on what System Variable would signal the completion of the system macro?
SV_JOB_IN_PROGRESS is supposed to be set when CNC11 is running a job or running an MDI command, but not while at the MDI prompt waiting for input. I assumed it would be set while the macro was running, but the test still results in turning off the light on the next pass through.
SV_SCALE_INHIBIT_AXIS_3 is supposed to be set when scale compensation for the axis is disabled. Either this is not set when the z scale is disabled, or it is being cleared as soon as the macro starts.
Anyone have any ideas on what System Variable would signal the completion of the system macro?
Cheers,
Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
Re: Macro on AUX13 or AUX14
The problem you are having with SV_JOB_IN_PROGRESS is probably that the automatic cycle has not yet begun to run by the time you take your finger off the key.
It is also possible that CNC12 fails to set SV_JOB_IN_PROGRESS (or SV_PROGRAM_RUNNING as well?) while running PLC macros. A quick test with the PLC Detective logic analyzer, or with another line of PLC logic that echoes the system variable to an unused LED output, would answer that question.
You could try adding lines like this to your CNC macro file:
and lines like this to your PLC program:
However, if you cancel the macro before it finishes, or some sort of error or fault occurs, then the LED would remain on unless you also include logic like:
and of course, then it would only work right if CNC12 maintains SV_PROGRAM_RUNNING for PLC macros the way it does for other cycles.
It is also possible that CNC12 fails to set SV_JOB_IN_PROGRESS (or SV_PROGRAM_RUNNING as well?) while running PLC macros. A quick test with the PLC Detective logic analyzer, or with another line of PLC logic that echoes the system variable to an unused LED output, would answer that question.
You could try adding lines like this to your CNC macro file:
Code: Select all
M94/97 ; raise macro-running flag
; ... do all the re-homing stuff
M95/97 ; reset the macro-running flag
Code: Select all
ZHomeMacroRunning IS SV_M94_M95_97
; ...
IF ZHomeMacroRunning THEN (Aux13LED)
Code: Select all
IF !SV_PROGRAM_RUNNING THEN RST ZHomeMacroRunning
(Note: Liking will "up vote" a post in the search results helping others find good information faster)