Rigid Tapping G84 Setup and Use

From Dynomotion

Jump to: navigation, search

The KMotionCNC GCode Interpreter can perform Rigid Tapping by invoking a C Program in KFLOP that performs the necessary synchronized motions.

At this time this is under development and is provided as a Patch to Test Version 4.34h.  The Patch DLL (and source changes), C Program Example, and GCode Example are located here:


(Note Version 4.34 and later no longer require a Patch)

Since each system has differences in how rigid tapping is performed a C Program is used to allow flexibility.  A typical difference is how the Spindle is controlled.  Open Loop, Closed Loop, with or without Feedback, etc.  We expect to eventually develop examples for the more common situations.

The GCode Interpreter is hard coded to always invoke the action for MCode M119 to do Rigid Tapping whenever G84 is encountered.  For details see the function convert_cycle_g84() in the Interpreter Source Code.

M119 should be configured to Exec/Wait/Sync your C Program in an available Thread (ie 2).  9 parameters are passed into KFLOP persist Variables before the C Program is invoked starting at the specified Var setting.  50 is recommended but anywhere in the 0-199 range might be used as long as it doesn't conflict with anything else and matches where your C Program expects them to be.

At this point the example C program only prints out the parameters that should be used to perform the Rigid Tap Operation.

    // Call MCode M119 to do Rigid Tapping
    // Var+0 - (int) (MCode number unused)
    // Var+1 - (float) Bottom Z in User Units
    // Var+2 - (float) Retract Position in User Units
    // Var+3 - (float) Distance per Peck in User Units (0 if unspecified)
    // Var+4 - (float) Feed Rate F Number (User Units/Rev)
    // Var+5 - (float) Spindle RPM to Tap
    // Var+6 - (int) Units #define CANON_UNITS_INCHES 1  #define CANON_UNITS_MM 2
    // Var+7 - (int) KFLOP axis to move (derived from active GCode Plane and Coord Motion System defs)
    // Var+8 - (float) Axis Resolution Counts/inch

Here is a Simple G84 Test GCode:

(Test G84 Rigid Tap which call M119 example PrintRigidTapParams.c)
G0 X1 Y1 Z2
G98 G84 Z-1. R.1 Q.1 F.0625

Here is the printout from the example C Program which display the passed parameters:

MCode = -1
Bottom = -1.000000
Retract = 2.000000
Peck = 0.100000
Rate = 0.062500
RPM = 1000.000000
Units = Inches
Axis = 2
AxisRes = 10000.000000

Note: in order to facilitate feed holds during Tapping the The PC will set the MCode Var to -2 when the operator requests a feedhold while tapping.  The C Program that performs the Tap cycle should watch for this and if a -2 is observed pause the tap motion if possible.  The PC may then set the MCode to 0 to instruct the C Program to resume the tapping motions.

Update: Version 4.34 and later no longer requires a Patch.  Here is a related discussion.

Here is an  example C Program update which implements rigid tapping and allows feed hold while tapping: RigidTapCycle+M119 Feedhold Rev 6.c