Tool Setup Screen - M0 - M30
(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.
G Code Actions - M0 - M30
The M Codes 0 through 9 have functionality commonly used by most machine tools. These can also be used as custom or general purpose M codes in the same manner as the M100-M119 M codes with the exception of M5 and M9 which are automatically executed on Program Stop or Rewind.
M0 - Program Stop
M1 - Optional Program Stop
M2 - Program Stop, Rewind, Reset Interpreter Settings
M3 - Spindle On CW
M4 - Spindle On CCW
M5 - Spindle Off - Note Automatically called on Program Stop/Rewind
M6 - Tool Change (T variable is passed to the C program in the persist variable specified)
M7 - Mist On
M8 - Flood On
M9 - Mist and Flood Off
S - Spindle Speed Setting. If C Program is specified Speed in RPM is passed to the specified KFLOP Var as a 32-bit floating point number
M30 - Program Stop and Rewind
The 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.
Additionally Actions can be performed when certain KMotionCNC functions occur. These include:
Cycle Start - Action performed when the Cycle Start Button is pressed and before GCode begins execution
Halt - Action performed when the Halt Button is pressed after GCode stops execution. Commonly used to execute a C Program to move the Z axis to a safe height and turn off the Spindle. See the SafeZ_SpindleOff.c as an example.
Stop - Action performed after Stop Button is pressed
FeedHold - Action performed after Stop Button is pressed
Resume - Action performed after FeedHold is released
Program Start - Action performed at KMotionCNC Program Startup
Program Exit - Action before KMotionCNC Program Exits
The Action that can be performed can be one of several things:
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 seven 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 a special command to pause motion until an external Input is activated select Wait Bit and specify the I/O bit number and the state 0 or 1 to wait for.
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 "\KStep\InitKStep3Axis.c" s an example which completely configures all necessary parameters in the KFLOP Board to drive 3 stepping motors using KSTEP's amplifiers.
PC App Callback allows a user-compiled Callback Function to be called as an Action. However, this is a feature not commonly used unless you are modifying/recompiling KMotionCNC.
Screen Script File allows users to change/select different screen script files.