Skip to main content
CNC.wiki

G04 Dwell G-Code Programming Guide: CNC Brand Differences and Safety

Learn how to program G04 Dwell G-code on Fanuc, Siemens, and Mitsubishi. Explore critical parameters, address syntax, alarms like PS0010, and safety rules.

Hakan Gündoğdu
Hakan Gündoğdu

CNC CARE Co-founder

Introduction to G04 Dwell

In deep-hole drilling and tapping, if a programmer defines a clearance height that is too low and swivels the tool turret below the retraction plane, the tool carrier or turret will drive directly into the vise jaw, fixture clamp, or workpiece chuck, leading to a severe hard collision, a damaged spindle, and a completely scrap part. Similarly, if look-ahead tool nose radius compensation is active, programming three consecutive non-motion blocks like G04 dwells or G10 coordinate shifts will cause the look-ahead buffer to deplete. The control fails to calculate the intersection vectors, triggering cutter compensation alarm codes like Alarm PS5447 and gouging the workpiece. To avoid these catastrophic failures, operators and programmers must master the G04 dwell command, its brand-specific addresses, and critical system parameters.

Technical Summary of G04 Dwell

Technical SpecificationDetails
Command CodeG04 (G4 in Siemens native mode)
Modal GroupGroup 00 (Non-modal)
Supported BrandsFanuc, Siemens, Mitsubishi
Critical ParametersParameter No. 6200 Bit 1 (Fanuc), MD20734 (Siemens), Parameter #1173 (Mitsubishi)
Main ConstraintMust be programmed alone in a block on Siemens and Mitsubishi. Spindle must rotate for revolution-based dwells.

Quick Read: Key Rules and Constraints

  • Address Selection: Use X or U for seconds-based dwells, and P for integer milliseconds; never use a decimal point with the P address.
  • Cutter Comp Buffer: Limit consecutive non-motion blocks to two when G41 or G42 is active to prevent look-ahead buffer depletion and Alarm PS5447.
  • Revolution-Based Dwells: Ensure the spindle is actively rotating during revolution-based dwells; stopping the spindle suspends the dwell countdown.
  • Block Isolation: Write G04 alone in its program block on Siemens and Mitsubishi to prevent command parsing errors.
  • Decimal Scaling Parameters: Verify parameter #1078 (Decpt2) on Mitsubishi to prevent a commanded value from scaling incorrectly (e.g. X500 dwelling for 500 seconds instead of 0.5 seconds).
  • Canned Cycles Address: Always specify the dwell parameter inside canned cycles (G82, G88, G89) using the P address, as the X address is reserved for coordinates.

Basic Concepts of G04 Dwell

A G04 dwell command is a preparatory function that pauses axis motion for a designated period of time or spindle revolutions. During this pause, the machine spindle continues rotating, coolant pumps remain active, and all modal registers retain their status. This functionality is crucial for chip breaking, relief cutting at the bottom of a hole, and ensuring spindle rotational speeds stabilize after a gear range change. Programmers also specify dwells after miscellaneous (M) functions to allow the physical movement of machine components (like barfeeders, tailstocks, chucks, or part catchers) to complete before axis travel resumes.

It is critical that dwells are never programmed to allow a machine operator to perform manual tasks—such as polishing, filing, deburring, part reversal, or chip removal—while the program is running under automatic control. Bypassing safety interlocks in this manner is extremely dangerous, risking severe personal injury, a catastrophic hard collision of the tool turret into a chuck or vise jaw, a damaged spindle, and a scrap part. If manual intervention is required, the operator must safely pause or abort the program.

Command Structure and Syntax

To execute a dwell, the G04 command is programmed along with a time or revolution value. The control system interprets the G04 instruction and stops axis interpolation while counting down the specified pause. The syntax and acceptable addresses vary based on the CNC control brand, machine type (milling or turning), and active feedrate mode. No physical axis motion takes place when a dwell is commanded because the G04 code overrides the default motion interpretation of X and U coordinates.

Dwells can be configured as time-based or revolution-based. Time-based dwells count down in seconds or milliseconds, whereas revolution-based dwells base their duration on the spindle speed, counting spindle rotations instead of time. This is especially useful in threading or deep-hole drilling to ensure the tool performs a precise number of cleaning cuts at the final depth.

; Fanuc Syntax
G04 X1.5 ; Dwell for 1.5 seconds
G04 U0.5 ; Dwell for 0.5 seconds (lathe only)
G04 P2000 ; Dwell for 2000 milliseconds (2.0 seconds)

; Siemens Native Syntax G4 F2.5 ; Dwell for 2.5 seconds G4 S75 ; Dwell for 75 spindle revolutions

; Mitsubishi Syntax G94 G04 X2.5 ; Time-based dwell for 2.5 seconds (G94 mode) G95 G04 P2000 ; Revolution-based dwell for 2000 milliseconds (G95 mode) G95 G04 X3.0 D2 ; Revolution-based dwell on spindle 2 for 3.0 revolutions

AddressDescriptionSystem Context
XSpecifies dwell duration in seconds (accepts decimal points) or milliseconds (if no decimal is used on Fanuc/Mitsubishi).Universal
USpecifies dwell duration in seconds on turning systems (accepts decimal points).Fanuc / Mitsubishi Lathes
PSpecifies dwell duration in integer milliseconds. Does not accept a decimal point.Universal / Canned Cycles
FSpecifies dwell duration in seconds (Siemens native mode).Siemens Native
SSpecifies dwell duration in spindle revolutions (Siemens native mode).Siemens Native
DTargets a specific spindle number (1 to n) for revolution-based dwells.Mitsubishi

Brand-Specific G04 Applications

Fanuc

On Fanuc systems, G04 is a non-modal Group 00 command. Tapping cycle dwells are managed by Parameter No. 6200 Bit 1 (DWL).

To program a dwell on Fanuc, use the syntax G04 X_, G04 U_, or G04 P_. For example, G04 X1.5 pauses for 1.5 seconds, while G04 P1500 pauses for 1.5 seconds (1500 milliseconds) without accepting a decimal point.

CategoryCode / Parameter / AlarmDescription / Condition
ParameterParameter No. 6200 Bit 1 (DWL)Enables dwelling with P address inside G84 and G84.2 tapping cycles in Series 15/15-T formats.
ParameterParameter No. 5000 Bit 3 (GNI)Controls look-ahead path behavior during cutter compensation. Set to 0 returns tool to previous block position on G40 no-motion blocks.
ParameterParameter No. 5105 Bit 3 (M5T)Determines if spindle stop command (M05) is executed before spindle direction change during tapping.
AlarmAlarm PS0010Improper G-code specified (G-code not on active card or no software option).
AlarmAlarm PS5257G41/G42 attempted directly from MDI mode while Parameter No. 5008 Bit 4 (MCR) is set to 1.
AlarmAlarm PS5447Dangerous avoidance at G41/G42 where vector path deviates by 90 to 270 degrees due to acute angle/narrow pocket.
AlarmAlarm PS0011Feed zero (command) where cutting feed command exceeds maximum limits.
Version DifferenceSeries 15 vs Series 15-TSeries 15 supports G83, G83.1, G84, G84.2 dwell with P. Series 15-T does not support G83/G83.1 dwell, and treats P as modal in G84/G84.2.

Warning: Programming more than two consecutive blocks without axis movement (such as dwells, M-codes, or G10 commands) while cutter radius compensation G41 or G42 is active will deplete the look-ahead buffer, causing a cutter compensation alarm and workpiece gouging.

Siemens

On Siemens systems, G04 is native as G4 and operates as a non-modal motion command. The behavior of the ISO Dialect mode parser is controlled by machine data MD20734.

Siemens native mode uses G4 F... for a dwell in seconds, and G4 S... for a dwell in spindle revolutions. In ISO Dialect mode, it accepts G04 X... and G04 P... syntax.

CategoryCode / Parameter / AlarmDescription / Condition
ParameterMD20734 Bit 2Dictates G04 time interpretation in ISO Dialect mode: 0 = always seconds; 1 = seconds with G94, revolutions with G95.
ParameterMD20734 Bit 3Controls ISO Dialect scanner: 0 = scanner errors generate alarms; 1 = scanner errors are bypassed to native Siemens translator.
ParameterMD20150 [13]Sets the default state of G group 2 (non-modal motion commands and dwell, e.g. G4) at run-up and reset.
AlarmAlarm 12080Syntax error in ISO Dialect mode (G291) if scanner encounters unmapped command while MD20734 bit 3 is 0.
AlarmAlarm 14800Programmed path velocity is less than or equal to zero (F0 active or omitted) when transitioning to cutting block after G4.
Version Difference802D sl vs 840D sl / 828DG93 inverse-time feedrate is supported on 840D sl and 828D but not implemented on 802D sl. MD10604 is read-only on 802D sl.

Warning: If a revolution-based dwell (G4 S... or G04 in G95 mode) is programmed, any spindle stop condition will suspend the countdown. The dwell will hang the machine until the spindle starts rotating again.

Mitsubishi

On Mitsubishi controls, G04 must be programmed in its own block. Dwell skip behavior is controlled by parameter #1173 (dwlskp).

