- Posts: 51
- Thank you received: 0
m66 variables
my question is i have a spinbox on the gui to set the plasma delay that is picked up in the sub with a m66 E0 (spinbox connected to motion an 00 pin)
the o while code the counts the acr fails wants to use the same variable #5399 (the same as the m66 uses)
what other variables can i use ?
looking again at this code i'm not sure i can follow it,
the line i changed was - G4 P#5399 (pause for pierce time), before this was - G4 P2 (pause for pierce time)
and where i have placed #5000 this used to be #5399 before i added the spinbox for pierce delay and the arc fail counting used to work
so what other variables can i use ? can i just change the #5000 to #1 if i declare it at the start of the subroutine, ie (#1 arc-fail-count)
many thanks
Please Log in to join the conversation.
jd896 wrote: the o while code the counts the acr fails wants to use the same variable #5399 (the same as the m66 uses)
Variables above #5000 are special, and are probably best not used except for their intended use.
The normal way to use an M66 would be something like
M66 E0 L0
#1 = #5399
M66 E1 L0
#2 = #5399
G4 P#1
o200 if [#2 GT #1]
...
ie, pull the value out of #5399 and store it in a local variable as soon as you read it.
(be aware that #5399 it only changes when you do an M66, it doesn't "follow" the value of the input pin)
Please Log in to join the conversation.
thanks again andy without you a few others on here i dont think this would have ever been running let alone having it as tailored to the job its doing like it is now
Please Log in to join the conversation.
jd896 wrote: thanks andy ill try that is there anyway of passing a value from spinbox in to a sub that does follow the value of the pin ? ie if i change whilst a program is running the timing would change
No.
The reason is that all the moves are worked out ahead of time, then put in a queue for the real-time system to run them. So, when you see the machine running it is often doing a move relating to a G-code instruction that was read by the interpreter hours ago.
The exception to this is the over-ride values (feed, spindle, etc) which are used to modify the currently executing moves.
My understanding is that the system does not queue past an M66, so that the value used will always be what was on the pin at the time the G-code was executed, not when it was read in.
This is something that perhaps the docs should clarify.
So, the M66 command defines a synchronisation point between the GUI and the realtime motion. If you want to react to it "live" then you need to explicitly read it every time your code is due to act on it.
It is possible to read HAL pins directly from G-code. This has exactly the same problems, but with no way to force a synch so can behave in rather unexpected ways. It can be convenient but you need to be aware of the limitations.
Please Log in to join the conversation.
the problem being is that the routine that is used for tracking arc fails is no longer working as this used to use the variable #5399
from what i have worked out is that is used #5399 as this is persistant outside of the oword sub it is being used in (i think)
because if i give it a variable for it say - #2 i have to declare a value for it and because i have declared a value the counter doesn't count as i'm resetting it everytime the loop comes round
i've tried a few ways and am stumped i need another variable like #5399 that is persistent outside my o word
ive looked for a list of linuxcnc variables but cannot seem to find one (perhaps im not looking in the right place)
thanks
here is the oword sub i use to contol the thc and plasma logic on the profiler as of todays changes
Please Log in to join the conversation.
jd896 wrote: from what i have worked out is that is used #5399 as this is persistant outside of the oword sub it is being used in (i think)
because if i give it a variable for it say - #2 i have to declare a value for it and because i have declared a value the counter doesn't count as i'm resetting it everytime the loop comes round
i've tried a few ways and am stumped i need another variable like #5399 that is persistent outside my o word
Variables #1 to #30 are local to the subroutine.
If you want a variable with global scope then use a number >= #31 and <= 5000.
Or you can use named parameters.
www.linuxcnc.org/docs/html/gcode/overview.html#sec:parameters
Please Log in to join the conversation.
