Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: nik on March 08, 2013, 08:22:08 AM

Title: how to avoid T/M commands execution delay
Post by: nik on March 08, 2013, 08:22:08 AM
hello everyone
currently Im trying to optimize very short lathe G code
total time 40 seconds then a bar puller is used to continue again and repeated many times
in that G code I have several times tool change and several times coolant on/off
I noticed that tool change and M8/M9 commands delay slightly but when many times used cause significant delay
I think currently I loose about 5-6 seconds total,  which is 10-15% time waste, how to avoid that delay?
thanks
Title: Re: how to avoid T/M commands execution delay
Post by: cncalex on March 08, 2013, 08:50:58 AM
Hi nik,
look if you have set a delay in Config > Ports and Pins > Spindle Seup > Fllood Mist Control
If that is set to 0 i have no delay here.
The delay regarding the toolchange depends on your Setup ( toolchange macro )

Alex




Title: Re: how to avoid T/M commands execution delay
Post by: nik on March 08, 2013, 09:02:47 AM
hi
it is already zero there but still have a delay probably 0.3-0.4 seconds or so
I forgot to mention - the spindle is step/dir control if that make any difference
any other ideas?
thanks
Title: Re: how to avoid T/M commands execution delay
Post by: cncalex on March 08, 2013, 10:44:29 AM
Hi,
can you attach your G code.

Alex
Title: Re: how to avoid T/M commands execution delay
Post by: nik on March 08, 2013, 11:05:53 AM
it is on another PC
but here is something similar to show the problem

M3 S3000
G0 Z20
T0606  ;on that line I can notice a little pause
X10
Z-5
M8       ; pause again
G1 X9 F500
Z-20
X8
Z15
M9      ; pause again
G0 X10
Z20



Title: Re: how to avoid T/M commands execution delay
Post by: cncalex on March 08, 2013, 11:50:09 AM
ok, need more input.
Attach your xml and M06start Macro please.

Alex
Title: Re: how to avoid T/M commands execution delay
Post by: nik on March 08, 2013, 12:29:18 PM
here are both files attached
renamed because original name unable to upload
I didnt made any changes to any files
original mach3 R3.043.022 as downloaded
newer versions do not work on that motherboard so I stick to this one

PC is pentium 4 1.7 ghz 512 ram asus motherboard
windows XP installed with all optimizations to run mach3
Title: Re: how to avoid T/M commands execution delay
Post by: BR549 on March 08, 2013, 12:42:45 PM
In later versions of mach3 a Run delay crept in concerning Mcodes.

Just a thought, (;-) TP
Title: Re: how to avoid T/M commands execution delay
Post by: nik on March 08, 2013, 12:49:13 PM
where is set that delay? can I change it somehow?
Title: Re: how to avoid T/M commands execution delay
Post by: cncalex on March 08, 2013, 02:20:57 PM
nik,
No M8 / M9 delay here in ver. .062 so far i can see.
The toolchange Macro you posted has no toolchange content.

Alex

Title: Re: how to avoid T/M commands execution delay
Post by: nik on March 08, 2013, 03:14:04 PM
I dont think there is much difference in versions, if absolutely no delay as you say then a G code with 20 lines only M8/M9 should be executed instantly.....

just checked:

M8
M9
...
...
(20 times m8 and 20 times m9 total)
M02
M30

this G code is executed for 6 seconds

T0101
T0202
T0303
.....
(20 tool changes total)
M02
M30

also executed for 6 seconds

I just counted in my G code I have total around 23 M commands (including tool changes/coolant/spindle) which mean this is roughly 6 seconds delay caused my M commands
Title: Re: how to avoid T/M commands execution delay
Post by: BR549 on March 08, 2013, 05:20:45 PM
We noticed the delay working with plasma cutting. Brian fixed the M3/M5 for verion .067.
Can't say about the rest of the Mcodes.

