Tool Setup Screen

(Click on Image to Jump to related help)

The Tool Setup Screen allows KMotionCNC to be configured for a particular machine tool. Each machine tool is likely to have different motion resolution, speeds, and acceleration limits. It is also likely to different I/O requirements with regard to Spindle control and such. Additionally a machine may have different initialization and homing requirements. KMotionCNC has a flexible mechanism for defining what type of action is to be performed for various M Codes and Custom Buttons.

Tool Table File

The Tool Table File specifies the disk text file which contains the table of tool definitions. In some cases the G Code Interpreter needs to know the length and diameter of the selected tool for tool path compensation. This file is used to define up to 99 tools. See also Selecting Tools.

See below for an example Tool Table

POC FMS LEN DIAM COMMENT

1 1 0.0 0.0 first tool

2 2 0.0 0.0

3 3 1.0 0.5

4 4 2.0 1.0

32 32 0.0 0.0 last tool

Setup File

The Setup File specifies the disk text file which contains the setup table for the G Code Interpreter. In some machine tools the Interpreter may require a special initialization state. Below is the default Setup file. Modifications to the setup file should not normally be required.

Attribute Value Other Possible Values
axis_offset_x 0.0 any real number
axis_offset_y 0.0 any real number
axis_offset_z 0.0 any real number
block_delete ON OFF
current_x 0.0 any real number
current_y 0.0 any real number
current_z 0.0 any real number
cutter_radius_comp OFF LEFT, RIGHT
cycle_r 0.0 any real number
cycle_z 0.0 any real number not less than cycle_r
distance_mode ABSOLUTE INCREMENTAL
feed_mode PER_MINUTE INVERSE_TIME
feed_rate 5.0 any positive real number
flood OFF ON
length_units MILLIMETERS INCHES
mist OFF ON
motion_mode 80 0,1,2,3,81,82,83,84,85,86,97,88,89
plane XY YZ, ZX
slot_for_length_offset 1 any unsigned integer less than 69
slot_for_radius_comp 1 any unsigned integer less than 69
slot_in_use 1 any unsigned integer less than 69
slot_selected 1 any unsigned integer less than 69
speed_feed_mode INDEPENDENT SYNCHED
spindle_speed 1000.0 any non-negative real number
spindle_turning STOPPED CLOCKWISE, COUNTERCLOCKWISE
tool_length_offset 0.0 any non-negative real number
traverse_rate 199.0 any positive real number

Geo File

Geometric correction file. Allows correcting errors in the the x,y,z positions. The callibration procedure involves moving the tool tip to an xy array of positions. For example, a precision grid might be printed on a glass or Mylar plate. By Jogging the tool tip to each row and column grid point and recording the machine's x,y,z position, a table of machine coordinates that correspond to perfect coordinates may be obtained. The "measure" button on the main KMotionCNC Screen may be used to log these positions. If such a table is specified here, the system will correct machine coordinates by bilinear xy interpolation of this table. Z is corrected for flatness at the plane of z=0 only.

The table format is shown below. The first line specifies the number of rows and columns in the table. The second line specifies the delta x and delta y between gridpoints. An the remaing lines are row, column, x, y, z table entries.

5,5
1,1
0,0,-1.767822,-2.129132,-0.331770
0,1,-0.878572,-2.068192,-0.262691
0,2,0.036983,-1.979272,-0.234576
0,3,0.930314,-1.909252,-0.237177
0,4,1.836404,-1.805593,-0.236061
1,0,-1.774018,-1.155364,-0.219091
1,1,-0.882401,-1.073801,-0.179651
1,2,0.021794,-0.987806,-0.141523
1,3,0.918408,-0.885504,-0.130446
1,4,1.792961,-0.811495,-0.124016
2,0,-1.771149,-0.166872,-0.121132
2,1,-0.883159,-0.075746,-0.074570
2,2,0.007254,0.005231,-0.051105
2,3,0.889548,0.097292,-0.035076
2,4,1.762710,0.190093,-0.016807
3,0,-1.761705,0.784817,-0.086695
3,1,-0.885633,0.869580,-0.025417
3,2,0.001747,1.008045,0.017727
3,3,0.880585,1.108997,0.059038
3,4,1.742520,1.204385,0.058162
4,0,-1.729192,1.783193,0.021364
4,1,-0.871298,1.868678,0.054451
4,2,0.005017,1.979718,0.104414
4,3,0.878944,2.104289,0.141666
4,4,1.714383,2.182679,0.144980