Mitsubishi supports G94 G04 X_ or G94 G04 P_ for time-based dwells, and G95 G04 X_ D_ or G95 G04 P_ for revolution-based dwells.

CategoryCode / Parameter / AlarmDescription / Condition
ParameterParameter #1173 (dwlskp)Dwell Skip. Determines whether an active dwell can be canceled by an external skip signal (0 or 1).
ParameterParameter #1436 (mstsyn)Determines whether an override percentage can be dynamically applied to programmed dwell time.
ParameterParameter #8130Dwell in rev. Dictates whether revolution-based dwell is applied automatically in synchronous feed (G95) mode.
ParameterParameter #8112DECIMAL PNT-P. Controls whether decimal point commands are valid for address P.
ParameterParameter #1078 (Decpt2)Determines default scaling of decimal values without a decimal point. 0 = X500 is 0.5s; 1 = X500 is 500s.
ParameterParameter #19014Scales the setting unit of the commanded P address by a power of 10.
AlarmMCP Alarm Y51 15Skip time constant parameter #2102 skip_tL configured with illegal value during skip operations.
AlarmMCP Alarm Y51 16Skip response time constant parameter #2103 skip_t1 contains illegal value during skip operations.
AlarmProgram Error P35Coordinate value or skip signal parameter address P is out of range.
AlarmProgram Error P603Skip feedrate F command or skip parameter #1174 skip_F is 0 during measurement or torque limit skip.
AlarmProgram Error P33G10 parameter input blocks are not commanded in independent blocks, or G20/G21 issued in same block as subsequent motion.
Version DifferenceM8 Series vs C80 SeriesSequence number N allows up to 8 digits on M8 Series but is limited to 6 digits on C80 Series. G26 retract-and-recover and dynamic parameter input cycle G10 L50 have model-specific availability.

Warning: Attempting to run coordinates setting or parameters like G10 inside a dwell block will trigger Program Error P33, causing immediate cycle termination.

Cross-Brand Comparison of G04 Dwell

Feature / CapabilityFanucSiemensMitsubishi
Dwell Address TogglingRestricted to parameters and canned cycles.Supported natively using F (seconds) and S (revolutions).Supported using D address to target specific spindle and override feed mode.
ISO Scanner Error HandlingErrors in unmapped codes instantly stop program execution.Unique ISO scanner error bypass via machine data MD20734 bit 3 to native compiler.— (no source)
HMI Dwell DisplayNo standard active countdown display.Countdown displayed directly on operator panel.— (no source)
Skip Signal Dwell Cancel— (no source)— (no source)Supported dynamically via parameter #1173 dwlskp and skip signals.
Hole-Bottom Canned Cycle DwellModal dwell inside tap cycles enabled via parameters.Programmed via cycle parameters like DT, DTB, or DTS.Hole-bottom dwell override integration comparing P with #1313 TapDwl.

Technical Analysis of Dwell Behavior and Mechanics

An analytical comparison of these control systems highlights major differences in how dwells are parsed and executed. On Fanuc turning systems under the standard G-code System A, absolute and incremental mode codes G90 and G91 are replaced by direct address characters X/Z and U/W. Programming a G90 command on a Fanuc lathe executes an outer diameter roughing cycle, rather than setting absolute coordinate input. Siemens and Mitsubishi controls handle absolute and incremental positioning differently, using modal G90 and G91 commands. Mitsubishi provides parameter #1076 (AbsInc) to toggle between address-based and G-code-based coordinate systems, giving programmers flexibility depending on their shop standards.

Siemens also offers a unique, flexible compilation process. By using transitional G-codes G290 and G291, a Siemens controller can switch between native Sinumerik mode and ISO Dialect mode, allowing standard ISO G-codes (like G04 X... or P...) to be executed within native Sinumerik subprograms. Siemens also features machine data MD20734 bit 3, which can bypass scanner errors and forward unmapped commands directly to the native Siemens translator instead of triggering an immediate compile error. Mitsubishi, on the other hand, stands out by supporting real-time dwell cancellation. Through parameter #1173 (dwlskp), an active dwell command can be instantly skipped if an external sensor or touch-probe signal is received, preventing unnecessary cycle time delays.

Program Examples and Dry Run Verification

Below are programming examples for Fanuc, Siemens, and Mitsubishi. These examples illustrate the correct structure and syntax required to execute dwells on each control system.

Fanuc Example

; Fanuc Milling Time-Based Dwell
G90 G01 X150.0 Y100.0 Z-5.0 F300.0 ; Linear move at 300 mm/min
G04 X1.5                           ; Dwell for 1.5 seconds
G01 Z-10.0 F150.0                  ; Next linear move at 150 mm/min
G04 P2000                          ; Dwell for 2000 milliseconds (2 seconds)

