2
$\begingroup$

Given the Marlin Firmware what is the difference between the following lines of code:

G4 S20

and

G4 P2000

$\endgroup$
3
  • 1
    $\begingroup$ You really ought to be able to look up gcode reference tables online! $\endgroup$ Nov 16, 2018 at 13:11
  • 1
    $\begingroup$ Please edit your question to include the firmware you are using so that people can answer the question for your specific case. $\endgroup$
    – 0scar
    Nov 16, 2018 at 13:11
  • $\begingroup$ @CarlWitthoft of course I did prior to asking. $\endgroup$ Nov 17, 2018 at 18:01

2 Answers 2

6
$\begingroup$

The answer is that it depends on the type of firmware you are using.

Let us look at the documentation of G4 to find that G4 is valid for all the listed firmware types: enter image description here

Pause the machine for a period of time.

Furthermore it states that:

Parameters

  • Pnnn Time to wait, in milliseconds (In Teacup, P0, wait until all previous moves are finished)
  • Snnn Time to wait, in seconds (Only on Repetier, Marlin, Smoothieware, and RepRapFirmware 1.16 and later)

It clearly shows that the S parameter (which defines the pause in seconds) is only supported by a few firmware types. Do note that this documentation may not be up-to-date, so it is best to look into the source code or the users manual of the particular firmware you are using.


E.g. if you are using Marlin Firmware, G4 S20 will pause the machine for 20 seconds while G4 P2000 will pause the machine for 2000 milliseconds which is 2 seconds. This means that a different time is requested, to have 20 seconds waiting time you could use G4 P20000

To answer your question what the actual difference between the 2 commands is:

  • it is either 18 seconds of extra waiting time if your firmware supports the S parameter, or
  • a firmware that skips or chokes on the command because it is not supported (that also probably depends on your firmware).
$\endgroup$
1
$\begingroup$

The code G4 refers to dwell. (From what I'm seeing, it can be written as either G4 or G04). Pis the length of dwell time, usually in milliseconds. The parameter S seems to be invalid, because the only inputs are X (seconds), P (milliseconds), or U (undefined). If you have S20 in your code, it is invalid, whereas P2000 will cause all axes to remain unmoving for 2 seconds before moving on.

(Note: Not all machines will accept X or U.)

EDIT: This answer is specific to non-specific g-code, taken from this Source, since the OP did not state any specifics about their firmware type or equipment used.

$\endgroup$
2
  • $\begingroup$ See Oscar's answer -- yours is applicable only to certain firmwares. $\endgroup$ Nov 16, 2018 at 13:12
  • $\begingroup$ I'm curious to know for which firmware(s) this is, could you please add that to your answer. $\endgroup$
    – 0scar
    Nov 16, 2018 at 16:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .