processing from within KMOTION. We can even
adorn our CNC C programs with human readable
messages. Screenshot 1 is a capture of the C program
function of the KMOTION IDE. The KMotionDef.h
Include file contains all of the constants, macros, and
data structures we can include in our C programs to
influence the KFLOP I/O pins. For you C programmers
out there, this is ground floor programming. The
comment suggests that the message will be displayed
on a console. Screenshot 2 contains the result of
creating, compiling, downloading, and running our
little DesignCyclePrint.c code.
Take another look at Screenshot 1 and note that
the collection of arrows at the far right of the C
program view’s toolbar performs the compile,
download, and run steps with one mouse click. The
downloaded object code is volatile and will not persist
through a KFLOP power-on or reset operation.
However, we can control the execution of the
downloaded code with the Run and Halt commands.
If we decide to store our DesignCyclePrint.c object
code in program Flash and launch the code thread at
power-up, we would simply fill the Thread 1 check box
and click the User Memory button in the Flash panel of
Screenshot 3. Take yet another look at Screenshot 1 and
you will see that our DesignCyclePrint.c code is contained
in Thread 1. You will also notice that we can load and
execute up to seven threads. The KFLOP employs time
slicing to allow for all of the threads to execute.
The Channel dropdown window captured in
Screenshot 3 allows us to configure up to eight channels.
A KFLOP channel is actually an axis (X, Y, Z, etc.). Thus,
we can configure up to eight axes, which is the KFLOP
hardware limit. The Axis Mode input and output selections
are assigned to physical I/O pins with the Input Channels
and Output Channels panels. In the case of the Input
Channels and Output Channels, the channels are not axes.
Input and Output Channels are directly related to KFLOP
There are 16 possible Input Channels and 32 possible
Output Channels per axis at our disposal. The relationship
between axes, axis modes, and I/O channels becomes
evident when you start assembling the physical encoders,
drives, and motors that will make up your CNC system. As
you select options contained within the Configuration
view, the KMOTION application is simultaneously
generating related C source code and placing it on the
Clipboard. The format of the KFLOP-generated code is
described in the KMotionDef.h include file. By simply
clicking the C Code -> Clipboard button, the resultant C
source code stored on the Clipboard can be moved into a
thread view for editing, compilation, and loading.
Before committing your code to Flash, you must first
compile and load the release version of your code into the
KFLOP. Clicking on the User Memory button programs,
the downloaded threads into the KFLOP’s program Flash.
Any or all of the seven available threads can be specified
to load and execute at power-up. Threads can also be
started and stopped under program control.
KFLOP Base I/O
As you can see in Screenshot 4, the KFLOP is
specifically designed to be used in a CNC environment.
October 2013 55
■ Screenshot 2. The console provides instant C programming
gratification. The console view can be used to debug our
C code or keep us informed as to the status of a
running KFLOP application.
■ Screenshot 3. This view will mean more when you get
to the point of actually building the CNC hardware
system. For now, all we care about is the Flash panel
which allows us to load a new version of KFLOP firmware
and load our C object code into program Flash memory.