Axis Motion Parameters

The Axis Motion Parameters define the scale, maximum feed velocities, and maximum feed accelerations for each of the four axis.

The first parameter is the axis's scale in counts/inch. For the example value of 100 shown, KMotionCNC will command the motion controller to move 100 counts for each inch of motion in the G Code Program. This value is always in counts/inch regardless of the units used in the interpreter. KMotionCNC will automatically perform any conversions.

The second parameter is the maximum allowed feed rate for the axis in inches/sec. Note that the G Code Interpreter Feed Rate is defined in inches per minute or (mm per minute) so be aware of the different time units. These are maximum feed rates for each axis. If a vector tool motion at a particular feed rate has any component velocity that exceeds the corresponding axis's maximum velocity, the feed rate for the vector will be reduced so that all axes remain at or below their maximum allowed velocity.

The third parameter is the maximum allowed acceleration for the axis in inches/sec2. The G Code Language has no provisions for specifying acceleration rates. Therefore the acceleration (and deceleration) along a vector used will always be the largest acceleration such that each axis's acceleration is at or below the specified limit.

The velocity and acceleration limits apply only to linear and circular feed motions (G1, G2, G3). Rapid motions (G0) use the settings in the motion controller (velocity, acceleration, and Jerk) to move each axis independently from one point to another (which is likely not to be a straight line). To change the speed of Rapid motions change the configuration settings in the motion controller.

Trajectory Planner

KMotionCNC contains a powerful Trajectory Planner. The Trajectory Planner utilizes a "break angle" concept to decide when a stop must be made. Vectors that are in the same direction within the "break angle" are traversed without stopping. When a "sharp" angle is detected a complete stop will be made before beginning on the next vector. The Break Angle Parameter allows the user to specify the angle in degrees that will be considered a "sharp" angle. KMotionCNC considers the change in direction in 3 dimensions (x,y,z ignoring a). The Trajectory Planner is capable of optimizing the acceleration and deceleration through many short (or long) vectors all of which may have different acceleration and velocity limitations.

The Trajectory Planner also has a "lookahead" parameter. With KMotionCNC the G Code Program itself, the G Code Interpreter, and the Trajectory Planner all reside within the PC running Microsoft Windows™. Since the Microsoft Windows™ is not a real-time OS, a certain amount of motion must be buffered in the motion controller to handle the cases where the PC program doesn't have a chance to execute for a while. These time periods are typically very short (a few milliseconds), but in some extreme cases may occasionally be as long as one or several seconds. The worst case is often a factor of the hardware (disk network adapters, etc) and associated drivers that are loaded into the system. The lookahead parameter is used to determine how much motion, in terms of time, should be downloaded to the motion controller before actual motion is initiated. Furthermore, after motion has begun, the lookahead parameter is used to pause the trajectory planner to avoid having the Trajectory Planner get too far ahead of the actual motion. The disadvantage of having the Trajectory Planner get too far ahead is that if the User decides to override the feed rate, since the motion has already been planned and downloaded, the rate will not be changed quickly. A value of 3 seconds is very conservative on most systems. If more responsive feed rate override is desirable, an experiment with a smaller value might be made.

"Collinear Tolerance" allows GCode blocks that are nearly linear, to be combined into a single linear segment to allow faster and smoother motion. Often GCode programs generated by 3D CAD systems contain very small vectors that appear jagged or noisy due to numerical round off errors . See below for an example of a small GCode fragment from an intended circle. The 0.3 inch diameter circle was divided into 10,000 sides each only 0.0001 inches in length. Intuitively one would think this would result in an extremely smooth contour. Ironically, rounding off to 4 decimal digits introduces "noise" that results in sharp angles and each axis being required to repeatedly stop and start. Even with quite high acceleration, stopping and starting over short distances results in extremely low average speed and most likely a rough surface. A combined segment shown below in blue will result in a faster and smoother motion.

