Hello,
I would like to count CNC subprogram executions. Thought to use following G-code statement: “EXWnn = EXWnn + 1” at the end line of a subprogram, before M30, but it doesn’t work. EXWnn does not change, it stays at zero. I have limited time to test this because the machine is constantly in use…
Hello,
not sure but I suspect we are dealing with the same problem as we have when using path-synchronous variables:
ARNC0 variables
‘Reading variables (z.B. when used on the right side of an assignment or as parameter of a function call) is always done synchronous to the interpreter’
I would simply use a free non- synchronized M function instead and count it in the PLC code.
ARNC0 M-Functions
otherwise you’ve to deal with G170 Decoder Synchronization.
1 Like
Thank you, make sense.. I am not very familiar with CNCs as you can see and need to keep studiing this topic…
Just one more question related to your answer, because I have very limited time access to the machine to test… I call “drillcyc” subprogram like this:
…
N120 Ldrillcyc2 (*sub-program which I need to count*)
N121 G00 Z20
N137 G00 X-15 Y-8 B180+EXF2 (4. drill)
N139 G00 Z-46
N125 Ldrillcyc2 (*sub-program which I need to count*)
N126 G00 Z20
N142 G00 X-4 Y-8 B245+EXF2 (5. drill)
N144 G00 Z-35
N130 Ldrillcyc2 (*sub-program which I need to count*)
etc..
If I insert e.g. non-synchronized M45 in my subprogram drillcyc2 can I understand this as consecutively activation of M45 or not? Because in help (AS 4.2: GUID 919f8932-0857-4da2-8bfb-9d02e756877c) it is written : “If the same non-synchronized M Function is set more than consecutively twice, the CNC program is aborted reportimg error 7127. The program is already aborted after the second non-synchronous M Function, if another non-synchronous M Function had been programmed directly before.”
Hello,
The System tries to support you in not missing a M-Function. With not Synchronised M-Function there can be situations Programmed were you would only see one EdgeChange 0->1 in Application but in the CNC-Programm there could be read more occurances at ones.
This is because the interpreter and PathExecuter can read/execute more than one CNC-Line at once if they do not need real execution time. Setting an Non-Synchronous M-Funktion is basicaly done instant in Memory.
In general its also expected that the Application is resetting a non-Synchrounos M-Function by setting the Memory back to 1->0 zero.
If there are to much occurances of a M-Function were the systems sees it in the Code and the Flag is allready 1 then it increases the “error counter” and if the occurances are to offten it will set this 7127 error.
So as long as you have not the same M-Function in consecutive occurances without having a other Commands that need some “Time” you will be fine. Just keep in mind that processing the M.-Function in TC#1 would be good to have the same CycleTime as the PathExecuter.
Commands which need Time are all Movements “G00,G01,G02,G03,G04,G100,G101, …” and a Pause “G04”
M42 // Flag in Memory goes 0 → 1
M42 // Flag is 1
M42 // Flag is 1
M42 // Flag is 1
=>Task in TC#1 sees only one occurance this is what the system want to prevent with the Error
M42 // Flag in Memory goes 0 → 1
G04 1 // Task has time to Process not synchrouns M-Function 1->0
M42 // Flag in Memory goes 0 → 1
G04 1 // Task has time to Process not synchrouns M-Function 1->0
M42 // Flag in Memory goes 0 → 1
G04 1 // Task has time to Process not synchrouns M-Function 1->0
M42 // Flag in Memory goes 0 → 1
G04 1 // Task has time to Process not synchrouns M-Function 1->0
=>Task in TC#1 sees 4 occurances , all is fine and no error should occure even M42 is used multiple times.
Greetings
Michael
2 Likes
Thank you both! It works perfectly with some time delay, otherwise really not 