dry run: Verification on a Fanuc system shows that the tool executes a linear interpolation to coordinates X150.0, Y100.0, and Z-5.0 at a feedrate of 300 mm/min. Once the position is reached, axis motion stops for 1.5 seconds while spindle rotation and coolant remain active. Axis motion then resumes with a Z-axis feed to -10.0 at 150 mm/min, followed by another axis dwell pause of 2000 milliseconds (2.0 seconds) before the next block executes.

Siemens Example

; Siemens Native Cartesian Milling
G17 G94 G1 X150.0 Y100.0 Z-5.0 F500.0 M3 S1000 ; Move at 500 mm/min, spindle 1000 RPM
G4 F2.5                                        ; Dwell for 2.5 seconds
G1 Z-12.0 F200.0                               ; Next move at 200 mm/min
G4 S75                                         ; Dwell for 75 spindle revolutions

dry run: Verification on a Siemens control demonstrates that the axes move to absolute positions X150.0, Y100.0, and Z-5.0 in the XY plane (G17) at a cutting feedrate of 500 mm/min, with the spindle rotating clockwise at 1000 RPM. Axis travel then pauses for 2.5 seconds. Motion resumes with Z-axis travel to -12.0 at 200 mm/min, followed by a spindle-revolution-based dwell. The axis motion halts for exactly 75 spindle rotations (75 revolutions × 60 seconds / 1000 RPM = 4.5 seconds) before proceeding.

Mitsubishi Example

; Mitsubishi Time-Based and Revolution-Based Dwell
G90 G01 X50.0 Z20.0 F300.0 ; Absolute linear move at 300 mm/min
G94 G04 X2.5               ; Time-based dwell for 2.5 seconds
G91 G01 Z-5.0 F150.0       ; Incremental move at 150 mm/min
G95 G04 X3.0 D2            ; Revolution-based dwell of 3.0 revolutions on Spindle 2

dry run: Verification on a Mitsubishi system confirms that the tool performs an absolute linear move to X50.0 and Z20.0 at 300 mm/min. The machine then executes a time-based dwell, suspending axis feed for 2.5 seconds. Axis motion resumes with an incremental Z-axis movement of -5.0 at 150 mm/min, followed by a revolution-based dwell of 3.0 revolutions targeted at Spindle 2 before the next NC block is processed.

Error Analysis and Troubleshooting Guide

BrandAlarm CodeTrigger ConditionOperator SymptomRoot Cause / Fix
FanucAlarm PS0010G-code programmed is not listed on active card or no software option exists.Immediate cycle stop; HMI displays "IMPROPER G-CODE".Verify G-code syntax and ensure the software option for G04 is enabled on the control card.
FanucAlarm PS0011Feed zero command where cutting feed exceeds maximum limits or is omitted.Immediate axis pause; HMI displays "FEED ZERO (COMMAND)".Specify a valid, non-zero feedrate F code before or during the first G01/G02/G03 movement.
FanucAlarm PS5447Look-ahead buffer depletion during tool radius compensation with consecutive dwells/non-motion blocks.Axes stop; HMI displays "DANGEROUS AVOIDANCE AT G41/G42".Avoid programming more than two consecutive non-motion blocks (like G04 dwells or G10 offsets) while G41/G42 is active.
SiemensAlarm 12080Unmapped command encountered in ISO Dialect mode (G291) while MD20734 bit 3 is set to 0.Parser halts execution; HMI displays syntax error.Correct G-code syntax, check mapping, or set machine data MD20734 bit 3 to 1 to bypass scanner errors.
SiemensAlarm 14800Path velocity is less than or equal to zero after G4 when transitioning to a cutting block.Channel stops; HMI displays path velocity error.Ensure modal feedrate F is active, or reprogram feedrate in the block immediately following the dwell.
MitsubishiProgram Error P62Execution of G01/G02/G03 with a feedrate of zero.Machine execution halts; HMI displays "FEEDRATE ZERO / MISSING F COMMAND".Program a non-zero feedrate F code in the motion block or prior blocks to establish active modal feed.
MitsubishiProgram Error P33G10 parameter input blocks are not commanded in independent blocks, or coordinates setting issued in motion block.Halt of axis movements; HMI displays coordinate system programming error.Write G10 parameter changes and coordinate offsets in separate, isolated blocks. Do not combine them with dwells.

Application Note: Safe Setup and Retraction Procedures

