PDA

View Full Version : G4 Dwell parameters



mmcp42
30-12-2010, 04:44 PM
we all know (??) that G4 is the gcode for dwell
it takes a parameter to indicate the dwell (pause) duration

I have seen various ways of expressing this
I asked in another forum and wasn't entirly happy with the answers
they included - "you can specify seconds or milliseconds"!!

so:
G4 X123 // dwell for 123 seconds or 123 milliseconds?
G4 X123.0 // dwell for 123 seconds or 123 milliseconds?
G4 P123 // dwell for 123 seconds or 123 milliseconds?
G4 P123.0 // dwell for 123 seconds or 123 milliseconds?
which is right?

actually what I really want to know is how to decode the dwell command
(I'm working on a gcode interpreter for an Arduino based controller)

M250cnc
30-12-2010, 05:01 PM
I do not know Arduino but in Mach3 it is specified in the controller (General Config) whether it is seconds or milli seconds

And the code is G04 P50

Phil

mmcp42
30-12-2010, 06:16 PM
I do not know Arduino but in Mach3 it is specified in the controller (General Config) whether it is seconds or milli seconds

And the code is G04 P50

Phil

Thanks Phil,
I guess that would set a dwell time of 50 seconds/milliseconds depending on what is configured?

I had considered hijacking an unused M code to set seconds or milliseconds!

cheers
Mike

stirling
30-12-2010, 09:46 PM
NIST specifies P as seconds. But as said above Mach3 for example allows modification of the way this is interpreted to be secs or ms. However as you're writing the interpreter you could take the view that P can mean whatever you want it to mean. Then whenever you or anyone else writes a POST for your interpreter you/they will write it accordingly.

mmcp42
31-12-2010, 10:29 AM
Hello Striling
Thanks for that

sounds like a definitive source rather than the "I have a mate whose friend said that he read somewhere..."

seconds it is then

(might still have a configuration option for mS - and an Mcode to flip between the two)

is there a standard way of using unused Mcodes - or do you just get on with it?
for example I have already implemented:

M111 to set debug level
M226 pause until user hits Go button
M254 program start (initialise everything)
M255 request current command completion status

stirling
31-12-2010, 11:17 AM
is there a standard way of using unused Mcodes - or do you just get on with it?

The simple answer is - I don't know. The problem with standards is that there are so many of them. I've referred to NIST - but this doesn't mean it's the only one (googlify gcode standards!) - a lot of implementations for example take the view - if it's good enough for Fanuc - it's good enough for me. Certainly some m codes are "standard" in the sense that they mean the same thing in "most" implementations. BUT as far as I'm aware there is no "standard" for using the "unused" codes.

mmcp42
31-12-2010, 01:37 PM
:tongue:

I'll just keep hijacking codes until I see another implementation/definition that uses them!

M250cnc
31-12-2010, 01:54 PM
:tongue:

I'll just keep hijacking codes until I see another implementation/definition that uses them!

What exactly do you need the dwell for as sometimes there are better ways of doing things.

Example, i have a 4 second delay after every toolchange where coolant needs to come on so allows the coolant to flow before the tool starts cutting.

Phil

mmcp42
31-12-2010, 02:04 PM
What exactly do you need the dwell for as sometimes there are better ways of doing things.

Example, i have a 4 second delay after every toolchange where coolant needs to come on so allows the coolant to flow before the tool starts cutting.

Phil

well there are two answers:
a) I want to implement a gcode interpreter "properly" so I need to know what the G4 syntax means
b) I am using Eagle to lay out PCBs; the gcode converter spits out a (G4 P3) delay after starting the spindle
clearly that needs to be 3 seconds not 3 mSeconds!

make sense?

M250cnc
31-12-2010, 02:32 PM
well there are two answers:
a) I want to implement a gcode interpreter "properly" so I need to know what the G4 syntax means
b) I am using Eagle to lay out PCBs; the gcode converter spits out a (G4 P3) delay after starting the spindle
clearly that needs to be 3 seconds not 3 mSeconds!

make sense?

Yes, so you need to configure the control so that P3 is 3 seconds and not 3 milli seconds.

Phil

mmcp42
31-12-2010, 03:49 PM
indeed - already done it!