Segments are combined as long as all intermediate waypoints do not deviate from the combined segment by more than the allowed collinear tolerance. Setting the collinear tolerance to zero will disallow any segments from being combined.

N70 G90 G54 G0 X6.315 Y4.7132 Z1.
N100 G1 X6.3151 F60.
N110 Y4.7133
N120 X6.3152 Y4.7134
N130 Y4.7135
N140 X6.3153 Y4.7136
N150 Y4.7137
N160 X6.3154 Y4.7138
N170 X6.3155 Y4.7139
N180 Y4.714
N190 X6.3156 Y4.7141
N200 Y4.7142
N210 X6.3157 Y4.7143
N220 Y4.7144
N230 X6.3158

G Code Actions

The G Code Actions section of the Tool Setup Screen defines what action is to be performed when a particular G Code Command (Mostly M Codes) is encountered. The Action that can be performed can be one of several things:

- None
- Set or Reset one I/O Bit
- Set or Reset two I/O Bits
- Set a DAC to a variable's value
- Execute a C Program in the KMotion Control Board

To specify a particular action first select the Action Type. Each Action Type requires a different number and type of parameters. Next fill in the appropriate parameters. The one and two bit I/O commands are inserted directly into the coordinated motion control buffer. In this way they are exactly synchronized with any motion before or after the I/O commands. This is useful in systems where a fast shutter or other operation is required at precise times relative to the motion.

The four Action Types are described below:

For one I/O bit specify the I/O bit number and the state 0 or 1 to set it to.

For two I/O bits specify the I/O bit numbers and the state 0 or 1 to set each to. Often systems with two direction spindle control will require setting two outputs that control on/off and cw/ccw. This command is designed to handle those situations.

For DAC specify the DAC (Digital to analog converter) channel number, how to scale and offset the associated variable, and the minimum and maximum allowed DAC settings. This command is primarily designed for use with the S (Spindle speed) G Code Command

For Execute Prog specify the program Thread (1 through 7) where the program is to be downloaded and executed, a Persist Variable (1-99) that will be set before the program executes, and the name of the C Program to be Compiled, Downloaded, And Executed. If the Filename is left blank, then it will be assumed that a program has been previously downloaded and will just be re-executed. This method is very powerful in that anything that may be programmed in C may be invoked. See the KMotion documentation for information on writing C Programs for the KMotion Motion Control Board. There are a number of example C programs in the <Install Dir>\C Programs folder. The Example "Setup Gcode 4 axis.c" s an example which completely configures all necessary parameters on the KMotion Board to drive 4 stepping motors.

Custom Buttons

Custom Button Actions function in exactly the same manner as the G Code Actions described above with the only difference being that they are invoked by the User pushing a button rather than by a command encountered within a G Code Program. There is an additional Parameter on the very left of the Action Type which is the Title to be placed on the Custom Button. The example above shows two buttons defined with titles "INIT" and "HOME". Up to 5 buttons may be defined. Common uses for the Buttons are to invoke programs that initialize and/or home the machine. Any Button with an empty title field will cause the button to be hidden on the main KMotionCNC screen. See here for how these defined buttons will appear in the main KMotionCNC Screen.

Jog Speeds

Defines the Jog Speeds for both the Jog Buttons and any attached Gamepad controller. These speed are the maximum Jog speed which is the double arrow jog button or the GamePad joystick fully depressed. See Also Jog Buttons. The Reverse R/Z may be selected if the GamePad Z motion is reversed on a particular GamePad device.

Step Increments

Defines the step size distances for the Step Buttons that are displayed on the main KMotionCNC Screen. Setting a step size to zero will hide the size selection. See Also Jog Buttons.