Just a thought, (;-) TP
Title: Re: how to avoid T/M commands execution delay
Post by: nik on March 08, 2013, 06:11:56 PM
I tried 2 other versions after mine, but they dont work on my motherboard, some driver issues, Im not sure but parallel is not working
if he can confirm that all M codes are fixed I can change the PC and use the last version
I hope he will read that
Title: Re: how to avoid T/M commands execution delay
Post by: nik on March 08, 2013, 06:45:16 PM
just tested with latest version 066 and also do delay on m8/m9/tool change so it look like not fixed :(
ooops you are talking for 067 which is not lock down yet.... Im going to test it now...
Title: Re: how to avoid T/M commands execution delay
Post by: nik on March 08, 2013, 07:08:06 PM
unfortunately exactly same with 067 :(
Title: Re: how to avoid T/M commands execution delay
Post by: cncalex on March 08, 2013, 09:14:35 PM
ah, ok did some testing and foud the delay you talking about. 0.166 sec. per M8/M9 in my case
you can reduce the delay about 33% creating e.g M800 and M900  to turn coolant on/off
or about 85 % by using a brain.

Alex
Title: Re: how to avoid T/M commands execution delay
Post by: nik on March 09, 2013, 05:47:25 AM
I cant find any documentation about brains
I made a brain by using LED as input but same delay, I cant find anything about local variables or what can I use for input
what about tool change delay? actually my lathe do not physically change the tools, they are next to each other on X axis so just need to load compensations from tool table without delay
thanks
Title: Re: how to avoid T/M commands execution delay
Post by: cncalex on March 09, 2013, 10:06:58 PM
Have tried a few things and have found out the delay for the T command is also about 0.166 sec.
I doent read brains documentation, i did that learning by doing.
You can't use a LED in the Brain, because you have to turn it on from your G code with a M command and then you will have the delay.
Let the Brain " watch " for an Axis position. This works here. I activated the B axis. Tuned it to 100 Steps per Unit Max Vel  Max Accel.
You can use G10 to shift your tool without delay. ( easy if you have a gang tool lathe ) all other things have the same delay ( G52 , G54 ...)


T0101
M3 S3000
G0 Z20
G10 L1 P1 X#520 Z#521 ; shift to the next tool
X10
Z-5
G0B1      ; Coolant on
G1 X9 F500
Z-20
X8
Z15
G0B0      ; Coolant off
G0 X10
Z20
M30

or something like this

T0101
M3 S3000
G0 Z[20+#511]
X[20+#510]
Z[-5+#511]
G0B1      ; Coolant on
G1 X[9+#510] F500
Z[-20+#511]
X[8+#510]
Z[15+#511]
G0B0      ; Coolant off
G0 X[10+#510]
Z[20+#511]
             ; next tool
G0 Z[20+#521]
X[20+#520]
Z[-5+#521]
G0B1      ; Coolant on
G1 X[9+#520] F500
Z[-20+#521]
X[8+#520]
Z[15+#521]
G0B0      ; Coolant off
G0 X[10+#520]
Z[20+#521]
M30

Alex
Title: Re: how to avoid T/M commands execution delay
Post by: nik on March 10, 2013, 07:21:03 AM
wow
this is really "out of the box" approach
I will try it soon but I guess it will work, thank you very much for your help

about the tool change - yes it is gang tool lathe, but I wanted to show me the tool number, because some time I stop the program in the middle, then move away manually, select tool manually, move again, make adjustments in G code or tool offset and star over, which using G10 is a bit complicated, but I will think again about that if it is worth
I really appreciate your help, usually nobody care about any software issues







Title: Re: how to avoid T/M commands execution delay
Post by: nik on March 10, 2013, 08:39:49 AM
yes, it is working, coolant on/off executed instantly, only the relay click with a delay, I think longer than before, but that is not a problem at all
that was just a test G code only on/off where normally 0.166 seconds delay

in the real G code where 4 times coolant is used now is executed 3 seconds faster
and another G code where 6 times coolant is used now is executed 5 seconds faster !!! 13% faster !!!

this is only coolant modified, it is so good and Im going to think for the tool change now....

is there any other way(except G10) to change tools, without delay? actually only tool number must be changed and load tool compensations, it is gang tool lathe
thanks

PS:
it look like M3/4/5 execution is not fixed in version 067 and also cause delays
what can I do for spindle start/stop without delay in M commands, step/dir servo motor spindle is used
thanks
Title: Re: how to avoid T/M commands execution delay
Post by: cncalex on March 10, 2013, 04:42:55 PM
the delay for the T word is 0.11 sec. here not 0.16 as i said before. ( 1000 toolchanges = 110 sec.)
So far i can see there is no other way to avoid these 0.11 sec.
( only  one second for 9 tool changes !)
I think you have to deal with the M3/M4/M5 delays.

Alex

Title: Re: how to avoid T/M commands execution delay
Post by: nik on March 10, 2013, 05:12:00 PM
it look like these delays are varying because when only M8/9 used then delay is approx 0.15 sec on mine PC(you say 0.166 on your which is almost the same)
in real G code for 5 on/ff that mean 10 M commands the difference is 5 seconds, which mean 0.5 sec per M command
so I expect same differences with tool change and spindle on/off
I hope someone can help with the rest, until now the difference is good enough, it is worth
Title: Re: how to avoid T/M commands execution delay
Post by: nik on March 10, 2013, 08:00:07 PM
I found option for tool change in the same way
I have not tested yet the delay but now looking for spindle
there is option for spindle on/off only
I cant change direction
is there any way to change spindle direction in brain?
thanks
Title: Re: how to avoid T/M commands execution delay
Post by: nik on March 11, 2013, 10:43:30 AM
unfortunately tool change not working properly that way, I tried many different ways but I cant make it axis movement to change tools in brain
Title: Re: how to avoid T/M commands execution delay
Post by: cncalex on March 11, 2013, 04:42:28 PM
The same thing here.
You can link a brain to an output that switch a high speed relay whitch reverses the direction.
I think there are some relays on the market that switch in a millisecond.
i doent know if that is a save operation.
A better way is to choose your tools so that they use all the same direction.

just a thought

Alex
Title: Re: how to avoid T/M commands execution delay
Post by: nik on March 11, 2013, 07:13:46 PM
hi
I dont need a relay, as I mentioned before my spindle is step/dir control
that mean I only need to change dir signal
unfortunately that dir signal cannot be changed without troubles, already tried
same spindle with same pins is set as A axis
still looking for solution for spindle and tool change
thanks
Title: Re: how to avoid T/M commands execution delay
Post by: nik on March 20, 2013, 06:48:29 PM
just tried with G52 offset instead of change the tools, same delay
Title: Re: how to avoid T/M commands execution delay
Post by: Kenneth on January 21, 2014, 01:45:14 PM
i'm trying to get a dro to count. below works
in editor but not in the file where i have M1001.
skips right over. i have the file saved in
C:\Mach3\macros\MyMill\M1001.m1s
can't understand why it works in editor but not
in the file.
Thanks

' counts M1001  resets M1002
DRO = GetUserDRO(1011)
SetUserDRO(1011 , (DRO + 1))
                     
Title: Re: how to avoid T/M commands execution delay
Post by: Kenneth on January 21, 2014, 03:01:45 PM
i use M1002 to reset to zero. it works in editor and mdi.
and they're in the same location.
Thanks