m66 variables

More
03 Dec 2014 05:21 #53615 by jd896
m66 variables was created by jd896
hi there if using the following 0 word sub to control the thc and plasma torch on my profiler i have used the arc auto retry the somebody wrote and supplied on here (sorry there name slips me)

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 ?
o<startcut> sub
#<arc-fails> = 0
o100 do
	M66 E0 L0 (pass variable #5399)
	M64 P1 (turn on cap height control - D out 1)
	G4 P3.1 (pause for height control)
	m65 p1 (turn off height control probe for height only)
	M64 P2 (raise torch to for pierce - D out 2)
	G4 P0.1 (pause for torch movement)
	M65 P2 (stop torch up movement)
	M64 P0 (start plasma - D out 0)
	G4 P#5399 (pause for pierce time)
	M66 P0 L4 Q2 (wait 2 seconds for arc ok)
		o200 if [#5000 EQ -1] (check for transfer fail)
		(MSG, Arc Transfer Failed)
		m65 p0 (turn off arc)
		M65 P1 (turn cap height off - D out 1)
		#<arc-fails> = [#<arc-fails> + 1]		
			o300 if [#<arc-fails> GT 3.0000] (check for four fails in row)
			M64 P2 (raise torch to clearance - D out 2)
			G4 P2 (pause for torch movement)
			M65 P2 (stop torch up movement)
			M1 (pause)
			o300 endif
		o200 endif
	o100 while [[#5000 EQ -1]]
M64 P1 (turn on cap height control - D out 1)
o<startcut> endsub
m2

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 or Create an account to join the conversation.

More
03 Dec 2014 08:21 #53625 by andypugh
Replied by andypugh on topic m66 variables

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)
The following user(s) said Thank You: jd896

Please Log in or Create an account to join the conversation.

More
03 Dec 2014 15:50 #53634 by jd896
Replied by jd896 on topic m66 variables
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 rather than having to change and then reload the program or change before the program is loaded ?

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 or Create an account to join the conversation.

More
03 Dec 2014 18:15 #53635 by andypugh
Replied by andypugh on topic m66 variables

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 or Create an account to join the conversation.

More
04 Dec 2014 02:34 #53651 by jd896
Replied by jd896 on topic m66 variables
ive changed the code in my sub and can now control pierce time with the spinbox as i wanted to,

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
o<startcut> sub
#<arc-fails> = 0
M66 E0 L0 
#1 = #5399
o100 do
	M64 P1 (turn on cap height control - D out 1)
	G4 P3.1 (pause for height control)
	m65 p1 (turn off height control probe for height only)
	M64 P2 (raise torch to for pierce - D out 2)
	G4 P0.1 (pause for torch movement)
	M65 P2 (stop torch up movement)
	M64 P0 (start plasma - D out 0)
	M66 P0 L4 Q2 (wait 2 seconds for arc ok)
	o200 if [#5399 EQ -1] (check for transfer fail)
		(MSG, Arc Transfer Failed)
		m65 p0 (turn off arc)
		M65 P1 (turn cap height off - D out 1)
		#<arc-fails> = [#<arc-fails> + 1]		
			o300 if [#<arc-fails> GT 3.0000] (check for four fails in row)
			m65 p0(turn off arc )
			M64 P2 (raise torch to clearance - D out 2)
			G4 P0.5 (pause for torch movement)
			M65 P2 (stop torch up movement)
			M1 (pause)
			o300 endif
		o200 endif
	o100 while [[#5399 EQ -1]]
	G4 P#1 (pause for pierce time)
	M64 P1 (turn on cap height control - D out 1)
o<startcut> endsub
m2

Please Log in or Create an account to join the conversation.

More
04 Dec 2014 02:57 #53653 by andypugh
Replied by andypugh on topic m66 variables

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 or Create an account to join the conversation.

Time to create page: 0.074 seconds
Powered by Kunena Forum