A severe hard collision, a ruined spindle, and a completely scrap part often occur because of incorrect retraction commands, such as an operator using absolute coordinates like G00 rapid positioning (specifically G90 G28 Z0) to return the tool turret to reference zero. This commands the tool to drive directly through the workpiece Z0 surface, causing an immediate crash. To guarantee safe operation during automated cycles, programmers must command incremental retraction codes, such as G91 G28 Z0 on mills or G28 U0 W0 on lathes. Furthermore, in automatic barfeeding sequences, coordinating G04 dwells with Chuck open (M10) and Chuck close (M11) functions is critical. Programmers must stop the spindle (M05), open the chuck (M10), dwell (G04 U0.1) to allow the barfeeder to push stock against the turret stop, close the chuck (M11), and execute a final dwell (G04 U1.0) to ensure clamping pressure builds fully before spindle rotation (M03) restarts. Similarly, tailstock operations require precise dwells: commanding the body forward (M21) followed by a dwell (G04 U2.0) to seat, and quill extension (M12) followed by a dwell (G04 U1.0) to support the workpiece before cutting. Bypassing safety interlocks by programming dwells to perform manual chip removal or deburring while the machine is running under program control risks severe operator injury and catastrophic machine damage. To physically protect chucks and vise jaws, programmers should define electronic boundaries using G22 and G23 Chuck and Tailstock Barrier functions. Entering these zones will trigger a stroke limit alarm, preventing a collision.

Related Command Network

  • G00 Rapid Traverse Positioning: Cancels the active dwell state and moves the axes to coordinate targets at maximum machine velocity.
  • G01 Linear Interpolation: Cancels the non-modal G04 dwell command and initiates linear feedrate travel using the active F code.
  • G10 Parameter Management: Allows programmers to write tool offsets and coordinate offsets directly in the G-code program, though it must not be combined with G04 in the same block.
  • G82 Drilling Cycle with Dwell: Performs a feedrate motion to the bottom of a hole and executes a built-in dwell pause using the P address before rapidly retracting.
  • G94 / G95 Feedrate Modes: Sets feedrate units to time-based (mm/min) or revolution-based (mm/rev), which directly dictates how G04 dwell addresses are scaled and interpreted.

Conclusion

Standardizing G04 dwell syntax and verifying control parameter settings before running a program are essential practices for maximizing tool life and preventing collisions on the shop floor. Operators must verify decimal point scaling parameters and buffer limits during setup. Lowering feedrate overrides and using Single Block execution during the first part run will catch modal errors and prevent scrapped workpieces.

Frequently Asked Questions

Why does the machine hang indefinitely during a G04 revolution-based dwell?

This occurs when the spindle is stopped or in an idle state. Since a revolution-based dwell (G4 S... or G04 in G95 mode) counts spindle rotations, the countdown is suspended if the spindle speed is zero. Action: Ensure the spindle is rotating before commanding a revolution-based dwell, or switch to a time-based dwell using a seconds-based address (X or U) or milliseconds (P).

Why does programming a decimal point in G04 P1.5 cause a timing error?

On Fanuc, Siemens, and Mitsubishi controls, the P address does not accept decimal points. Programming P1.5 will cause the control to ignore the decimal point and interpret the value as 1 or 15 milliseconds, resulting in a dangerously short pause. Action: Always specify milliseconds as a whole integer when using the P address (e.g., use P1500 for a 1.5-second dwell) and verify scaling parameters like #8112 (DECIMAL PNT-P) on Mitsubishi.

Can G04 dwells be used to resolve cutter compensation alarms?

No. In fact, G04 dwells can trigger cutter compensation alarms. Programming consecutive non-motion blocks (such as G04 dwells, M-codes, or G10 offset updates) while tool nose radius compensation (G41/G42) is active will deplete the look-ahead buffer, causing a compensation error like Alarm PS5447. Action: Limit consecutive non-motion blocks to a maximum of two while compensation is active, and perform any necessary dwells before initiating compensation or after canceling it with G40.

Still not resolved?

Ask our AI assistant about this topic in natural language. Grounded in verified sources, no hallucinations.

Ask AI Assistant
Hakan Gündoğdu
Hakan Gündoğdu
  • CNC CARE Co-Founder (May 2025 - Present)
  • Mitsubishi Electric NC Sales & Service Section Manager (2008 - 2025)
  • Reis CNC Service Engineer (2003 - 2008)
  • Ören Kalıp CNC Mold Line Team Leader (1999 - 2002)

With over 25 years of experience working in all areas of the CNC machine industry, I continue my activities as a co-founder of CNC CARE, where we offer brand-independent consulting, engineering, and original spare parts services.

Related Articles

Other articles on this topic