<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://www.dynomotion.com/wiki/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.dynomotion.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=TK</id>
		<title>Dynomotion - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://www.dynomotion.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=TK"/>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/Special:Contributions/TK"/>
		<updated>2026-05-13T20:36:14Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.23.10</generator>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/Main_Page"/>
				<updated>2025-12-20T20:30:49Z</updated>
		
		<summary type="html">&lt;p&gt;TK: /* 3D Board Models added SnapAmp Step files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Dynomotion wiki'''&amp;lt;span style=&amp;quot;color: #999999;&amp;quot;&amp;gt;'''&amp;lt;br /&amp;gt;'''&amp;lt;/span&amp;gt;==&lt;br /&gt;
Welcome to our wiki where you can find and share knowledge on Dynomotion's systems.  To begin adding information to this wiki, simply create an account, verify your email, and start editing (click pencil icon). To make editing pages easier for everyone, we have installed a [https://help.bluespice.com/index.php/VisualEditor visual editor] by default.  This visual editor allows you to edit a wiki page much like you would a standard word processing document.&amp;amp;nbsp; For the seasoned wiki editors, standard [https://www.mediawiki.org/wiki/Help:Editing MediaWiki editing] may also be used.&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Warning: Use at your own risk.&amp;amp;nbsp; Information is for example purposes only and may contain errors.&amp;amp;nbsp; It is up to the User to verify the information is correct and is safe to use. In no case will any contributor or Dynomotion be liable for incorrect information.  Dynomotion reserves the right to modify or delete any contributions.&amp;lt;br /&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Thanks for Contributing!&lt;br /&gt;
&lt;br /&gt;
[http://dynomotion.com Official Dynomotion Site]&lt;br /&gt;
&lt;br /&gt;
==Editing and Creating Wiki Pages==&lt;br /&gt;
Unintuitively, you first create a link to the page you want to make before you can make the page.  To make a new page: while editing, right-click where you want your link to be, insert a link with a descriptive title and link text, save the page, click on the link you created, then click on &amp;quot;Empty Page&amp;quot; to begin editing your new page.&lt;br /&gt;
&lt;br /&gt;
Here are a few other quick tips:&lt;br /&gt;
&lt;br /&gt;
* You can insert links or images by Right-Clicking with the mouse on the line where you want the link or image to appear.&lt;br /&gt;
* For Spell Correction you can use Ctrl-Right-Click. &lt;br /&gt;
* To insert a YouTube Video use an EmbedVideo command such as &amp;lt;nowiki&amp;gt; {{#ev:youtube|xxxxx}}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;with xxxxx changed to the Video ID.&lt;br /&gt;
* Choose a descriptive page name and link text when creating a new page: e.g. Not &amp;quot;My Machine&amp;quot;, but rather &amp;quot;Brand X Three Axis Milling Machine Retrofit&amp;quot;&lt;br /&gt;
* Create pages in an organized manner: Describe what the page is about, create clear sections that flow&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
[[Help:New Page Creation|How to create a new wiki page]]&lt;br /&gt;
&lt;br /&gt;
[[Help:Editing Pages|How to Edit and insert Media into your wiki pages]]&lt;br /&gt;
&lt;br /&gt;
==Dynomotion Software Topics==&lt;br /&gt;
===Installation Topics===&lt;br /&gt;
* Announcement of our Latest Release (5.4.1) on the [https://www.dynomotion.com/forum/viewtopic.php?f=4&amp;amp;t=1884  Dynomotion Forum]&lt;br /&gt;
* [https://dynomotion.com/Software/Download.html Latest Release] Note: For Windows 7 64bit signed Drivers to work, all Windows Updates should be performed.&lt;br /&gt;
* [[Upgrading from previous KMotion Versions]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Archive of Test Releases:&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 06/03/2025: [https://dynomotion.com/Software/KMotion5.4.0.exe KMotion.exe 5.4.0], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.4.0%20Changes.pdf 5.4.0 release notes (pdf)]&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 04/08/2025: [https://dynomotion.com/Software/KMotion5.3.8.exe KMotion.exe 5.3.8], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.8%20Changes.pdf 5.3.8 release notes (pdf)]&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 01/14/2025: [https://dynomotion.com/Software/KMotion5.3.7.exe KMotion.exe 5.3.7], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.7%20Changes.pdf 5.3.7 release notes (pdf)]&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 09/30/2024: [https://dynomotion.com/Software/KMotion5.3.6.exe KMotion.exe 5.3.6], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.6%20Changes.pdf 5.3.6 release notes (pdf)]&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 09/16/2024: [https://dynomotion.com/Software/KMotion5.3.5.exe KMotion.exe 5.3.5], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.5%20Changes.pdf 5.3.5 release notes (pdf)]&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 08/13/2024: [https://dynomotion.com/Software/KMotion5.3.4.exe KMotion.exe 5.3.4], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.4%20Changes.pdf 5.3.4 release notes (pdf)]&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 04/04/2024: [https://dynomotion.com/Software/KMotion5.3.3.exe KMotion.exe 5.3.3], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.3%20Changes.pdf 5.3.3 release notes (pdf)]&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 02/01/2024: [https://dynomotion.com/Software/KMotion5.3.2.exe KMotion.exe 5.3.2], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.2%20Changes.pdf 5.3.2 release notes (pdf)]&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 11/20/2023: [https://dynomotion.com/Software/KMotion5.3.1.exe KMotion.exe 5.3.1], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.1%20Changes.pdf 5.3.1 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/19/2023: [https://dynomotion.com/Software/KMotion5.3.0.exe KMotion.exe 5.3.0], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.0%20Changes.pdf 5.3.0 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 06/30/2023: [https://dynomotion.com/Software/KMotion5.1.0.exe KMotion.exe 5.1.0], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.1.0%20Changes.pdf 5.1.0 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 05/01/2023: [https://dynomotion.com/Software/KMotion5.0.7.exe KMotion.exe 5.0.7], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.0.7%20Changes.pdf 5.0.7 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/21/2022: [https://dynomotion.com/Software/KMotion435h.exe KMotion.exe V4.35h], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35h%20Changes.pdf V4.35h release notes (pdf)]&lt;br /&gt;
* Previous Version 4.35g was not released, but see the change notes for this version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35g%20Changes.pdf V4.35g change notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/28/2020: [https://dynomotion.com/Software/KMotion435f.exe KMotion.exe V4.35f], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35f%20Changes.pdf V4.35f release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 11/18/2019: [https://dynomotion.com/Software/KMotion435e.exe KMotion.exe V4.35e], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35e%20Changes.pdf V4.35e release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/10/2019: [https://dynomotion.com/Software/KMotion435d.exe KMotion.exe V4.35d], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35d%20Changes.pdf V4.35d release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 01/28/2019: [https://dynomotion.com/Software/KMotion435b.exe KMotion.exe V4.35b], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35b%20Changes.pdf V4.35b release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/21/2018: [https://dynomotion.com/Software/KMotion435a.exe KMotion.exe V4.35a], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35a%20Changes.pdf V4.35a release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/28/2017: [https://dynomotion.com/Software/KMotion434j.exe KMotion.exe V4.34j], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34j%20Changes.pdf V4.34j release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 05/07/2017: [https://dynomotion.com/Software/KMotion434i.exe KMotion.exe V4.34i], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34i%20Changes.pdf V4.34i release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/14/2016: [https://dynomotion.com/Software/KMotion434h.exe KMotion.exe V4.34h], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34h%20Changes.pdf V4.34h release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/13/2016: [https://dynomotion.com/Software/KMotion434g.exe KMotion.exe V4.34g], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34g%20Changes.pdf V4.34g release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/05/2016: [https://dynomotion.com/Software/KMotion434f.exe KMotion.exe V4.34f], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34f%20Changes.pdf V4.34f release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 11/07/2016: [https://dynomotion.com/Software/KMotion434e.exe KMotion.exe V4.34e], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34e%20Changes.pdf V4.34e release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/32/2016: [https://dynomotion.com/Software/KMotion434d.exe KMotion.exe V4.34d], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34d%20Changes.pdf V4.34d release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/23/2016: [https://dynomotion.com/Software/KMotion434c.exe KMotion.exe V4.34c], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34c%20Changes.pdf V4.34c release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/03/2016: [https://dynomotion.com/Software/KMotion434b.exe KMotion.exe V4.34b], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34b%20Changes.pdf V4.34b release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 03/09/2016: [https://dynomotion.com/Software/KMotion434a.exe KMotion.exe V4.34a], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34a%20Changes.pdf V4.34a release notes (pdf)]&lt;br /&gt;
* [https://dynomotion.com/Help/KFLOPQuickStart/KFLOPQuickStart.htm How to install KMotion.exe and KMotionCNC]&lt;br /&gt;
* [[How to install KMotion.exe and KMotion in Windows 10|Preparing Windows 10 for driver installation]] (no longer required)&lt;br /&gt;
* [[Special Case for Windows 8.1 Industry Embedded Enterprise]]&lt;br /&gt;
* [[Updating KFLOP Firmware|How to update KFLOP Firmware]] - whenever a new version of software is installed, the firmware within KFLOP must be updated to match the new version&lt;br /&gt;
&lt;br /&gt;
===KMotion.exe Executive Software Topics===&lt;br /&gt;
KMotion.exe is the main program that is used to configure settings in KFLOP, initialize axes, and to write C programs to configure and setup KFLOP to control your system. In this program you can plot step response, test movement, view Bode plots, monitor I/O, set filter parameters, and generally set the pertinent parameters.&lt;br /&gt;
&lt;br /&gt;
* [http://www.dynomotion.com/Help/index.htm General software information] from the manuals&lt;br /&gt;
* Insert pages for other KMotion.exe-related topics here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Configuration Topics===&lt;br /&gt;
====Channels, Channels, Channels what are they?====&lt;br /&gt;
[[Channels Channels Channels|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====How to Setup Backlash Compensation====&lt;br /&gt;
[[Backlash Compensation|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====PWM Output Mode====&lt;br /&gt;
[[PWM Output Mode|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
===KMotionCNC Software Topics===&lt;br /&gt;
KMotionCNC is Dynomotion's CNC program used as a graphical user interface to your KFLOP-enabled machine tool. KMotionCNC has all of the basic functionality you need to run a machine of up to 6 axes, in addition to spindle control.&lt;br /&gt;
&lt;br /&gt;
* Insert pages for other KMotionCNC-related general topics here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;Using KMotionCNC&amp;lt;/span&amp;gt;====&lt;br /&gt;
* Homing discussion - page to be created&lt;br /&gt;
* Insert other KMotionCNC use pages here&lt;br /&gt;
&lt;br /&gt;
[[Internal/concave Path Tool Radius Compensation Example G41/G42]]&lt;br /&gt;
&lt;br /&gt;
[[Known KMotionCNC CAD/CAM Post Processors]]&lt;br /&gt;
&lt;br /&gt;
[[Invoking C Programs with Execute Only for previously Downloaded Programs]]&lt;br /&gt;
&lt;br /&gt;
[[Rigid Tapping G84 Setup and Use]]&lt;br /&gt;
&lt;br /&gt;
[[Tool Length/Offsets G43Hn G49]]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;Customize KMotionCNC&amp;lt;/span&amp;gt;====&lt;br /&gt;
KMotionCNC is written as a Windows C++ MFC (Microsoft Foundation Classes) program developed in Visual Studio.  Source code is provided and may be customized using Visual Studio.  MFC Support is a requirement. &lt;br /&gt;
&lt;br /&gt;
: '''General Information'''&lt;br /&gt;
: Compiling KMotionCNC&lt;br /&gt;
:: The KMotionCNC's Visual Studio Project Solution (\PC VC Programs\KMotionCNC\KMotionCNC.sln) is currently written for Visual Studio 2015 Standard.  This version can be used for the simplest compatibility.  Projects can be upgraded to newer version of VS with minimal effort.  Including Microsoft's Free Visual Studio 2013 Community.  [[PC Example Applications|More info on PC Example Applications.]]&lt;br /&gt;
:: Note Test Versions 4.34a and later have project solutions targeted for Visual Studio 2015 Community which is free for most Users.&lt;br /&gt;
: '''KMotionCNC Customization Examples and Applications'''&lt;br /&gt;
:: Links to examples of projects that explain KMotionCNC customizations. Troy (tmday7) created some helpful documents (PDF format):&lt;br /&gt;
: &lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/How%20to%20Edit%20KMotionCNC%20Faces.pdf How to edit KMotionCNC faces]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20External%20Buttons.pdf Adding external buttons]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20More%20User%20Buttons.pdf Adding more user buttons]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20Jog%20Percent%20Cell%20to%20Main%20Dialog%20Face.pdf Adding Jog Percent Cell to Main Dialog Face]&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;KMotionCNC Screen Editor&amp;lt;/span&amp;gt;====&lt;br /&gt;
Introduces the capability of using Screen Script files to modify the look and function of KMotionCNC.&amp;lt;br /&amp;gt;[[KMotionCNC Screen Editor|More information.]]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;KMotionCNC Geometric Correction&amp;lt;/span&amp;gt;====&lt;br /&gt;
Information regarding the powerful [https://dynomotion.com/Help/KMotionCNC/GeoCorrection.htm Geometric Correction capability] which allows calibration and distortion correction of the XY CAD space to Machine/Actuator Space as well as flatness in Z.  Simple 4 point correction tables can apply XY Scale, Rotation, skew, offset, tilt.  Larger tables can apply more non-linear corrections.&lt;br /&gt;
&lt;br /&gt;
Note the Geometric Correction is built into the KMotion Libraries and can be utilized by Custom Programs as well as with KMotionCNC&amp;lt;br /&amp;gt;[[Geometric Correction|More information and Examples.]]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;KMotionCNC Linear Table Correction (Screw Mapping)&amp;lt;/span&amp;gt;====&lt;br /&gt;
Individual Axes can be corrected in a 1 dimensional manner referred to as Linear Table Corrections.  For more information See [[Linear Table Correction|here]].&lt;br /&gt;
&lt;br /&gt;
===PC Example Applications===&lt;br /&gt;
A number of PC Applications using the KMotion Libraries are available in the Software download.&amp;amp;nbsp; Visual Studio should be used to modify/compile the applications.&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note All the projects should work out-of-the-box with Visual Studio 2022.'''&lt;br /&gt;
&lt;br /&gt;
[[PC Example Applications|More information.]]&lt;br /&gt;
&lt;br /&gt;
===KMotion Libraries - GCode Interpreter - Trajectory Planner - Coordinated Motion - .NET===&lt;br /&gt;
The KMotion Libraries are a series of DLLs (Dynamic Link Libraries) that reside on the PC that contain the common core motion control, I/O, and communication functionality for KFLOP.  These libraries permit PC Applications to be built using high level control without being concerned with the underlying details of Interpreting GCode, Trajectory Planning, Coordinated Motion, Motion Buffering, USB Communication, etc.&lt;br /&gt;
&lt;br /&gt;
[[KMotion Libraries - GCode Interpreter - Trajectory Planner - Coordinated Motion - .NET|More information]].&lt;br /&gt;
&lt;br /&gt;
===Kinematics===&lt;br /&gt;
The KMotion Libraries contain a Kinematics Layer where Users can add their own non-linear Kinematics&lt;br /&gt;
&lt;br /&gt;
[[Kinematics|More information]].&lt;br /&gt;
&lt;br /&gt;
===KFLOP C Programs===&lt;br /&gt;
C Programs provide a powerful and flexible capability to perform almost any sequence of operations within KFLOP.   In most cases after you have tested and tuned all your hardware using the KMotion.exe setup program all the settings and initialization steps required for your system can be placed into an Initialization C Program so that your system can be fully initialized simply by executing the Initialization program.&lt;br /&gt;
&lt;br /&gt;
[[KFLOP C Programs|More Information]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ModBus===&lt;br /&gt;
Modbus can be connected to the PC or directly to KFLOP.  A PC connection will not be deterministically real-time but may work for basic speed control and on/off.  Here is a related Thread for interfacing KMotionCNC to Modbus using a [http://www.modbusdriver.com/modpoll.html free utility]:&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/sending%20ModBus%20msgs%20from%20KmotionCNC%20to%20a%20RS485%20port.html Sending ModBus msgs from KmotionCNC to a RS485 port]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To connect Modbus directly to KFLOP's [http://www.dynomotion.com/Help/RS232/RS232.htm UART] see the C Examples in \C Programs\RS232\ModBus\&lt;br /&gt;
&lt;br /&gt;
===Linux Support===&lt;br /&gt;
KMotion Motion Libraries are fully supported under Microsoft Windows. Some Users have ported the KMotion Libraries to Linux.  Dynomotion will offer support where possible but can't offer full support under Linux.  Special Thanks to [https://github.com/parhansson/KMotionX Par Hansson] for the initial Linux Port.&lt;br /&gt;
&lt;br /&gt;
See [[Linux|here]] for more info.&lt;br /&gt;
&lt;br /&gt;
==Dynomotion Hardware Topics==&lt;br /&gt;
===General Hardware Information===&lt;br /&gt;
====[[KFLOP Hardware Info|KFLOP specific Hardware Info]]====&lt;br /&gt;
====[[KStep Hardware Info|KStep specific Hardware Info]]====&lt;br /&gt;
====[[Kanalog Hardware Info|Kanalog specific Hardware Info]]====&lt;br /&gt;
====[[SnapAmp Info|SnapAmp specific Hardware Info]]====&lt;br /&gt;
====[[Konnect Hardware Info|Konnect specific Hardware Info]]====&lt;br /&gt;
===Wiring Diagrams===&lt;br /&gt;
[[Media:Kanalog_Connections.pdf|Basic Kanalog DAC and Encoder Connections 3 Axis]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KanalogSchematic3Axis.pdf|Basic Kanalog DAC and Encoder Connections 3 Axis #2]]&lt;br /&gt;
&lt;br /&gt;
[[Media:dyn4 kanalog KE1524 V1.1.png|Basic Kanalog DAC and DMM DYN4 Drive 1 Axis]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Kflop-Kanalog_wiring_11-19-2018.pdf|Kanalog with Geckos G210 updated 11-19-2018]] (Thanks to &amp;lt;span style=&amp;quot;color: windowtext;&amp;quot;&amp;gt;Joseph Mirocha&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog_to_Tree_Journeyman_325_by_Rick_B.pdf|Kanalog to Tree Journeyman 325.pdf]] (Thanks to &amp;lt;span style=&amp;quot;color: windowtext;&amp;quot;&amp;gt;Rick_B&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Media:KFlopSnapBrushMPG.pdf|KFLOP+SnapAmp DC Brush Motors with MPG]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Stepper_Wiring_Diagram_Step-Dir_on_JP5.pdf|KFLOP JP5 Open Collector Step/Dir Connections to Power Step PSD5042-2P Drives ]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Matrika_V1_wiring_diagram_Rev1.pdf|KFLOP+KStep with VFD and NPN Limit Switches for Matrika Rev1]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KonnectTouchPlate.png|Touch Plate Wiring to Konnect]]&lt;br /&gt;
&lt;br /&gt;
[https://easyeda.com/350banshee/BreakoutBoard-93bdd16e3c3d48b98ae66c34f2436c40 User Created KFLOP JP7 Breakout/OptoIsolation Board] Schematic, Gerbers, PCBs Publicly available (thanks 350banshee)&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/wiki/index.php?action=ajax&amp;amp;title=-&amp;amp;rs=SecureFileStore::getFile&amp;amp;f=/b/bb/RotarySwitchToKanalog.png Rotary Switch Connected to Kanalog Opto Inputs]&lt;br /&gt;
&lt;br /&gt;
===3D Board Models===&lt;br /&gt;
[[Media:kflop-kstep-3d-models-1.snapshot.3.zip.txt|kflop-kstep-3d-models-1.snapshot.3.zip.txt]]  STEP file format - Thanks to Curtis&lt;br /&gt;
&lt;br /&gt;
[[File:kflop_kstep_render.JPG|none|link=|329x329px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:KFLOP3D_Step_IGS_Chris.zip.txt|KFLOP3D_Step_IGS_Chris.zip.txt]] STEP and IGS models - Thanks to Chris&lt;br /&gt;
&lt;br /&gt;
[[File:KFLOP_3D.png|none|link=|413x296px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:KONNECT_BOARD_MODEL.zip.txt|KONNECT_BOARD_MODEL.zip.txt]] STEP model - Thanks to Jeff Redington&lt;br /&gt;
&lt;br /&gt;
(Component locations may be off one way or another by .5mm)&lt;br /&gt;
&lt;br /&gt;
[[File:Konnect_Board.png|none|link=|339x292px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Konnect Basic Step file showing hole locations&lt;br /&gt;
&lt;br /&gt;
[[Media:KonnectHoles.stp.txt|KonnectHoles.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KonnectHoles.png|none|link=|352x323px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kanalog Step Model with Mechanical hole and Pin locations&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog.stp.txt|Kanalog.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KanalogFromStep.png|none|link=|304x279px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kanalog Step Model with Mechanical hole and Connectors (Thanks to&lt;br /&gt;
&lt;br /&gt;
Roberto Gotti of Powertech)'''&amp;lt;br /&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
[[Media:KANALOG_BOARD.stp.txt|KANALOG_BOARD.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KanalogWithConnectors.png|none|link=|311x286px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
SnapAmp 3D Step Model - Thanks to Isaac&lt;br /&gt;
&lt;br /&gt;
[[Media:SnapAmp.stp.txt|SnapAmp.stp.txt]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:SnapAmp_Step.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:KFlop_2SnapAmp.stp.txt|2 Snap Amps added to Curtis's KFLOP STEP model - Thanks to Isaac]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KFlop_2SnapAmp.stp.txt|KFlop_2SnapAmp.stp.txt]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:KFLOP_2SnapAmp_Step.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
===Board Terminal DXF/DWG files===&lt;br /&gt;
[[Media:KFLOP_Terminals.dxf|KFLOP_Terminals.dxf]] [[Media:KFLOP_Terminals.dwg|KFLOP_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog_Terminals.dxf|Kanalog_Terminals.dxf]] [[Media:Kanalog_Terminals.dwg|Kanalog_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Konnect_Terminals.dxf|Konnect_Terminals.dxf]] [[Media:Konnect_Terminals.dwg|Konnect_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KStep_Terminals.dxf|KStep_Terminals.dxf]] [[Media:KStep_Terminals.dwg|KStep_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
===Wiring Topics===&lt;br /&gt;
Place links to pages on wiring inputs and&lt;br /&gt;
&lt;br /&gt;
outputs specific to your experiences and projects.  Be descriptive with page titles and links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====KFLOP IDC Connectors and Cables====&lt;br /&gt;
Cables that connect between Dynomotion boards are normally included when purchasing the boards together. They are also very common and easy to make. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Use '''16-conductor or 26-conductor ribbon cable''' (0.05 inch pitch 26 AWG preferrably or 28AWG) and IDC sockets.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;[[File:RibbonCable.png|none|link=]]16 conductor ribbon cable 3M part number 3801/16 100 &amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/3m/3801-16-100/3M156105-100-ND/1107501&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;26 conductor ribbon cable 3M part number C3801/26 100 &amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/3m/C3801-26-100/C3801-26-100-ND/1107648&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Winford also sells ribbon cable (although only the thinner 28 AWG):&amp;lt;br /&amp;gt;http://www.winford.com/products/rib.php&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Note you can usually tear off wires to reduce the number of conductors. For example from 26 down to 16. Tear off the conductors away from the red stripe that marks pin 1.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;The '''crimp tools''' are common:&amp;lt;br /&amp;gt;https://www.amazon.com/Accessories-Crimp-Ribbon-Cable-Connectors/dp/B007R2JEM4/&amp;lt;br /&amp;gt;[[File:RibbonCrimp.png|none|link=]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;'''IDC Sockets 16-pin '''(pin pitch 0.1 inch)&amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/assmann-wsw-components/AWP-16-7240-T/HHKC16H-ND/5031953&amp;lt;br /&amp;gt;Assman Part number AWP 16-7240-T[[File:16pinIDC.png|none|link=]]&lt;br /&gt;
https://www.digikey.com/product-detail/en/assmann-wsw-components/AWP-26-7240-T/HHKC26H-ND/5011313&lt;br /&gt;
[[File:26pinIDC.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
====KFLOP KStep JR1 Molex Power Connectors====&lt;br /&gt;
KFLOP and KStep JR1 are standard Disk Drive Power Connectors. Possibly one of the most common connectors. Originally used on PC ATX Power Supplies. Sometimes referred to as Molex Connectors. They have 4 pins with 0.2 inch pitch with 0.083~0.084 inch socket pins. The mating cable will have female socket pins as shown here:&lt;br /&gt;
&lt;br /&gt;
[[File:Molex_female_connector.jpg|none|link=|251x168px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Molex Series 8981 P# [https://www.digikey.com/short/zjp329 0015244048]  using Molex Series 8980 Crimp Pins P# [https://www.digikey.com/short/zjp3ff 0002081201]&lt;br /&gt;
&lt;br /&gt;
Also AMP Series MATE-N-LOK P# [https://www.digikey.com/short/zjpq3n 1-480424-0] using AMP Series MATE-N-LOK Crimp Pins P# [https://www.digikey.com/short/zjpqqw 60619-1] or P# [https://www.digikey.com/en/products/detail/molex/0194200002/2404783 194200002]&lt;br /&gt;
&lt;br /&gt;
Molex Crimp Tool P# [https://www.digikey.com/en/products/detail/molex/0640160035/665311 0640160035]&lt;br /&gt;
&lt;br /&gt;
====MPG Wiring and Interface====&lt;br /&gt;
MPGs (Manual Pulse Generators) should be connected directly to KFLOP for guaranteed real-time response (not USB based or connected to the PC).  MPGs are handled by a C Program that monitors the MPG and creates motion based on the MPG Encoder changes and switch selections for axis, speed, and so forth.  See the MPG C Program Examples.  Here is a Discussion with other links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/Jogging%20Pendant.html Jogging Pendant]&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/Connecting%20Keling%20MPG2%20pendant.html Connecting Keling MPG2 Pendant]&lt;br /&gt;
&lt;br /&gt;
[https://www.cnczone.com/forums/dynomotion-kflop-kanalog/349740-applying-acceleration-mpg-target-possible.html#post2119732 CNCZone Thread] on obtaining smooth filtered motion.&lt;br /&gt;
&lt;br /&gt;
[[File:MPG4_from_cnc4pc.jpg|none|link=|83x169px]]&lt;br /&gt;
&lt;br /&gt;
====Interfacing NPN Devices to KFLOP IO====&lt;br /&gt;
NPN devices (open collector)operate as a switch to GND and can be interfaced to KFLOP using a pull up resistor as shown below. When the transistor switches to 0V the KFLOP IO Pin is driven low. The transistor will need to sink ~3ma. When the transistor is off (open circuit) the resistor pulls the IO Pin to 3.3V. Note even though some KFLOP IO Pins can tolerate 5V pulling them above 3.8V should be avoided when possible so the 3.3V supply is used. This technique will only work with KFLOP IO Pins that do not have pull down resistors (JP7 and JP5). In some cases a 0.1uF Ceramic capacitor connected close to KFLOP might be added in parallel with the resistor to filter noise.  Cable shielding connected to KFLOP GND on the KFLOP end only is recommended.  Note that in noisy environments this technique may couple noise into KFLOP so opto isolation should be used instead.&lt;br /&gt;
&lt;br /&gt;
[[File:NPN_Interface_to_KFLOP.png|none|link=|544x544px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Multiplexing Encoder Inputs to KFLOP JP4 and JP6====&lt;br /&gt;
If KFLOP JP7 and JP5 are used for other purposes the encoder inputs can be multiplexed to KFLOP JP4 and JP6. There is an option to multiplex encoders 0-3 from JP7 to JP4 and another option to multiplex encoders 4-7 from JP5 to JP6. See the MuxEncoders.c for an example.&lt;br /&gt;
&lt;br /&gt;
Note the JP4 and JP6 IO are 3.3V inputs and shouldn't be driven hard (more than 10ma) above 3.8V. This is not usually an issue as most encoders or RS422 drivers don't do this. The inputs also have 150 ohm termination.&lt;br /&gt;
&lt;br /&gt;
The following line of code might be added to your Initialization C Program. It needs to be executed once to multiplex the encoders after any power cycle. Encoders 0-3 will then be input on JP4 and 4-7 will be on JP6. Both JP4 and Jp6 have 10 IO bits. The 4 encoders will appear on the first 8 IO bits. 2 bits for each encoder's A B channels in order. So for example Encoder #0 will appear on JP4 IO16 (Pin5) and IO17 (Pin6)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt; &lt;br /&gt;
// Mux encoder inputs from KFLOP JP7 &amp;amp; JP5 to JP4 and JP6&lt;br /&gt;
FPGAW(ENC_NOISE_FILTER_ADD) = ENC_0_3_JP4 + ENC_4_7_JP6 + ENC_NOISE_FILTER_DEFAULT_VAL; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JP4 and JP6 have +5V available on Pin1 and GND on Pins 8 and 9 that might be used to power 5V encoders.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span id=&amp;quot;Axes_Servo_Tuning_and_Trajectory_Planner&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axes Servo Tuning and Trajectory Planner&amp;lt;/span&amp;gt;==&lt;br /&gt;
===Basic Servo Tuning Overview===&lt;br /&gt;
Once an axis is configured and proved capable of holding a position it is ready to be tuned and optimized. Most often a small value of P Gain only is used to show the servo is functional and can hold position. The Servo may be very weak and inaccurate but will be functional.&lt;br /&gt;
&lt;br /&gt;
Every system is different and the tuning parameters are interactive in a manner that usually doesn't allow parameters to be determined one at a time. Rather after one parameter is changed it may be necessary to revisit the other parameters.&lt;br /&gt;
&lt;br /&gt;
In general higher gains will reduce errors and improve accuracy, but tend to make the system more unstable.  So the general idea is to increase gains to reduce errors as much as possible but still have a stable system.&lt;br /&gt;
&lt;br /&gt;
Often during tuning the system may go unstable. In fact, it is normally intentionally driven to instability to find its limits for a certain parameter. This can result in a violent oscillation or worse so one should be prepared to quickly disable the Servo. If an appropriate [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Max_Following_Error Max Following Error] is used the axis can be automatically disabled before the oscillation becomes too violent, yet not disable when performing a normal test.&lt;br /&gt;
&lt;br /&gt;
KMotion.exe allows you to change any axis parameter on the Step/Response, Config, or Filters Screens then simply push &amp;quot;Move&amp;quot; to see the effect of the change.  Note that as performance improves the errors will become small and difficult to see on the Position Plot without Zooming in (Left click drag) so changing the plot type to plot the error is useful.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The overall process normally goes something like this:&lt;br /&gt;
&lt;br /&gt;
# Select a Test [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Measurement Move Size] and [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Motion_Profile Motion Profile].  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Velocity.2C_Acceleration.2C_and_Jerk See Also]&lt;br /&gt;
# Select [http://dynomotion.com/Help/StepScreen/StepScreen.htm#max_limits Max Limits] to allow for the Test.  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Max_Limits_-_Error See Also]&lt;br /&gt;
# Determine maximum level of [http://dynomotion.com/Help/StepScreen/StepScreen.htm#PID P Gain]&lt;br /&gt;
# Determine maximum level of [http://dynomotion.com/Help/StepScreen/StepScreen.htm#PID D Gain] (with Low Pass Filtering)  See Also [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Torque_Servos_vs_Velocity_Servos here] and [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Lead_Compensator_vs_Derivative_Gain here].&lt;br /&gt;
# Determine new maximum level of P Gain now that D Gain increased stability&lt;br /&gt;
# Add I Gain to improve accuracy and remove steady state errors.  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#I_Gain.2FMax_Limit_Integrator See Also]&lt;br /&gt;
# Add [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Feed_Forward Feed Forward] to reduce errors&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Torque Servos vs Velocity Servos===&lt;br /&gt;
+/-10V Analog Amplifiers usually come in one of two varieties: '''Torque''' or '''Velocity'''. Torque mode amplifiers consider the input command as a Torque Command and work to generate the commanded Motor Torque. Velocity mode amplifiers consider the input command as a Velocity Command and work to generate the commanded Velocity.  Its important to understand what type of Amplifiers you have.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Velocity Mode Amplifiers''' need some form of feedback going to the Amplifier in order for the drive to know the current velocity. This might be a digital encoder or an analog tachometer.&lt;br /&gt;
&lt;br /&gt;
Its easy to tell if you have a Velocity Mode Amplifier by looking at a plot of a move on the Step Response Screen.  The Output (green plot with right scale) will be proportion to the motor velocity.  When moving at constant speed the output will be relatively constant.  See in the plot below the output (green) remains at a relatively constant ~1100 DAC counts while the position (red) ramps at a constant slope of the 90000 count/sec rate:&lt;br /&gt;
&lt;br /&gt;
[[File:VelocityAmp.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Velocity mode amplifiers can be relatively easy to tune using only P (Proportional) Gain.  Additional Gains and filters can be used for best performance but using only P Gain will often result in reasonable performance and a stable system (unlike Torque Mode Amplifiers). &lt;br /&gt;
&lt;br /&gt;
As an example consider controlling the speed of a car using only Proportional Gain as it approaches a target (Stop sign).  Consider a P Gain of 0.1 where at 1000ft from the stop sign we command 1000 x 0.1 = 100MPH.  Then at 100ft we command 10MPH.  Then at 10ft we command 1MPH.  This results in a nice, smooth, exponential approach, without overshoot.&lt;br /&gt;
&lt;br /&gt;
Contrast this with controlling the acceleration (torque) of a car using only Proportional Gain as it approaches a target (Stop sign).  At large distance we apply maximum acceleration.  Although as we approach the stop sign we reduce acceleration, we continue to accelerate and speed continues to increase until we pass the stop sign.  Torque mode servos are inherently unstable.  P only gain only works at all if there is some friction (the car is dragging a sled which slows us down with less torque).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Acceleration Mode Servos''' may or may not have any feedback.  If they have feedback it is usually used only to commutate a brushless motor.  In the plots the Output (green) will have large magnitude when the Position (red) is accelerating, where the plot has curvature (changing slope).&lt;br /&gt;
&lt;br /&gt;
Acceleration mode Servos are unlikely to work well or at all with only P Gain.  Some form of damping or lead compensation will usually be required to get a stable system.   D (derivative) Gain (or a lead compensator) should be included with the P Gain to help stabilize the system.  D Gain can be increased to make the system more stable up to a point.  After some point the additional D Gain will make the system more unstable. and should be reduced.&lt;br /&gt;
&lt;br /&gt;
When using D Gain (or lead compensation) the quantization noise (steps) in the encoder position can cause spikes in the output.  For example a D Gain of 100 will cause a spike of 100 counts in the output whenever the input changes suddenly by 1 count.  If the spikes are very high amplitude and short duration, the Amplifier may not handle them in the expected manner.  A low pass filter can be used to widen and reduce their amplitude allowing the amplifier to handle them more effectively.  Typically a 2nd order low pass filter of 500Hz Q=1.4 is used.  The last filter is normally used so it is applied to any Feed Forward. Such as:&lt;br /&gt;
&lt;br /&gt;
[[File:LowPass400Q1p4.png|none|link=|680x439px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;Velocity.2C_Acceleration.2C_and_Jerk&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Velocity, Acceleration, and Jerk&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;div id=&amp;quot;yui_3_16_0_1_1445622719616_3315&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;The Velocity, Acceleration, and Jerk in the Step Response Screen (KFLOP parameter settings) and the Acceleration and Velocity in the KMotionCNC | Tool Setup | Trajectory Planner | Axis Parameters are both used for different things.  The two sets of parameters are independent. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;yui_3_16_0_1_1445622719616_3313&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;The&amp;lt;/span&amp;gt; KFLOP parameters are used for 3rd order motions.   These include things like:  Jogging, Homing, and GCode Rapids (G0).  The units in KFLOP are in counts or steps.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span id=&amp;quot;yui_3_16_0_1_1445622719616_3320&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;The KMotionCNC parameters are used for 2nd order (&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;yui_3_16_0_1_1445622719616_3321&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;infinite &amp;lt;/span&amp;gt;Jerk) coordinated motion paths.  These are GCode G1,G2,G3 continuous paths.  The units are in Inches (or in some cases degrees).   Note there is an Option in KMotionCNC &amp;quot;Rapids as Feeds&amp;quot; where these parameters will also be used for Rapids.  But this option should only be used for highly non-linear Kinematic Systems which can not take advantage of faster/smoother 3rd order point to point straight line Rapids.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;Tests&amp;lt;/span&amp;gt; to find and verify optimal settings for both types of moves should be made using the Step Response Screen.  Optimal settings are usually determined by experimentation.  Although it might be possible to calculate the settings based on motor torque gains, back-emf, amplifier voltage/current, mass, moments of inertia, friction, encoder resolution, leadscrew pitch, required following accuracy, etc... It is often too complicated and with too many unknowns to be practical.  So experimental moves can be tested at ever increasing Velocities, Accelerations, and Jerks until the system is unable to follow the trajectory without having too much error or shock to the system.  After absolute limits of the system are determined then the settings should be backed off by some amount to provide operating margins (ie 20%).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;It is usually best to first determine max possible velocity using a relatively low acceleration. Maximum power is usually required at the point of the trajectory where velocity is high and still accelerating.  Supply Voltage limitations tend to limit velocity.  Current limitations tend to limit acceleration.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[File:MaxVelAccelPower.png|none|link=|485x361px]]&amp;lt;br /&amp;gt;The Step Response Screen always performs 3rd order motion but 2nd order motion can be simulated by temporarily setting the Jerk to a huge value (1000X the acceleration value).  In general reducing the Jerk value will result in longer times to perform motions, but often the improved smoothness will permit higher maximum accelerations and velocities to be used resulting in overall shorter motion times.  An analogy might be how you might stop more quickly in a car, without skidding or spilling your coffee, by applying the brakes harder in a more gradual manner rather than slamming on the brakes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;Make&amp;lt;/span&amp;gt; sure when testing the size of move is long enough for full acceleration and velocity are achieved.  A common mistake is to have Acceleration or Velocity Settings set to too high for your system but when testing a short move there is no indication of a problem.  The plot mode of Velocity Output  vs Time can be helpful to verify full Velocity is being achieved.&amp;lt;span id=&amp;quot;.C2.A0&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt; &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;The idea is that a motor axis has torque and speed limitations and you should determine and understand what they both are for your system. Available motor torque drops off with higher speed. At some speed the motor will not even be able to generate any torque at all. Motor torque is required to accelerate the axis. We need to make sure that no combination of velocity and acceleration will ever cause the axis to fault/stall/fail. So there is often a complex set of speeds and accelerations that will work ok that form an envelope of workable speed and acceleration. So one nice thing to know is top speed possible. It is like taking your car out on a long straight highway and gradually accelerating to find the max speed is 100MPH. You will then know that ever attempting a speed over 100MPH will always fail. Also speed should probably be limited to something like 80MPH to allow for margin and to allow reasonable acceleration up to that speed. The reason for performing the top speed test at low acceleration is to avoid a failure because of not being able to accelerate at the specified rate. So we want to set the acceleration to a low value so it will not be a limiting factor when determining top speed. However if we set the acceleration so low with a short trip distance we will never go very fast and the speed test will be meaningless. This should be avoided. Change the Plot type to Velocity, Output, vs Time to clearly see if this is the case.  You may want to turn off Measured Velocity if it obscures viewing the Commanded Velocity&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;For example to accelerate to 700,000 counts/sec at an acceleration rate of 700,000 counts/sec^2 would take 1 second. And then to slow back down would take 1 more second. So at least 2 seconds of motion would be required to get to full speed. A 100,000 count move (2 inches for a system with 50,000 counts/inch) takes much less time than that. Furthermore with a relatively low Jerk setting (1e6). This means the acceleration will be applied gradually over 0.7 seconds. This means an even much longer time and distance would be required to achieve top speed.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Here is the method to follow to find 2nd/3rd order motion profile limits:&amp;lt;br /&amp;gt;(note every system is different and will vary based on resolution, motor size/type, mass, etc...)&lt;br /&gt;
&lt;br /&gt;
'''1 - Find Max Velocity at low Acceleration and infinite Jerk'''&lt;br /&gt;
&lt;br /&gt;
Choose a Velocity to test (ie V=100000 counts/sec)&amp;lt;br /&amp;gt;Set a moderately low Acceleration Time of 1 second (A = V/1sec = 100000 counts/sec^2)&amp;lt;br /&amp;gt;Set very high Jerk so Acceleration is applied almost instantaneously in 0.001 sec (J = A/0.001sec = 1e8 counst/sec^3)&amp;lt;br /&amp;gt;Test a very long move 20 inches if possible (for resolution 50000 counts/inch, 1,000,000 counts)&amp;lt;br /&amp;gt;Plot Velocity, Output, vs time to see if V is actually obtained&amp;lt;br /&amp;gt;If the motion was successful repeat all above with higher V, if not try lower V&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Once Max V is found reduce by some margin (ie 20-50%)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Note you may decide on lower speed for other reasons (safety, vibration, noise, wobble, shock, etc....)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;'''2 - Find Max Acceleration for your system for the chosen Velocity'''&lt;br /&gt;
&lt;br /&gt;
Using the V found above increase A (keeping Jerk high in the same manner) until the system fails/faults/excessive shock, etc...&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Once Max A is found reduce by some margin (ie 20-50%)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;These V and A Values are now known good values for your system and can be used for 2nd order motions such as KMotionCNC Trajectory Planner or Mach3 Motor tuning. Note units will need to be converted (counts to inches or mm, time from seconds to minutes depending on the App)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3 - Find optimal 3rd order Jerk limited motions.'''&lt;br /&gt;
&lt;br /&gt;
The previous result from Step #1 and #2 used nearly infinite Jerk where Acceleration forces were applied nearly instantaneously. By reducing Jerk smoother motion should be possible. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Set Jerk so it is applied over 20ms (ie for A=200000 J = A/0.020 = 1e7&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Test to see if motions are smoother. With closed loop systems the Position Error Plot can be used to see if the motion has less error and is smoother. Open loop system will require you to hear the difference.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Increase/decrease Jerk to find the optimal value. Note reducing Jerk a lot will of course make the system very smooth, but will also be much slower using less acceleration and velocity which is undesirable. So the highest Jerk possible should be found that still provides some smoothness.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Reducing Jerk only will always make the system slower with less performance (but hopefully significantly smoother). It is usually then possible to increase Acceleration and Velocity somewhat to achieve even higher performance than what was possible with infinite Jerk while being as smooth or smoother.&lt;br /&gt;
&lt;br /&gt;
'''4 - Reduce Max Following Error Limit to small value'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;Now that the system is properly tuned and reasonable Acceleration, Velocity, and Jerk are set the motor Position should always follow the commanded Destinations accurately with only small errors.  By Plotting Position Errors under various conditions (Distances) you can get an idea of the worst case following errors under normal conditions.  The Max Following Error Parameter should be set to a value slightly larger than the worst case following error (ie 20~50% larger).  In this case if anything abnormal occurs: ie. The axis hits an obstacle, commanded at too high of a speed, servo goes unstable, hardware/electronics failure, a Following Error will be immediately detected and the axes disabled.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axis Resolution - counts/inch (or counts/mm)&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Its important to understand the resolution of your Axis which is the number of fundamental raw motor/driver encoder counts or motor steps per standard unit of distance (inch or mm).  Although tuning in KMotion.exe Step Response Screen and motions within KFLOP typically use units of raw counts or steps it is important to know how these translate to real-world distances, speeds, etc...  Later, applications such as KMotionCNC or Mach3 will need this information to scale motions properly.&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;There are usually a number of factors that combine together to determine the Axis Resolution.  These might include:&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;counts or steps per motor revolution&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;any gearing or belts and pulleys involved between motor and drive mechanisms&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;lead screw pitch, rack and pinion tooth pitch, drive belt radius, etc.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For example consider a Stepper Drive with:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;3200 steps per motor rev&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;2:1 gear reduction from motor to lead screw&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;0.2 inch lead screw pitch&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axis Resolution = 3200 step/motor rev x (2 motor rev/ screw rev)  / (0.2 inch / screw rev) = 32000 steps/inch&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;To determine whether your assumptions and calculations are correct perform a test.  Command as large of a move as convenient and measure the actual distance moved with a ruler.   For example in the axis described above you might command a move of 320000 steps.  This should result in a motion of:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;320000 steps / (32000 steps/inch) = 10 inches.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For KMotionCNC set the Axis Resolution in the [http://dynomotion.com/Help/KMotionCNC/ToolSetupScreenTP.htm#Axis_Motion_Parameters Tool Setup | Trajectory Planner Screen | Axis Parameters | cnts/inch].  Note units must be in units of inches.  If your resolution is in mm units multiply by 25.4.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For Mach3 enter the Axis Resolution in the Configuration | Motor Tuning Screen.  Make sure the setup units (not GCode units) match the mode of your values.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Servo Dither/Hunting - (oscillation around zero error)===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;Servos have high accuracy because they are always actively trying to make corrections and drive the error to zero.  Unfortunately this can sometimes cause annoying dither or position hunting around zero when not moving.  This is a very complex non-linear effect dependent on the dynamics of the mechanics.  Because of the highly non-linear quantization effects of single &amp;quot;steps&amp;quot; in the encoder position, stiction, backlash, etc. it follows different rules and is harder to analyze than normal servo tuning/stability in the larger magnitude more linear regime.  For example attempting to apply &amp;quot;Damping&amp;quot; is unlikely to work.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Lowering gains will usually help at the expense of performance.  However in many cases more than acceptable performance can be achieved with lower gains so one should consider if the higher gains are really needed.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;KFLOP has a Deadband Gain and Range feature that can basically be used to tell the servo to not attempt to correct small errors (treat the errors as zero), or to try to correct them less aggressively (with a Gain less than 1.0).  See [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Dead_Band here for more information]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Unfortunately adding Deadband doesn't always help the servo &amp;quot;sit still&amp;quot; and may actually increase the size of the dither depending on the dynamics.&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that when the servo is commanded to a non integer position ie 999999.7 encoder counts without deadband the servo will always be making corrections.  The best the servo can do is dither between encoder positions 999999.0 and 1000000.0.  With an error of either -0.7 or +0.3.  A servo with Integrator gain will guarantee the average is 999999.7&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;If dither is still a major problem a C Program might be used to monitor things and change settings under certain conditions to reduce dither.  See the example AntiServoDither__ALL.c which monitors for small errors for a period of time and if so reduces or turns off Integrator gain.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
===Noisy GCode - Trajectory Planner Smoothing===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;An analysis of Quantization Noise in GCode and Trajectory Planner Settings to generate smooth motion.&amp;lt;br /&amp;gt;[[File:GCode_Noisy_Path.png|none|link=|432x432px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[Trajectory Planner Smoothing Noisy GCode|See Analysis and Solution]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===Arc &amp;quot;faceting&amp;quot; - Trajectory Planner - Collinear Tolerance===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[File:ArcsTrajectoryZoomXTol.0005.png|none|link=|526x460px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[ArcFacetingColinearTol|See Analysis and Solution]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===I Gain/Max Limit Integrator===&lt;br /&gt;
I (Integrator) Gain can be used to eliminate persistent errors.  In fact any Integrator Gain at all guarantees the average error over infinite time is zero.  Without I Gain a system might have a small error that does not create enough output to overcome stiction to make a correction.  In such a case the error could persist forever.  Not so with any Integrator Gain.  Any error will be integrated and ramp the output higher and higher until eventually there will be a correction.  That assumes the Integrator or Output doesn't saturate or reach their programmed limits.  The rate the output ramps (or sums) is dependent on the size of the error and the I Gain value.  The Error x I Gain is summed every servo sample (90us).  This is why I Gain values are often small numbers (0.0001 - 0.01 typical range).  There is no guarantee that the position doesn't over shoot the target Destination.  In fact it is likely as as any error (area) under the trajectory will always be balanced by an equal area over the trajectory.  Too high of I Gain will make the system unstable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another case where I Gain is useful is when moving at high speed with a Velocity Amplifier.  To move at high speed a significant amount of output is required.  Without I Gain a significant amount of error could be required to provide this Output (ie Error x P Gain = Output).    With I Gain the Integrator will eventually ramp up to provide any Output necessary to move at the desired speed driving the error to zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Integrators have an issue often referred to as &amp;quot;Integrator Wind Up&amp;quot;.  This issue usually doesn't arise under normal conditions.  However if something is preventing the servo from making a correction such as forcing the position away from the target for a sustained amount of time, or disabling the amplifier, the Integrator will integrate to a huge unlimited value.  When the force is removed or amplifier re-enabled, the Integrator will likely cause a violent motion and overshoot.  Max Limit Integrator can help to minimize this issue by limiting the amount the Integrator can ramp up to.  So the Max Limit Integrator Value should be set at the minimum value that can still allow the Integrator to function in normal circumstances.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Typically there are two cases that should be considered when determining the Max Limit Integrator. &lt;br /&gt;
&lt;br /&gt;
# The amount of output expected to be required to overcome any stiction, friction, or other forces (cutting, gravity, etc...).  This is often not a large value and can be estimated or can be observed from the Step Response Screen (green plot right side scale is the output) when making a move.&lt;br /&gt;
# The amount of output required to provide the output needed to move at speed.  It is important to note that D Gain provides a damping or drag effect on the Output.  So the Integrator must be able to ramp up to a sufficient level to overcome the damping or drag effect and still provide enough output to move at the commanded speed.  For example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assume:&lt;br /&gt;
&lt;br /&gt;
# Commanded speed of 500,000 counts/sec&lt;br /&gt;
# D Gain of 35&lt;br /&gt;
# Output required to move at speed is 1800 DAC Counts&lt;br /&gt;
# Servo Sample Time of 90us&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Damping effect = Speed x D Gain x Sample Time = 500000 x 35 x 90e-6 = 1575 counts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Required Integrator Value = 1800 + 1575 = 3375&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So to provide some margin an Max Limit Integrator Value of 3500 might be used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Max Limits - Error===&lt;br /&gt;
Max limits error can be helpful to have your system respond less violently in the abnormal event where an excessively large error occurs.  Normally with a properly tuned system following errors should be small.   Setting a Max limits error can cause the servo to treat errors beyond a specified limit as if they were only the size of the limit and therefore respond less so than they would otherwise.  The max limits error is normally set to a value so it is not limiting under normal circumstances.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Plot below shows a situation where a small max limits error combined with a low P gain severely limits the Output.  In the plot below a large move (10000 counts) at a high speed (40000 counts/sec) is commanded.  Only P Gain (0.2) is used to provide the Output (green).  The max error limit of 200 combined with the low gain (0.2) limits the output to only 40 DAC counts.  Even as the true error increases to many thousands of counts, the servo is told to ignore the amount over 200.  So the output can never exceed 40 DAC counts.  The 40 DAC count limit means that the Axis is therefor not capable of providing the output necessary to keep up with the commanded motion.  The axis does the best it can with the limited output, and only does a fraction of the desired motion.&lt;br /&gt;
&lt;br /&gt;
[[File:Move10000.png|none|link=|665x431px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After increasing the max limits error the Output (green - right scale) now goes to a much higher value (900), and the Position (red) follows the Command (blue) to a much better degree.&lt;br /&gt;
&lt;br /&gt;
[[File:Move10000_nolimit.png|none|link=|667x430px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Increasing the P Gain to 1.6 also applies more Output sooner and the Position follows the command still better.&lt;br /&gt;
&lt;br /&gt;
[[File:Move1000_p1.6.png|none|link=|667x432px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Lead Compensator vs Derivative Gain===&lt;br /&gt;
Derivative (D) Gain is often used to help stabilize a system.&amp;amp;nbsp; It helps to think in the Frequency Domain to help understand how the two forms of compensation help.&amp;amp;nbsp; Please read below and [http://dynomotion.com/Help/BodeScreen/BodeScreen.htm this] for more information on the Frequency Domain.&amp;amp;nbsp; Both Compensation methods add positive phase to help stabilize the system.&amp;amp;nbsp; Unfortunately both methods increase gain at higher frequencies possibly causing the system to go unstable at higher frequency.&amp;amp;nbsp; A Lead Compensator provides the benefit of positive phase but without as much gain increase at higher frequencies.&amp;amp;nbsp; This figure shows a simplified Gain Plot comparison:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:DGainvsLead.png|none|link=|593x593px]]&lt;br /&gt;
&lt;br /&gt;
Here is a Bode Plot of a P=0.5 D=20 Compensator.   Note the KMotion.exe Bode Plot Screen has the capability of plotting the Frequency Domain Response of the PID+Filters Compensation.  Assume we desire positive phase to be added at 40Hz.  Notice the positive phase of 40 degrees at 40Hz which is good.  However the Gain increase in the 1KHz region of about 21db which is bad.&lt;br /&gt;
&lt;br /&gt;
[[File:P.5D20Annotate.png|none|link=|621x460px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a Bode Plot of a P=0.5 N1=N2=25Hz D1=D2=70Hz Compensator.   Assume we desire positive phase to be added at 40Hz.  We choose N1 N2 and D1 D2 to surround the frequency where the positive phase is desired.  Moving them further apart will increase the amount of positive phase but also increase the added Gain.  Notice the positive phase of 60 degrees at 40Hz which is good.  However the Gain increase in the 1KHz region of about 12db which is bad.  However both are improvements over the D Gain compensator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:PoleZeroFilter.png|none|link=|210x319px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:P.5D0N25D70Annotate.png|none|link=|644x478px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Tuning Master/Slave Configurations===&lt;br /&gt;
Master/Slave [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Master/Slave_Settings Configurations] allow two (or more) motors to drive the same axis.  Slaves are configured to follow a Master Axis.  For example two lead screws on both sides of a gantry.&lt;br /&gt;
&lt;br /&gt;
Tuning slaved axes is kind of a catch 22.  In order to tune one axis the other axis must be tuned well enough to follow and vice versa.  If possible, disconnect any mechanical linkage between the Master and Slave and test them separately without Slaving the Axes together to verify each axis Servos (can hold a position), moves at least somewhat properly, and moves in the same direction (assuming a positive [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Master/Slave_Settings Slave Gain] will be used).&lt;br /&gt;
&lt;br /&gt;
It is usually possible to incrementally tune each axis, at first moving slowly, then later at higher speeds, accelerations, and gains.  Only the Master Axis can be tested with the [http://dynomotion.com/Help/StepScreen/StepScreen.htm Step Response Screen].  This is because the Slave will follow any movement of the Master, but the Master will not follow movement of the Slave.  So if the Master Axis is moved all is well as both axes will move together, but if you try to move the Slave axis the two axes will fight.  The Master fighting to stay where it is, and the Slave fighting to move.&lt;br /&gt;
&lt;br /&gt;
To test/tune the Slave axis temporarily reverse the Master/Slave roles to make it the Master and then test it as the Master.&lt;br /&gt;
&lt;br /&gt;
Note: only the Master Axis should be included into the Coordinated Motion System.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Bode Plots===&lt;br /&gt;
A Bode Plot is a powerful tool for characterizing and providing insight into a dynamic system. It can help determine closed loop stability, bandwidth/performance, resonant frequencies, and more. It is entirely based on the system being linear. Linear in the sense that if the amplitude of some input signal is changed then the output signal will change proportionally as well. Unfortunately most systems are not entirely linear. Stiction, backlash, encoder quantization, amplifier saturation, and other effects are non-linear. For example driving a system with a signal too small to overcome stiction will result in no output at all whereas a larger signal will result in some output. This is clearly non-linear behavior. It would be nice to use a technique that handles non-linear systems but basically none are known.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;A Bode Plot is made injecting a stimulus to the system and observing how the system responds. For the reasons of non-linearity it is very important to perform a Bode Plot measurement using a representative level of stimulus similar to what the system will actually have during normal operation. If the Stimulus is not adjusted properly the result is likely to be completely invalid. Additionally the system should be reasonably tuned and stable so that it is responding in a reasonable way to the stimulus. If the system is unstable or very poorly tuned the result is likely to be completely invalid.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;You might think of it somewhat like shaking a box to determine what is in it. You should shake it with enough intensity and at frequencies to get some reaction, but not so high of intensity to break or distort the object inside.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;To create a Bode Plot use the KMotion.exe Bode Plot Screen. First select Plot: Time domain - Command, Position, Output vs Time and adjust the Amplitude and cutoff Freq until there is small but significant Position (red) changes (ie 50 encoder counts), at a frequency low enough that the Position at least somewhat attempts to follow the Command (blue), and where the Output (green) is not near saturation for the Drive being used.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;After the Stimulus/Noise Injection settings are set switch to Plot: Open Loop - Magnitude and Phase vs Frequency. Set the number of Samples to average (ie 20) and perform a Measurement.&amp;amp;nbsp; [http://dynomotion.com/Help/BodeScreen/BodeScreen.htm See here for more information].&lt;br /&gt;
&lt;br /&gt;
===Links to other Information on Tuning and Bode Plots===&lt;br /&gt;
[http://ctms.engin.umich.edu/CTMS/index.php?example=Introduction&amp;amp;section=ControlFrequency umich.edu Introduction section Control Frequency]&lt;br /&gt;
&lt;br /&gt;
[http://www.motiontech.com.au/assets/pdf/Kollmorgen%20Use%20Control%20Theory%20to%20Improve%20Servo%20Performance%20230712.pdf  Kollmorgen Use Control Theory to Improve Servo Performance 230712.pdf]&lt;br /&gt;
&lt;br /&gt;
==Problems and Resolutions==&lt;br /&gt;
====General====&lt;br /&gt;
:* [[Noise - Typical Problems and Resolutions|Dealing with noise on inputs]].  If you experience issues with inputs misreading, the issue may be noise.  This page provides examples on what might be causing noise issues and examples of how to possibly deal with noise.&lt;br /&gt;
:* Other&lt;br /&gt;
===Software-Specific Problems and Resolutions===&lt;br /&gt;
:* Place links to pages explaining resolutions to problems that are largely software-related here&lt;br /&gt;
[[KFLOP User C Programs Compiling/Launching Slowly because of Windows Defender]]&lt;br /&gt;
&lt;br /&gt;
===Hardware-Specific Problems and Resolutions===&lt;br /&gt;
:* Place links to pages explaining resolutions to problems that are largely hardware-related&lt;br /&gt;
====[[Step/Dir Drives lose 2 Steps for each pair of Direction Reversals]]====&lt;br /&gt;
==Applications and Projects==&lt;br /&gt;
:* Place links to pages that explain how you accomplished your particular project.  Write clear explanations that provide background on what you did and how you did it.&lt;br /&gt;
====[[Tool Changer - router linear 4 Tools - C Program]]====&lt;br /&gt;
[[File:LINEAT+ATC.jpg|none|link=|246x178px]]More linear milling tools: https://www.ichome.com/&lt;br /&gt;
&lt;br /&gt;
====[[Part Zero &amp;amp; Tool Height Touch Plate|Part Zero &amp;amp; Tool Height Touch Plate]]====&lt;br /&gt;
====[[Driving Hobby Servos]]====&lt;br /&gt;
[[File:HobbyServo.png|left|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
HiTec Type&lt;br /&gt;
&lt;br /&gt;
==Electrical Discharge Machining==&lt;br /&gt;
[https://en.wikipedia.org/wiki/Electrical_discharge_machining EDM (wikipedia)] is a method of cutting materials with high precision and detail.  Dynomotion Motion Controllers work well for EDM because of the ability for feedrate to be dynamically controlled including reversal along cutting path.&lt;br /&gt;
&lt;br /&gt;
[[Information on BAXEDM Arc Generators used with KFLOP]]&lt;br /&gt;
&lt;br /&gt;
Applied Science video that shows how to build an BAXEDM drilling machine using KFLOP and describes how it works:&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|https://youtu.be/rpHYBz7ToII|||||start=980}}&lt;br /&gt;
&lt;br /&gt;
==How to convert a milling machine to a 3D printer in 3 easy steps==&lt;br /&gt;
[[File:CNCto3DPrinter.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
More information [[How to convert a milling machine to a 3D printer in 3 easy steps|here]].&lt;br /&gt;
&lt;br /&gt;
==International and other Languages==&lt;br /&gt;
[[Russian]]&lt;br /&gt;
&lt;br /&gt;
[[Spanish]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:KFlop_2SnapAmp.stp.txt</id>
		<title>File:KFlop 2SnapAmp.stp.txt</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:KFlop_2SnapAmp.stp.txt"/>
				<updated>2025-12-20T20:21:32Z</updated>
		
		<summary type="html">&lt;p&gt;TK: 3D Step file of KFLOP + 2 SnapAmps&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;3D Step file of KFLOP + 2 SnapAmps&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:SnapAmp.stp.txt</id>
		<title>File:SnapAmp.stp.txt</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:SnapAmp.stp.txt"/>
				<updated>2025-12-20T20:17:22Z</updated>
		
		<summary type="html">&lt;p&gt;TK: 3D Step File of SnapAmp (by Isaac)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;3D Step File of SnapAmp (by Isaac)&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:KFLOP_2SnapAmp_Step.png</id>
		<title>File:KFLOP 2SnapAmp Step.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:KFLOP_2SnapAmp_Step.png"/>
				<updated>2025-12-20T20:10:22Z</updated>
		
		<summary type="html">&lt;p&gt;TK: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:SnapAmp_Step.png</id>
		<title>File:SnapAmp Step.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:SnapAmp_Step.png"/>
				<updated>2025-12-20T20:09:20Z</updated>
		
		<summary type="html">&lt;p&gt;TK: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor</id>
		<title>KMotionCNC Screen Editor</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor"/>
				<updated>2025-07-07T18:38:46Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Create Heading for Script Options&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' '''&lt;br /&gt;
&lt;br /&gt;
=====Introduction=====&lt;br /&gt;
&lt;br /&gt;
 Video: [https://www.youtube.com/watch?v=uQWDttzKuDA https://www.youtube.com/watch?v=uQWDttzKuDA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|uQWDttzKuDA}}&lt;br /&gt;
&lt;br /&gt;
'''Features include:'''&lt;br /&gt;
&lt;br /&gt;
* Show/Hide Controls&lt;br /&gt;
* Change Size and Position of Controls&lt;br /&gt;
* Change Label/Button Text&lt;br /&gt;
* International Character Support&lt;br /&gt;
* Change Font/Text Size&lt;br /&gt;
* Bitmap Buttons and Labels&lt;br /&gt;
* JPG, BMP, PNG Bitmaps&lt;br /&gt;
* Toggle Bitmap Labels (LEDs)&lt;br /&gt;
* Customizable Keyboard Hotkeys&lt;br /&gt;
* Customizable Button Tool Tips&lt;br /&gt;
* Programmable DRO (Digital Read Output) Labels&lt;br /&gt;
* Custom User Entry Controls&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 6-axes default screen is changed to a 5-axes screen by deleting the z-axis. We start by installing KMotion 4.34b or later. Note that if you don’t already have Dot Net version 4.62 or Visual Studio 2015 libraries installed, you will be prompted to load those. Create desktop icons for KMotion, KMotionCNC and KMotionCNC Screen Editor. Run KMotion and observe the default 3-axes resizable screen.&lt;br /&gt;
&lt;br /&gt;
[[File:3axes-resizable-screen.png|none|link=|504x286px]]&lt;br /&gt;
&lt;br /&gt;
Close the G Viewer window and change the dialog face to Default Custom Screen with no screen script specified. (Tool Setup):&lt;br /&gt;
&lt;br /&gt;
[[File:Default-custom-screen.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Now run the KMotionCNC Screen Editor. It automatically syncs to KMotionCNC’s controls and they are graphically displayed.&lt;br /&gt;
&lt;br /&gt;
This graphical representation allows you to select which controls you want to modify.&lt;br /&gt;
&lt;br /&gt;
Notice we can select a control and immediately hide or show it over at KMotionCNC. The controls can be moved or resized. There is also unlimited undo/redo. Multiple controls can be selected by dragging the mouse over the graphical display. Click SHIFT to add more controls, or CTRL to remove from the selection.&lt;br /&gt;
&lt;br /&gt;
'''Examples: '''&lt;br /&gt;
&lt;br /&gt;
* Select multiple controls for hiding and moving.&lt;br /&gt;
* Change main dialog screen dimensions.&lt;br /&gt;
* Change label text. Push SET key and KMotion CNC screen updates the text.&lt;br /&gt;
* Increase the size of the controls.&lt;br /&gt;
&lt;br /&gt;
The screen editor features international text support. Note that only certain fonts are capable of displaying international text. In our example, we selected Arial.&lt;br /&gt;
&lt;br /&gt;
Labels can show or toggle bitmaps based on an IO bit. As an example, we first we select bitmap 1, then bitmap 2. Increase the size of the label, so the bitmap shows properly. Then assign an IO bit number that will control the bitmap displayed. Notice the bitmap turns green, because the bit is currently on. Open KMotion and look at the state of IO bit #46 and see that it is on. Toggling the bit affects the bitmap on the screen:&lt;br /&gt;
&lt;br /&gt;
[[File:Toggle-IO-bit.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Users can configure push buttons for text, font, size, color, and tool tip. Select two sample labels and change them to type: button. Select both buttons and modify their fonts as well as their size. Four colors are available for text and background, each in normal and depressed button state. You can then change the name of each button individually, one to say “On” and the other“Off”. You can assign tool tips to each of the buttons, so when the operator hovers over the buttons, they will be prompted with a tool tip notification.&lt;br /&gt;
&lt;br /&gt;
Buttons can be assigned to perform actions. Select a script that can either be a screen script or an action. We select an action type to set bit 46 to 1. Notice that this is the script that indicated that. For the other button, we select an action which sets bit 46 to 0. Now pushing the buttons will perform these actions. Save your new screen as a screen script file. Screen script is under the KMotionCNC directory and the sub-directory“Screens”. Configure KMotionCNC to use this new screen at every new startup.Notice that tool setup screen can be accessed by right-mouse clicking on the KMotionCNC title (in “Tools/Setup files”). Select the screen you just created.&lt;br /&gt;
&lt;br /&gt;
Some more advanced features include input fields, C program actions, label DROs. Load the addition example in the screen editor. Example contains two user input controls and one DRO label control. The input edit controls are associated with KFLOP persist variables 160 and 161. The DRO label is associated with KFLOP persist variable 162. The Add button is configured for screen script action to run a C program in KFLOP. The C program is contained in the file “Add.c”. Test it by entering two values and pushing the Add button. Now open KMotion and look at the simple C code that is behind the function. (Open the file “Add.c”).&lt;br /&gt;
&lt;br /&gt;
=====Momentary and Toggle button types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|eE2mSUXxN2M}}&lt;br /&gt;
&lt;br /&gt;
Start KMotion CNC Screen Editor, and click on the “Main” tab, then on “Read Script” and choose the file named MomentaryToggle.scr&lt;br /&gt;
&lt;br /&gt;
You will see two buttons, a Momentary button assigned to bit46 and a Toggle button assigned to bit 47. You will also see two labels to display the status of bits 46 and 47 as LED bitmaps. We also have KMotion displaying the status of bits 46 and 47.&lt;br /&gt;
&lt;br /&gt;
[[File:Momentary-button-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Clicking the Momentary button activates the bit; releasing it, deactivates it. Clicking the Toggle button once sets the bit; clicking it again releases it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Combo Box Control with Drop Down Lists in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=Pp5DPfn8GLI https://www.youtube.com/watch?v=Pp5DPfn8GLI]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|Pp5DPfn8GLI}}&lt;br /&gt;
&lt;br /&gt;
Combo Box Controls allow the Operator to select text items from a list. The list items are specified as semicolon separated strings in the Text Property for the Control. Combo Boxes are read in the same Manner as Edit Controls where the Var Parameter of the Control is used to request the contents of the Control. When KMotionCNC detects a non-zero value of the persist variable it uses the value as an offset into the Gather Buffer and places the selected text into the Gather Buffer.&lt;br /&gt;
&lt;br /&gt;
KFLOP also maintains an EditChangeCount value which is incremented each time any Edit or ComboBox Control changes. See the ComboBoxCopyToDROLabelwhenChangedUnicode.c Example.&lt;br /&gt;
&lt;br /&gt;
ComboBox Selections made by the Operator are maintained from one KMotionCNC Session to the next using a Disk file:&lt;br /&gt;
\KMotion\Data\EditControlPersist.txt&lt;br /&gt;
&lt;br /&gt;
=====Dual Button Types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|8dAEeGnLaRg}}&lt;br /&gt;
&lt;br /&gt;
Certain buttons connected to internal status modes display one of 2 bitmaps depending on the state. Such as the Cycle Start Button displays either a Play image or a Halt image dependent on whether a Job is running. The 2 bitmaps can be reassigned to override the default images.&lt;br /&gt;
&lt;br /&gt;
=====Instantaneous Feed Rate Display=====&lt;br /&gt;
[https://youtu.be/w-bKvqXCd0Q https://youtu.be/w-bKvqXCd0Q]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|[https://youtu.be/w-bKvqXCd0Q w-bKvqXCd0Q]}}&lt;br /&gt;
&lt;br /&gt;
Normally the feed rate indication in KMotionCNC shows ''average'' feed rate over 100ms, assuming straight line motion. Here we use a C program to calculate a more instantaneous rate and display it on the KMotionCNC screen using the KMotionCNC screen editor. Here the C program samples two positions and times, computes the delta position and the delta time, formats it to a string and displays it onto DRO label 162 in KMotionCNC and it performs this action roughly every one ½ seconds. Here is the screen script for the screen shown on the left, we’ve added a type DRO label in the screen editor, edited colors and it is connected to persist variable 162. This job consist of a rapid helix bore at a rate of about 6 revolutions per second. It shows the instant feed rate being more correct.&lt;br /&gt;
&lt;br /&gt;
There is a newer example which also displays the feed rate as a vertical bar graph.  See:&lt;br /&gt;
&lt;br /&gt;
ShowInstantFeedRate3AxisBar.scr and related C Program ShowInstantVelocityDROBar.c&lt;br /&gt;
&lt;br /&gt;
=====Split/Full/Hidden GViewer Display on Main Dialog Face=====&lt;br /&gt;
[https://youtu.be/VkBhYpyGpNU https://youtu.be/VkBhYpyGpNU]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|VkBhYpyGpNU}}&lt;br /&gt;
&lt;br /&gt;
=====Using Resizeable/Floating GViewer Control with Custom Screen=====&lt;br /&gt;
Normally with a Custom Screen the GViewer Plotting is sent to the GViewer Control on the Main Dialog Face and the floating/re-sizable GViewer window is not used.  It is normally closed and the GViwer Button to open it is hidden.  However if it is desired to use the floating/re-sizable GViewer window rather than the Control on the Main Screen (which is hidden), this can be accomplished by setting the Var parameter for the Main Screen GViewer Control (IDC_viewctrl) to 0.  Non-zero values will direct the Plotting to the GViewer Control on the Main Dialog Face.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Main Screen Style=====&lt;br /&gt;
KMotionCNC Screen Editor supports changing main screen style. See the Main Dialog Screen Option under the Main Tab.  Boolean Screen Script Options: &amp;quot;Caption:&amp;quot; &amp;quot;MaxBox:&amp;quot; &amp;quot;MinBox:&amp;quot; &amp;quot;ResizeFrame:&amp;quot; &amp;quot;Maximize:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Maximized Captionless KMotionCNC Screens=====&lt;br /&gt;
[https://youtu.be/R44F0_upIoA https://youtu.be/R44F0_upIoA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|R44F0_upIoA}}&lt;br /&gt;
&lt;br /&gt;
New option in KMotionCNC Screen Editor V4.34e allows screens to be maximized to full screen and with or without Window Frame/Title. New options in Screen Editor: turn minimum box on or off, maximum box on or off, resizing frame on or off. Caption on top can be present or absent.&lt;br /&gt;
&lt;br /&gt;
Available viewing options (three buttons on the top-right hand side of the screen: “Split”: Split screen mode, “View”: G Code Viewer or “Code”: G Code.&lt;br /&gt;
&lt;br /&gt;
=====Control styles=====&lt;br /&gt;
'''&amp;lt;br /&amp;gt; '''Available style options:&amp;lt;br /&amp;gt; [[File:Style-options.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Label''' &amp;lt;br /&amp;gt; Can be text or bitmap. The background is determined by the main dialog background.&lt;br /&gt;
* '''Button''' &amp;lt;br /&amp;gt; Buttons can have all 4 options (foreground and background colors in on- and off-state) or they can also be bitmaps. Labels can load actions/scripts when the main screen is loaded.&lt;br /&gt;
* '''MotionButton''' &amp;lt;br /&amp;gt; Motion buttons are strictly for jog button use only.&lt;br /&gt;
* '''ToggleButton''' &amp;lt;br /&amp;gt; See description above and [https://www.youtube.com/watch?v=eE2mSUXxN2M video].&lt;br /&gt;
* '''DROLabel &amp;lt;br /&amp;gt; '''('''D'''igital '''R'''ead '''O'''ut) runs a program in KFLOP, e.g. reads two edit cells in the “Add” example and passes back the result. X, Y, and Z are other examples of DRO labels.&lt;br /&gt;
* '''VertBar''' &amp;lt;br /&amp;gt; Plots a vertical graph from 0 to 100% and is read by KFLOP like DRO labels. See also the [https://youtu.be/w-bKvqXCd0Q Instant Feed Rate Display video].&lt;br /&gt;
* '''Radio''' button&lt;br /&gt;
* '''Momentary''' '''button''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
* '''DualButton''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
* '''Checkbox&amp;lt;br /&amp;gt; '''&lt;br /&gt;
* '''DualLabel&amp;lt;br /&amp;gt; '''F for feed rate and S for spindle are example of dual labels. They display the state (one or another). They are fixed and cannot be edited.&lt;br /&gt;
&lt;br /&gt;
=====Control attributes=====&lt;br /&gt;
'''[[File:Control-attributes.png|none|link=]]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Select ID'''&amp;lt;br /&amp;gt; Defines the name of the control on the screen.&lt;br /&gt;
* '''Type'''&amp;lt;br /&amp;gt; Defines the type of control, e.g.: CONTROL, PUSHBUTTON, COMBOBOX.&lt;br /&gt;
* '''Font'''&amp;lt;br /&amp;gt; Set the font type, size and normal, bold, or italic.&lt;br /&gt;
* '''BitmapFile1, BitMapFile2&amp;lt;br /&amp;gt; '''Select a bitmap image (.bmp, .gif or .png) for your buttons. BitMapFile1 will show the selected file when the button is in normal state, BitMapFile2 when the button pressed.&lt;br /&gt;
* '''Colors''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (text).&lt;br /&gt;
* '''Highlight''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (background).&lt;br /&gt;
* '''Tool Tip''' &amp;lt;br /&amp;gt; Compose text to describe the button action. This text will be visible when the user hovers over the button.&lt;br /&gt;
* '''HotKey''' &amp;lt;br /&amp;gt; Assigns a keyboard key to perform an action. This field is by default set to “-1”. For example, select a control like “mm” and type “CTRL M” or select “in” and type “CTRL I” and click “Set”. The “x” button next to the field will restore the value back to “-1”.&lt;br /&gt;
* '''Var&amp;lt;br /&amp;gt; '''Numeric variable attribute. Assigning a number toggles the corresponding bit in KFLOP (from 0 to 2047).&lt;br /&gt;
* '''X, Y&amp;lt;br /&amp;gt; '''Changes the horizontal and vertical position of the control.&lt;br /&gt;
* '''Width, Height'''&amp;lt;br /&amp;gt; Changes the size of the control.&lt;br /&gt;
* '''Script'''&amp;lt;br /&amp;gt; Using this field, the user has three options shown below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Video demonstration of the creation of Screen Script to perform Windows Messages&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|9x4JTswwWvk}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Control Script Options=====&lt;br /&gt;
a) Selecting a screen script file from the library:&lt;br /&gt;
&lt;br /&gt;
[[File:Script-Option-1.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
b) Selecting an Action:&amp;lt;br /&amp;gt;[[File:Script-Option-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
c) Selecting a Windows Message:&amp;lt;br /&amp;gt; [[File:Script-Option-3.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Show/Hide'''&amp;lt;br /&amp;gt; Select a control and immediately show or hide it.&lt;br /&gt;
&lt;br /&gt;
* '''Move/Resize'''&amp;lt;br /&amp;gt; Move the position of the control or change its size.&lt;br /&gt;
* '''Undo/Redo &amp;lt;br /&amp;gt; '''An unlimited number of undoes and redoes is available.&lt;br /&gt;
* '''Copy/Paste &amp;lt;br /&amp;gt; '''The user can edit all three screens (Split, View, and Code) by clicking “Copy” after making an edit such as moving a button, then loading the next screen, clicking outside the editable area and selecting “Paste”.&lt;br /&gt;
* '''General &amp;lt;br /&amp;gt; '''When selecting multiple controls, white fields are shown when all settings are the same, and grey fields when the values are different. In the example below note that we have selected the radio buttons labeled 1 through 7. While they all share the same font type, size, width and horizontal (x) position etc., “text” and “y-position” are grayed-out, since the radio buttons’ text labels and their vertical position are unique to each field. To override this, just click into the grayed-out field(s) and start editing.&amp;lt;br /&amp;gt;[[File:General.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Main Window attributes=====&lt;br /&gt;
* '''Main Dialog Screen&amp;lt;br /&amp;gt; '''Defines the look and feel as well as the size of your KMotionCNC screen. You can choose a background color, or select a bitmap file as your background. Choose the size of the window, or whether the window should be resizable or fixed and so on. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
* '''Script File'''&amp;lt;br /&amp;gt;Select a screen script file from the library or set an action. A screen script file defines the look of a page. You can assign an action to a button to load a screen script file.&amp;lt;br /&amp;gt;[[File:Style-file.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Bitmap types, Alpha, and locations=====&lt;br /&gt;
&amp;lt;br /&amp;gt;The following bitmap types are supported: .bmp, .gif, and.png. Out of these, only the png file type supports alpha channels, i.e. background transparency.&amp;lt;br /&amp;gt;Images are stored in the following “Resources” location:&amp;lt;br /&amp;gt;\KMotion434i\PC VC Examples\KMotionCNC\res&lt;br /&gt;
&lt;br /&gt;
=====Motion Buttons (for Jogging)=====&lt;br /&gt;
Special Buttons for Jogging exist with Style MotionButton. Although these buttons can be customized with regard to Bitmap images, size, positions, Font, ToolTips, Show/Hide, and Hotkeys they have fixed functionality for the 6 GCode Axes XYZABC.  They support momentary Hotkey and combined mouse operation with the ability to have multiple Hotkeys pushed simultaneously and dynamically change speed using the SHIFT key.  Additional MotionButtons can not be currently added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:MotionButtons.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Jog Buttons are grouped into 6 buttons per axis.  3 of the 6 buttons are used for moving one direction and 3 for the other direction.  The 3 buttons correspond to Stepping a fixed distance, Jogging slow, and Jogging Fast.   The Resource IDs corresponding to each axis are:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''X + = IDC_RightStep, IDC_Right, IDC_Right2'''&lt;br /&gt;
&lt;br /&gt;
'''X - = IDC_LeftStep, IDC_Left, IDC_Left2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Y + = IDC_UpStep, IDC_Up, IDC_Up2'''&lt;br /&gt;
&lt;br /&gt;
'''Y - = IDC_DownStep, IDC_Down, IDC_Down2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Z + = IDC_ZplusStep, IDC_Zplus, IDC_Zplus2'''&lt;br /&gt;
&lt;br /&gt;
'''Z - = IDC_ZminusStep, IDC_Zminus, IDC_Zminus2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''A + = IDC_AplusStep, IDC_Aplus, IDC_Aplus2'''&lt;br /&gt;
&lt;br /&gt;
'''A - = IDC_AminusStep, IDC_Aminus, IDC_Aminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''B + = IDC_BplusStep, IDC_Bplus, IDC_Bplus2'''&lt;br /&gt;
&lt;br /&gt;
'''B - = IDC_BminusStep, IDC_Bminus, IDC_Bminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''C + = IDC_CplusStep, IDC_Cplus, IDC_Cplus2'''&lt;br /&gt;
&lt;br /&gt;
'''C - = IDC_CminusStep, IDC_Cminus, IDC_Cminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note the HotKeys for all 3 Motion Buttons for each axis/direction must be set to the same value.''' This is because the same HotKey combined with CTRL and SHIFT alter the behavior to Step and Fast respectively.  If not all 3 buttons are desired for the screen the others may be hidden but should be all defined to the same HotKey for the HotKey functionality to work correctly.  Furthermore no other buttons should be defined with the same HotKeys.  The Screen Editor has a special feature to test for Duplicate HotKey assignments called &amp;quot;check dup hotkey&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also one associated IDC_StopStep button which will stop any Step Movement currently in progress.&lt;br /&gt;
&lt;br /&gt;
=====Performing an action Immediately within Screen Script=====&lt;br /&gt;
Normally when processing a Screen Script, the &amp;quot;Script&amp;quot; Parameter defines for a Push Button Control what should happen when the Push Button is pushed. However when a &amp;quot;Script&amp;quot; Parameter is specified for a static Label the Action will occur immediately after the Screen Script is processed.&lt;br /&gt;
&lt;br /&gt;
For example: when loading a screen intended for Simulation we might want to have the Simulation mode automatically selected on. So the Script for the IDC_SimulateStatic Label might be set to check the simulate checkbox with:&lt;br /&gt;
&lt;br /&gt;
WinMsg:DlgName;IDC_Simulate;BM_SETCHECK;BST_CHECKED&lt;br /&gt;
&lt;br /&gt;
=====Scaling an Entire Screen or Portion of a Screen=====&lt;br /&gt;
A new Screen Editor feature has been added to stretch/shrink a number of selected screen controls by a specified percentage.  The height and width of the controls can be stretched as with their XY positions.  The horizontal and vertical directions can be Stretched/Shrunk independently.  Scaling the Vertical direction will also scale any Font point settings.  The Width and Height of the entire dialog will also be scaled accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To Scale a Screen:&lt;br /&gt;
&lt;br /&gt;
# Select the controls to be scaled - usually all controls (drag a box to select multiple controls)&lt;br /&gt;
# Select mode: Screen Scale&lt;br /&gt;
# Select the desired Size Change as a percentage 1-100% (ie 60% corresponds to a stretch/shrink factor of 1.6)&lt;br /&gt;
# Push Increase/Decrease Width button&lt;br /&gt;
# Push Increase/Decrease Height button&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: it is best to scale in one step vs multiple steps as control widths and font sizes are integers and may have rounding after each step.&lt;br /&gt;
&lt;br /&gt;
Note: any bitmap images will be unchanged and remain the same size.  They can be manually scaled with a graphics app if necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen Editor with Screen Scale of 60% and all controls selected:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale.png|none|link=|710x627px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Original Screen:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale100.png|none|link=|639x471px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Scaled up 60%&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale160.png|none|link=|879x641px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Hierarchical Sub Script Files=====&lt;br /&gt;
When creating multiple Screens with sections of Controls that are duplicated among screens, possibly re-positioned on the Screen, it is useful to make use of SubScript files. Selecting one or more Controls and setting a SubScript file name for them will move them to a separate file which will then be referenced from the main file. SubScript files can also reference SubScript files in a hierarchical manner.&lt;br /&gt;
&lt;br /&gt;
See this Video Demonstration&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|bWToNV6922s}}&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor</id>
		<title>KMotionCNC Screen Editor</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor"/>
				<updated>2025-03-31T18:53:52Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Add ComboBox description and Video&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' '''&lt;br /&gt;
&lt;br /&gt;
=====Introduction=====&lt;br /&gt;
&lt;br /&gt;
 Video: [https://www.youtube.com/watch?v=uQWDttzKuDA https://www.youtube.com/watch?v=uQWDttzKuDA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|uQWDttzKuDA}}&lt;br /&gt;
&lt;br /&gt;
'''Features include:'''&lt;br /&gt;
&lt;br /&gt;
* Show/Hide Controls&lt;br /&gt;
* Change Size and Position of Controls&lt;br /&gt;
* Change Label/Button Text&lt;br /&gt;
* International Character Support&lt;br /&gt;
* Change Font/Text Size&lt;br /&gt;
* Bitmap Buttons and Labels&lt;br /&gt;
* JPG, BMP, PNG Bitmaps&lt;br /&gt;
* Toggle Bitmap Labels (LEDs)&lt;br /&gt;
* Customizable Keyboard Hotkeys&lt;br /&gt;
* Customizable Button Tool Tips&lt;br /&gt;
* Programmable DRO (Digital Read Output) Labels&lt;br /&gt;
* Custom User Entry Controls&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 6-axes default screen is changed to a 5-axes screen by deleting the z-axis. We start by installing KMotion 4.34b or later. Note that if you don’t already have Dot Net version 4.62 or Visual Studio 2015 libraries installed, you will be prompted to load those. Create desktop icons for KMotion, KMotionCNC and KMotionCNC Screen Editor. Run KMotion and observe the default 3-axes resizable screen.&lt;br /&gt;
&lt;br /&gt;
[[File:3axes-resizable-screen.png|none|link=|504x286px]]&lt;br /&gt;
&lt;br /&gt;
Close the G Viewer window and change the dialog face to Default Custom Screen with no screen script specified. (Tool Setup):&lt;br /&gt;
&lt;br /&gt;
[[File:Default-custom-screen.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Now run the KMotionCNC Screen Editor. It automatically syncs to KMotionCNC’s controls and they are graphically displayed.&lt;br /&gt;
&lt;br /&gt;
This graphical representation allows you to select which controls you want to modify.&lt;br /&gt;
&lt;br /&gt;
Notice we can select a control and immediately hide or show it over at KMotionCNC. The controls can be moved or resized. There is also unlimited undo/redo. Multiple controls can be selected by dragging the mouse over the graphical display. Click SHIFT to add more controls, or CTRL to remove from the selection.&lt;br /&gt;
&lt;br /&gt;
'''Examples: '''&lt;br /&gt;
&lt;br /&gt;
* Select multiple controls for hiding and moving.&lt;br /&gt;
* Change main dialog screen dimensions.&lt;br /&gt;
* Change label text. Push SET key and KMotion CNC screen updates the text.&lt;br /&gt;
* Increase the size of the controls.&lt;br /&gt;
&lt;br /&gt;
The screen editor features international text support. Note that only certain fonts are capable of displaying international text. In our example, we selected Arial.&lt;br /&gt;
&lt;br /&gt;
Labels can show or toggle bitmaps based on an IO bit. As an example, we first we select bitmap 1, then bitmap 2. Increase the size of the label, so the bitmap shows properly. Then assign an IO bit number that will control the bitmap displayed. Notice the bitmap turns green, because the bit is currently on. Open KMotion and look at the state of IO bit #46 and see that it is on. Toggling the bit affects the bitmap on the screen:&lt;br /&gt;
&lt;br /&gt;
[[File:Toggle-IO-bit.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Users can configure push buttons for text, font, size, color, and tool tip. Select two sample labels and change them to type: button. Select both buttons and modify their fonts as well as their size. Four colors are available for text and background, each in normal and depressed button state. You can then change the name of each button individually, one to say “On” and the other“Off”. You can assign tool tips to each of the buttons, so when the operator hovers over the buttons, they will be prompted with a tool tip notification.&lt;br /&gt;
&lt;br /&gt;
Buttons can be assigned to perform actions. Select a script that can either be a screen script or an action. We select an action type to set bit 46 to 1. Notice that this is the script that indicated that. For the other button, we select an action which sets bit 46 to 0. Now pushing the buttons will perform these actions. Save your new screen as a screen script file. Screen script is under the KMotionCNC directory and the sub-directory“Screens”. Configure KMotionCNC to use this new screen at every new startup.Notice that tool setup screen can be accessed by right-mouse clicking on the KMotionCNC title (in “Tools/Setup files”). Select the screen you just created.&lt;br /&gt;
&lt;br /&gt;
Some more advanced features include input fields, C program actions, label DROs. Load the addition example in the screen editor. Example contains two user input controls and one DRO label control. The input edit controls are associated with KFLOP persist variables 160 and 161. The DRO label is associated with KFLOP persist variable 162. The Add button is configured for screen script action to run a C program in KFLOP. The C program is contained in the file “Add.c”. Test it by entering two values and pushing the Add button. Now open KMotion and look at the simple C code that is behind the function. (Open the file “Add.c”).&lt;br /&gt;
&lt;br /&gt;
=====Momentary and Toggle button types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|eE2mSUXxN2M}}&lt;br /&gt;
&lt;br /&gt;
Start KMotion CNC Screen Editor, and click on the “Main” tab, then on “Read Script” and choose the file named MomentaryToggle.scr&lt;br /&gt;
&lt;br /&gt;
You will see two buttons, a Momentary button assigned to bit46 and a Toggle button assigned to bit 47. You will also see two labels to display the status of bits 46 and 47 as LED bitmaps. We also have KMotion displaying the status of bits 46 and 47.&lt;br /&gt;
&lt;br /&gt;
[[File:Momentary-button-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Clicking the Momentary button activates the bit; releasing it, deactivates it. Clicking the Toggle button once sets the bit; clicking it again releases it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Combo Box Control with Drop Down Lists in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=Pp5DPfn8GLI https://www.youtube.com/watch?v=Pp5DPfn8GLI]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|Pp5DPfn8GLI}}&lt;br /&gt;
&lt;br /&gt;
Combo Box Controls allow the Operator to select text items from a list. The list items are specified as semicolon separated strings in the Text Property for the Control. Combo Boxes are read in the same Manner as Edit Controls where the Var Parameter of the Control is used to request the contents of the Control. When KMotionCNC detects a non-zero value of the persist variable it uses the value as an offset into the Gather Buffer and places the selected text into the Gather Buffer.&lt;br /&gt;
&lt;br /&gt;
KFLOP also maintains an EditChangeCount value which is incremented each time any Edit or ComboBox Control changes. See the ComboBoxCopyToDROLabelwhenChangedUnicode.c Example.&lt;br /&gt;
&lt;br /&gt;
ComboBox Selections made by the Operator are maintained from one KMotionCNC Session to the next using a Disk file:&lt;br /&gt;
\KMotion\Data\EditControlPersist.txt&lt;br /&gt;
&lt;br /&gt;
=====Dual Button Types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|8dAEeGnLaRg}}&lt;br /&gt;
&lt;br /&gt;
Certain buttons connected to internal status modes display one of 2 bitmaps depending on the state. Such as the Cycle Start Button displays either a Play image or a Halt image dependent on whether a Job is running. The 2 bitmaps can be reassigned to override the default images.&lt;br /&gt;
&lt;br /&gt;
=====Instantaneous Feed Rate Display=====&lt;br /&gt;
[https://youtu.be/w-bKvqXCd0Q https://youtu.be/w-bKvqXCd0Q]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|[https://youtu.be/w-bKvqXCd0Q w-bKvqXCd0Q]}}&lt;br /&gt;
&lt;br /&gt;
Normally the feed rate indication in KMotionCNC shows ''average'' feed rate over 100ms, assuming straight line motion. Here we use a C program to calculate a more instantaneous rate and display it on the KMotionCNC screen using the KMotionCNC screen editor. Here the C program samples two positions and times, computes the delta position and the delta time, formats it to a string and displays it onto DRO label 162 in KMotionCNC and it performs this action roughly every one ½ seconds. Here is the screen script for the screen shown on the left, we’ve added a type DRO label in the screen editor, edited colors and it is connected to persist variable 162. This job consist of a rapid helix bore at a rate of about 6 revolutions per second. It shows the instant feed rate being more correct.&lt;br /&gt;
&lt;br /&gt;
There is a newer example which also displays the feed rate as a vertical bar graph.  See:&lt;br /&gt;
&lt;br /&gt;
ShowInstantFeedRate3AxisBar.scr and related C Program ShowInstantVelocityDROBar.c&lt;br /&gt;
&lt;br /&gt;
=====Split/Full/Hidden GViewer Display on Main Dialog Face=====&lt;br /&gt;
[https://youtu.be/VkBhYpyGpNU https://youtu.be/VkBhYpyGpNU]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|VkBhYpyGpNU}}&lt;br /&gt;
&lt;br /&gt;
=====Using Resizeable/Floating GViewer Control with Custom Screen=====&lt;br /&gt;
Normally with a Custom Screen the GViewer Plotting is sent to the GViewer Control on the Main Dialog Face and the floating/re-sizable GViewer window is not used.  It is normally closed and the GViwer Button to open it is hidden.  However if it is desired to use the floating/re-sizable GViewer window rather than the Control on the Main Screen (which is hidden), this can be accomplished by setting the Var parameter for the Main Screen GViewer Control (IDC_viewctrl) to 0.  Non-zero values will direct the Plotting to the GViewer Control on the Main Dialog Face.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Main Screen Style=====&lt;br /&gt;
KMotionCNC Screen Editor supports changing main screen style. See the Main Dialog Screen Option under the Main Tab.  Boolean Screen Script Options: &amp;quot;Caption:&amp;quot; &amp;quot;MaxBox:&amp;quot; &amp;quot;MinBox:&amp;quot; &amp;quot;ResizeFrame:&amp;quot; &amp;quot;Maximize:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Maximized Captionless KMotionCNC Screens=====&lt;br /&gt;
[https://youtu.be/R44F0_upIoA https://youtu.be/R44F0_upIoA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|R44F0_upIoA}}&lt;br /&gt;
&lt;br /&gt;
New option in KMotionCNC Screen Editor V4.34e allows screens to be maximized to full screen and with or without Window Frame/Title. New options in Screen Editor: turn minimum box on or off, maximum box on or off, resizing frame on or off. Caption on top can be present or absent.&lt;br /&gt;
&lt;br /&gt;
Available viewing options (three buttons on the top-right hand side of the screen: “Split”: Split screen mode, “View”: G Code Viewer or “Code”: G Code.&lt;br /&gt;
&lt;br /&gt;
=====Control styles=====&lt;br /&gt;
'''&amp;lt;br /&amp;gt; '''Available style options:&amp;lt;br /&amp;gt; [[File:Style-options.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Label''' &amp;lt;br /&amp;gt; Can be text or bitmap. The background is determined by the main dialog background.&lt;br /&gt;
* '''Button''' &amp;lt;br /&amp;gt; Buttons can have all 4 options (foreground and background colors in on- and off-state) or they can also be bitmaps. Labels can load actions/scripts when the main screen is loaded.&lt;br /&gt;
* '''MotionButton''' &amp;lt;br /&amp;gt; Motion buttons are strictly for jog button use only.&lt;br /&gt;
* '''ToggleButton''' &amp;lt;br /&amp;gt; See description above and [https://www.youtube.com/watch?v=eE2mSUXxN2M video].&lt;br /&gt;
* '''DROLabel &amp;lt;br /&amp;gt; '''('''D'''igital '''R'''ead '''O'''ut) runs a program in KFLOP, e.g. reads two edit cells in the “Add” example and passes back the result. X, Y, and Z are other examples of DRO labels.&lt;br /&gt;
* '''VertBar''' &amp;lt;br /&amp;gt; Plots a vertical graph from 0 to 100% and is read by KFLOP like DRO labels. See also the [https://youtu.be/w-bKvqXCd0Q Instant Feed Rate Display video].&lt;br /&gt;
* '''Radio''' button&lt;br /&gt;
* '''Momentary''' '''button''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
* '''DualButton''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
* '''Checkbox&amp;lt;br /&amp;gt; '''&lt;br /&gt;
* '''DualLabel&amp;lt;br /&amp;gt; '''F for feed rate and S for spindle are example of dual labels. They display the state (one or another). They are fixed and cannot be edited.&lt;br /&gt;
&lt;br /&gt;
=====Control attributes=====&lt;br /&gt;
'''[[File:Control-attributes.png|none|link=]]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Select ID'''&amp;lt;br /&amp;gt; Defines the name of the control on the screen.&lt;br /&gt;
* '''Type'''&amp;lt;br /&amp;gt; Defines the type of control, e.g.: CONTROL, PUSHBUTTON, COMBOBOX.&lt;br /&gt;
* '''Font'''&amp;lt;br /&amp;gt; Set the font type, size and normal, bold, or italic.&lt;br /&gt;
* '''BitmapFile1, BitMapFile2&amp;lt;br /&amp;gt; '''Select a bitmap image (.bmp, .gif or .png) for your buttons. BitMapFile1 will show the selected file when the button is in normal state, BitMapFile2 when the button pressed.&lt;br /&gt;
* '''Colors''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (text).&lt;br /&gt;
* '''Highlight''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (background).&lt;br /&gt;
* '''Tool Tip''' &amp;lt;br /&amp;gt; Compose text to describe the button action. This text will be visible when the user hovers over the button.&lt;br /&gt;
* '''HotKey''' &amp;lt;br /&amp;gt; Assigns a keyboard key to perform an action. This field is by default set to “-1”. For example, select a control like “mm” and type “CTRL M” or select “in” and type “CTRL I” and click “Set”. The “x” button next to the field will restore the value back to “-1”.&lt;br /&gt;
* '''Var&amp;lt;br /&amp;gt; '''Numeric variable attribute. Assigning a number toggles the corresponding bit in KFLOP (from 0 to 2047).&lt;br /&gt;
* '''X, Y&amp;lt;br /&amp;gt; '''Changes the horizontal and vertical position of the control.&lt;br /&gt;
* '''Width, Height'''&amp;lt;br /&amp;gt; Changes the size of the control.&lt;br /&gt;
* '''Script'''&amp;lt;br /&amp;gt; Using this field, the user has three options:&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Video demonstration of the creation of Screen Script to perform Windows Messages&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|9x4JTswwWvk}}&lt;br /&gt;
&lt;br /&gt;
a) Selecting a screen script file from the library:&lt;br /&gt;
&lt;br /&gt;
[[File:Script-Option-1.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
b) Selecting an Action:&amp;lt;br /&amp;gt;[[File:Script-Option-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
c) Selecting a Windows Message:&amp;lt;br /&amp;gt; [[File:Script-Option-3.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Show/Hide'''&amp;lt;br /&amp;gt; Select a control and immediately show or hide it.&lt;br /&gt;
&lt;br /&gt;
* '''Move/Resize'''&amp;lt;br /&amp;gt; Move the position of the control or change its size.&lt;br /&gt;
* '''Undo/Redo &amp;lt;br /&amp;gt; '''An unlimited number of undoes and redoes is available.&lt;br /&gt;
* '''Copy/Paste &amp;lt;br /&amp;gt; '''The user can edit all three screens (Split, View, and Code) by clicking “Copy” after making an edit such as moving a button, then loading the next screen, clicking outside the editable area and selecting “Paste”.&lt;br /&gt;
* '''General &amp;lt;br /&amp;gt; '''When selecting multiple controls, white fields are shown when all settings are the same, and grey fields when the values are different. In the example below note that we have selected the radio buttons labeled 1 through 7. While they all share the same font type, size, width and horizontal (x) position etc., “text” and “y-position” are grayed-out, since the radio buttons’ text labels and their vertical position are unique to each field. To override this, just click into the grayed-out field(s) and start editing.&amp;lt;br /&amp;gt;[[File:General.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Main Window attributes=====&lt;br /&gt;
* '''Main Dialog Screen&amp;lt;br /&amp;gt; '''Defines the look and feel as well as the size of your KMotionCNC screen. You can choose a background color, or select a bitmap file as your background. Choose the size of the window, or whether the window should be resizable or fixed and so on. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
* '''Script File'''&amp;lt;br /&amp;gt;Select a screen script file from the library or set an action. A screen script file defines the look of a page. You can assign an action to a button to load a screen script file.&amp;lt;br /&amp;gt;[[File:Style-file.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Bitmap types, Alpha, and locations=====&lt;br /&gt;
&amp;lt;br /&amp;gt;The following bitmap types are supported: .bmp, .gif, and.png. Out of these, only the png file type supports alpha channels, i.e. background transparency.&amp;lt;br /&amp;gt;Images are stored in the following “Resources” location:&amp;lt;br /&amp;gt;\KMotion434i\PC VC Examples\KMotionCNC\res&lt;br /&gt;
&lt;br /&gt;
=====Motion Buttons (for Jogging)=====&lt;br /&gt;
Special Buttons for Jogging exist with Style MotionButton. Although these buttons can be customized with regard to Bitmap images, size, positions, Font, ToolTips, Show/Hide, and Hotkeys they have fixed functionality for the 6 GCode Axes XYZABC.  They support momentary Hotkey and combined mouse operation with the ability to have multiple Hotkeys pushed simultaneously and dynamically change speed using the SHIFT key.  Additional MotionButtons can not be currently added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:MotionButtons.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Jog Buttons are grouped into 6 buttons per axis.  3 of the 6 buttons are used for moving one direction and 3 for the other direction.  The 3 buttons correspond to Stepping a fixed distance, Jogging slow, and Jogging Fast.   The Resource IDs corresponding to each axis are:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''X + = IDC_RightStep, IDC_Right, IDC_Right2'''&lt;br /&gt;
&lt;br /&gt;
'''X - = IDC_LeftStep, IDC_Left, IDC_Left2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Y + = IDC_UpStep, IDC_Up, IDC_Up2'''&lt;br /&gt;
&lt;br /&gt;
'''Y - = IDC_DownStep, IDC_Down, IDC_Down2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Z + = IDC_ZplusStep, IDC_Zplus, IDC_Zplus2'''&lt;br /&gt;
&lt;br /&gt;
'''Z - = IDC_ZminusStep, IDC_Zminus, IDC_Zminus2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''A + = IDC_AplusStep, IDC_Aplus, IDC_Aplus2'''&lt;br /&gt;
&lt;br /&gt;
'''A - = IDC_AminusStep, IDC_Aminus, IDC_Aminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''B + = IDC_BplusStep, IDC_Bplus, IDC_Bplus2'''&lt;br /&gt;
&lt;br /&gt;
'''B - = IDC_BminusStep, IDC_Bminus, IDC_Bminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''C + = IDC_CplusStep, IDC_Cplus, IDC_Cplus2'''&lt;br /&gt;
&lt;br /&gt;
'''C - = IDC_CminusStep, IDC_Cminus, IDC_Cminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note the HotKeys for all 3 Motion Buttons for each axis/direction must be set to the same value.''' This is because the same HotKey combined with CTRL and SHIFT alter the behavior to Step and Fast respectively.  If not all 3 buttons are desired for the screen the others may be hidden but should be all defined to the same HotKey for the HotKey functionality to work correctly.  Furthermore no other buttons should be defined with the same HotKeys.  The Screen Editor has a special feature to test for Duplicate HotKey assignments called &amp;quot;check dup hotkey&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also one associated IDC_StopStep button which will stop any Step Movement currently in progress.&lt;br /&gt;
&lt;br /&gt;
=====Performing an action Immediately within Screen Script=====&lt;br /&gt;
Normally when processing a Screen Script, the &amp;quot;Script&amp;quot; Parameter defines for a Push Button Control what should happen when the Push Button is pushed. However when a &amp;quot;Script&amp;quot; Parameter is specified for a static Label the Action will occur immediately after the Screen Script is processed.&lt;br /&gt;
&lt;br /&gt;
For example: when loading a screen intended for Simulation we might want to have the Simulation mode automatically selected on. So the Script for the IDC_SimulateStatic Label might be set to check the simulate checkbox with:&lt;br /&gt;
&lt;br /&gt;
WinMsg:DlgName;IDC_Simulate;BM_SETCHECK;BST_CHECKED&lt;br /&gt;
&lt;br /&gt;
=====Scaling an Entire Screen or Portion of a Screen=====&lt;br /&gt;
A new Screen Editor feature has been added to stretch/shrink a number of selected screen controls by a specified percentage.  The height and width of the controls can be stretched as with their XY positions.  The horizontal and vertical directions can be Stretched/Shrunk independently.  Scaling the Vertical direction will also scale any Font point settings.  The Width and Height of the entire dialog will also be scaled accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To Scale a Screen:&lt;br /&gt;
&lt;br /&gt;
# Select the controls to be scaled - usually all controls (drag a box to select multiple controls)&lt;br /&gt;
# Select mode: Screen Scale&lt;br /&gt;
# Select the desired Size Change as a percentage 1-100% (ie 60% corresponds to a stretch/shrink factor of 1.6)&lt;br /&gt;
# Push Increase/Decrease Width button&lt;br /&gt;
# Push Increase/Decrease Height button&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: it is best to scale in one step vs multiple steps as control widths and font sizes are integers and may have rounding after each step.&lt;br /&gt;
&lt;br /&gt;
Note: any bitmap images will be unchanged and remain the same size.  They can be manually scaled with a graphics app if necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen Editor with Screen Scale of 60% and all controls selected:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale.png|none|link=|710x627px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Original Screen:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale100.png|none|link=|639x471px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Scaled up 60%&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale160.png|none|link=|879x641px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Hierarchical Sub Script Files=====&lt;br /&gt;
When creating multiple Screens with sections of Controls that are duplicated among screens, possibly re-positioned on the Screen, it is useful to make use of SubScript files. Selecting one or more Controls and setting a SubScript file name for them will move them to a separate file which will then be referenced from the main file. SubScript files can also reference SubScript files in a hierarchical manner.&lt;br /&gt;
&lt;br /&gt;
See this Video Demonstration&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|bWToNV6922s}}&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor</id>
		<title>KMotionCNC Screen Editor</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor"/>
				<updated>2025-03-30T22:53:59Z</updated>
		
		<summary type="html">&lt;p&gt;TK: /* Hierarchical Sub Script Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' '''&lt;br /&gt;
&lt;br /&gt;
=====Introduction=====&lt;br /&gt;
&lt;br /&gt;
 Video: [https://www.youtube.com/watch?v=uQWDttzKuDA https://www.youtube.com/watch?v=uQWDttzKuDA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|uQWDttzKuDA}}&lt;br /&gt;
&lt;br /&gt;
'''Features include:'''&lt;br /&gt;
&lt;br /&gt;
* Show/Hide Controls&lt;br /&gt;
* Change Size and Position of Controls&lt;br /&gt;
* Change Label/Button Text&lt;br /&gt;
* International Character Support&lt;br /&gt;
* Change Font/Text Size&lt;br /&gt;
* Bitmap Buttons and Labels&lt;br /&gt;
* JPG, BMP, PNG Bitmaps&lt;br /&gt;
* Toggle Bitmap Labels (LEDs)&lt;br /&gt;
* Customizable Keyboard Hotkeys&lt;br /&gt;
* Customizable Button Tool Tips&lt;br /&gt;
* Programmable DRO (Digital Read Output) Labels&lt;br /&gt;
* Custom User Entry Controls&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 6-axes default screen is changed to a 5-axes screen by deleting the z-axis. We start by installing KMotion 4.34b or later. Note that if you don’t already have Dot Net version 4.62 or Visual Studio 2015 libraries installed, you will be prompted to load those. Create desktop icons for KMotion, KMotionCNC and KMotionCNC Screen Editor. Run KMotion and observe the default 3-axes resizable screen.&lt;br /&gt;
&lt;br /&gt;
[[File:3axes-resizable-screen.png|none|link=|504x286px]]&lt;br /&gt;
&lt;br /&gt;
Close the G Viewer window and change the dialog face to Default Custom Screen with no screen script specified. (Tool Setup):&lt;br /&gt;
&lt;br /&gt;
[[File:Default-custom-screen.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Now run the KMotionCNC Screen Editor. It automatically syncs to KMotionCNC’s controls and they are graphically displayed.&lt;br /&gt;
&lt;br /&gt;
This graphical representation allows you to select which controls you want to modify.&lt;br /&gt;
&lt;br /&gt;
Notice we can select a control and immediately hide or show it over at KMotionCNC. The controls can be moved or resized. There is also unlimited undo/redo. Multiple controls can be selected by dragging the mouse over the graphical display. Click SHIFT to add more controls, or CTRL to remove from the selection.&lt;br /&gt;
&lt;br /&gt;
'''Examples: '''&lt;br /&gt;
&lt;br /&gt;
* Select multiple controls for hiding and moving.&lt;br /&gt;
* Change main dialog screen dimensions.&lt;br /&gt;
* Change label text. Push SET key and KMotion CNC screen updates the text.&lt;br /&gt;
* Increase the size of the controls.&lt;br /&gt;
&lt;br /&gt;
The screen editor features international text support. Note that only certain fonts are capable of displaying international text. In our example, we selected Arial.&lt;br /&gt;
&lt;br /&gt;
Labels can show or toggle bitmaps based on an IO bit. As an example, we first we select bitmap 1, then bitmap 2. Increase the size of the label, so the bitmap shows properly. Then assign an IO bit number that will control the bitmap displayed. Notice the bitmap turns green, because the bit is currently on. Open KMotion and look at the state of IO bit #46 and see that it is on. Toggling the bit affects the bitmap on the screen:&lt;br /&gt;
&lt;br /&gt;
[[File:Toggle-IO-bit.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Users can configure push buttons for text, font, size, color, and tool tip. Select two sample labels and change them to type: button. Select both buttons and modify their fonts as well as their size. Four colors are available for text and background, each in normal and depressed button state. You can then change the name of each button individually, one to say “On” and the other“Off”. You can assign tool tips to each of the buttons, so when the operator hovers over the buttons, they will be prompted with a tool tip notification.&lt;br /&gt;
&lt;br /&gt;
Buttons can be assigned to perform actions. Select a script that can either be a screen script or an action. We select an action type to set bit 46 to 1. Notice that this is the script that indicated that. For the other button, we select an action which sets bit 46 to 0. Now pushing the buttons will perform these actions. Save your new screen as a screen script file. Screen script is under the KMotionCNC directory and the sub-directory“Screens”. Configure KMotionCNC to use this new screen at every new startup.Notice that tool setup screen can be accessed by right-mouse clicking on the KMotionCNC title (in “Tools/Setup files”). Select the screen you just created.&lt;br /&gt;
&lt;br /&gt;
Some more advanced features include input fields, C program actions, label DROs. Load the addition example in the screen editor. Example contains two user input controls and one DRO label control. The input edit controls are associated with KFLOP persist variables 160 and 161. The DRO label is associated with KFLOP persist variable 162. The Add button is configured for screen script action to run a C program in KFLOP. The C program is contained in the file “Add.c”. Test it by entering two values and pushing the Add button. Now open KMotion and look at the simple C code that is behind the function. (Open the file “Add.c”).&lt;br /&gt;
&lt;br /&gt;
=====Momentary and Toggle button types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|eE2mSUXxN2M}}&lt;br /&gt;
&lt;br /&gt;
Start KMotion CNC Screen Editor, and click on the “Main” tab, then on “Read Script” and choose the file named MomentaryToggle.scr&lt;br /&gt;
&lt;br /&gt;
You will see two buttons, a Momentary button assigned to bit46 and a Toggle button assigned to bit 47. You will also see two labels to display the status of bits 46 and 47 as LED bitmaps. We also have KMotion displaying the status of bits 46 and 47.&lt;br /&gt;
&lt;br /&gt;
[[File:Momentary-button-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Clicking the Momentary button activates the bit; releasing it, deactivates it. Clicking the Toggle button once sets the bit; clicking it again releases it.&lt;br /&gt;
&lt;br /&gt;
=====Dual Button Types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|8dAEeGnLaRg}}&lt;br /&gt;
&lt;br /&gt;
Certain buttons connected to internal status modes display one of 2 bitmaps depending on the state. Such as the Cycle Start Button displays either a Play image or a Halt image dependent on whether a Job is running. The 2 bitmaps can be reassigned to override the default images.&lt;br /&gt;
&lt;br /&gt;
=====Instantaneous Feed Rate Display=====&lt;br /&gt;
[https://youtu.be/w-bKvqXCd0Q https://youtu.be/w-bKvqXCd0Q]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|[https://youtu.be/w-bKvqXCd0Q w-bKvqXCd0Q]}}&lt;br /&gt;
&lt;br /&gt;
Normally the feed rate indication in KMotionCNC shows ''average'' feed rate over 100ms, assuming straight line motion. Here we use a C program to calculate a more instantaneous rate and display it on the KMotionCNC screen using the KMotionCNC screen editor. Here the C program samples two positions and times, computes the delta position and the delta time, formats it to a string and displays it onto DRO label 162 in KMotionCNC and it performs this action roughly every one ½ seconds. Here is the screen script for the screen shown on the left, we’ve added a type DRO label in the screen editor, edited colors and it is connected to persist variable 162. This job consist of a rapid helix bore at a rate of about 6 revolutions per second. It shows the instant feed rate being more correct.&lt;br /&gt;
&lt;br /&gt;
There is a newer example which also displays the feed rate as a vertical bar graph.  See:&lt;br /&gt;
&lt;br /&gt;
ShowInstantFeedRate3AxisBar.scr and related C Program ShowInstantVelocityDROBar.c&lt;br /&gt;
&lt;br /&gt;
=====Split/Full/Hidden GViewer Display on Main Dialog Face=====&lt;br /&gt;
[https://youtu.be/VkBhYpyGpNU https://youtu.be/VkBhYpyGpNU]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|VkBhYpyGpNU}}&lt;br /&gt;
&lt;br /&gt;
=====Using Resizeable/Floating GViewer Control with Custom Screen=====&lt;br /&gt;
Normally with a Custom Screen the GViewer Plotting is sent to the GViewer Control on the Main Dialog Face and the floating/re-sizable GViewer window is not used.  It is normally closed and the GViwer Button to open it is hidden.  However if it is desired to use the floating/re-sizable GViewer window rather than the Control on the Main Screen (which is hidden), this can be accomplished by setting the Var parameter for the Main Screen GViewer Control (IDC_viewctrl) to 0.  Non-zero values will direct the Plotting to the GViewer Control on the Main Dialog Face.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Main Screen Style=====&lt;br /&gt;
KMotionCNC Screen Editor supports changing main screen style. See the Main Dialog Screen Option under the Main Tab.  Boolean Screen Script Options: &amp;quot;Caption:&amp;quot; &amp;quot;MaxBox:&amp;quot; &amp;quot;MinBox:&amp;quot; &amp;quot;ResizeFrame:&amp;quot; &amp;quot;Maximize:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Maximized Captionless KMotionCNC Screens=====&lt;br /&gt;
[https://youtu.be/R44F0_upIoA https://youtu.be/R44F0_upIoA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|R44F0_upIoA}}&lt;br /&gt;
&lt;br /&gt;
New option in KMotionCNC Screen Editor V4.34e allows screens to be maximized to full screen and with or without Window Frame/Title. New options in Screen Editor: turn minimum box on or off, maximum box on or off, resizing frame on or off. Caption on top can be present or absent.&lt;br /&gt;
&lt;br /&gt;
Available viewing options (three buttons on the top-right hand side of the screen: “Split”: Split screen mode, “View”: G Code Viewer or “Code”: G Code.&lt;br /&gt;
&lt;br /&gt;
=====Control styles=====&lt;br /&gt;
'''&amp;lt;br /&amp;gt; '''Available style options:&amp;lt;br /&amp;gt; [[File:Style-options.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Label''' &amp;lt;br /&amp;gt; Can be text or bitmap. The background is determined by the main dialog background.&lt;br /&gt;
* '''Button''' &amp;lt;br /&amp;gt; Buttons can have all 4 options (foreground and background colors in on- and off-state) or they can also be bitmaps. Labels can load actions/scripts when the main screen is loaded.&lt;br /&gt;
* '''MotionButton''' &amp;lt;br /&amp;gt; Motion buttons are strictly for jog button use only.&lt;br /&gt;
* '''ToggleButton''' &amp;lt;br /&amp;gt; See description above and [https://www.youtube.com/watch?v=eE2mSUXxN2M video].&lt;br /&gt;
* '''DROLabel &amp;lt;br /&amp;gt; '''('''D'''igital '''R'''ead '''O'''ut) runs a program in KFLOP, e.g. reads two edit cells in the “Add” example and passes back the result. X, Y, and Z are other examples of DRO labels.&lt;br /&gt;
* '''VertBar''' &amp;lt;br /&amp;gt; Plots a vertical graph from 0 to 100% and is read by KFLOP like DRO labels. See also the [https://youtu.be/w-bKvqXCd0Q Instant Feed Rate Display video].&lt;br /&gt;
* '''Radio''' button&lt;br /&gt;
* '''Momentary''' '''button''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
* '''DualButton''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
* '''Checkbox&amp;lt;br /&amp;gt; '''&lt;br /&gt;
* '''DualLabel&amp;lt;br /&amp;gt; '''F for feed rate and S for spindle are example of dual labels. They display the state (one or another). They are fixed and cannot be edited.&lt;br /&gt;
&lt;br /&gt;
=====Control attributes=====&lt;br /&gt;
'''[[File:Control-attributes.png|none|link=]]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Select ID'''&amp;lt;br /&amp;gt; Defines the name of the control on the screen.&lt;br /&gt;
* '''Type'''&amp;lt;br /&amp;gt; Defines the type of control, e.g.: CONTROL, PUSHBUTTON, COMBOBOX.&lt;br /&gt;
* '''Font'''&amp;lt;br /&amp;gt; Set the font type, size and normal, bold, or italic.&lt;br /&gt;
* '''BitmapFile1, BitMapFile2&amp;lt;br /&amp;gt; '''Select a bitmap image (.bmp, .gif or .png) for your buttons. BitMapFile1 will show the selected file when the button is in normal state, BitMapFile2 when the button pressed.&lt;br /&gt;
* '''Colors''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (text).&lt;br /&gt;
* '''Highlight''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (background).&lt;br /&gt;
* '''Tool Tip''' &amp;lt;br /&amp;gt; Compose text to describe the button action. This text will be visible when the user hovers over the button.&lt;br /&gt;
* '''HotKey''' &amp;lt;br /&amp;gt; Assigns a keyboard key to perform an action. This field is by default set to “-1”. For example, select a control like “mm” and type “CTRL M” or select “in” and type “CTRL I” and click “Set”. The “x” button next to the field will restore the value back to “-1”.&lt;br /&gt;
* '''Var&amp;lt;br /&amp;gt; '''Numeric variable attribute. Assigning a number toggles the corresponding bit in KFLOP (from 0 to 2047).&lt;br /&gt;
* '''X, Y&amp;lt;br /&amp;gt; '''Changes the horizontal and vertical position of the control.&lt;br /&gt;
* '''Width, Height'''&amp;lt;br /&amp;gt; Changes the size of the control.&lt;br /&gt;
* '''Script'''&amp;lt;br /&amp;gt; Using this field, the user has three options:&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Video demonstration of the creation of Screen Script to perform Windows Messages&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|9x4JTswwWvk}}&lt;br /&gt;
&lt;br /&gt;
a) Selecting a screen script file from the library:&lt;br /&gt;
&lt;br /&gt;
[[File:Script-Option-1.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
b) Selecting an Action:&amp;lt;br /&amp;gt;[[File:Script-Option-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
c) Selecting a Windows Message:&amp;lt;br /&amp;gt; [[File:Script-Option-3.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Show/Hide'''&amp;lt;br /&amp;gt; Select a control and immediately show or hide it.&lt;br /&gt;
&lt;br /&gt;
* '''Move/Resize'''&amp;lt;br /&amp;gt; Move the position of the control or change its size.&lt;br /&gt;
* '''Undo/Redo &amp;lt;br /&amp;gt; '''An unlimited number of undoes and redoes is available.&lt;br /&gt;
* '''Copy/Paste &amp;lt;br /&amp;gt; '''The user can edit all three screens (Split, View, and Code) by clicking “Copy” after making an edit such as moving a button, then loading the next screen, clicking outside the editable area and selecting “Paste”.&lt;br /&gt;
* '''General &amp;lt;br /&amp;gt; '''When selecting multiple controls, white fields are shown when all settings are the same, and grey fields when the values are different. In the example below note that we have selected the radio buttons labeled 1 through 7. While they all share the same font type, size, width and horizontal (x) position etc., “text” and “y-position” are grayed-out, since the radio buttons’ text labels and their vertical position are unique to each field. To override this, just click into the grayed-out field(s) and start editing.&amp;lt;br /&amp;gt;[[File:General.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Main Window attributes=====&lt;br /&gt;
* '''Main Dialog Screen&amp;lt;br /&amp;gt; '''Defines the look and feel as well as the size of your KMotionCNC screen. You can choose a background color, or select a bitmap file as your background. Choose the size of the window, or whether the window should be resizable or fixed and so on. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
* '''Script File'''&amp;lt;br /&amp;gt;Select a screen script file from the library or set an action. A screen script file defines the look of a page. You can assign an action to a button to load a screen script file.&amp;lt;br /&amp;gt;[[File:Style-file.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Bitmap types, Alpha, and locations=====&lt;br /&gt;
&amp;lt;br /&amp;gt;The following bitmap types are supported: .bmp, .gif, and.png. Out of these, only the png file type supports alpha channels, i.e. background transparency.&amp;lt;br /&amp;gt;Images are stored in the following “Resources” location:&amp;lt;br /&amp;gt;\KMotion434i\PC VC Examples\KMotionCNC\res&lt;br /&gt;
&lt;br /&gt;
=====Motion Buttons (for Jogging)=====&lt;br /&gt;
Special Buttons for Jogging exist with Style MotionButton. Although these buttons can be customized with regard to Bitmap images, size, positions, Font, ToolTips, Show/Hide, and Hotkeys they have fixed functionality for the 6 GCode Axes XYZABC.  They support momentary Hotkey and combined mouse operation with the ability to have multiple Hotkeys pushed simultaneously and dynamically change speed using the SHIFT key.  Additional MotionButtons can not be currently added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:MotionButtons.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Jog Buttons are grouped into 6 buttons per axis.  3 of the 6 buttons are used for moving one direction and 3 for the other direction.  The 3 buttons correspond to Stepping a fixed distance, Jogging slow, and Jogging Fast.   The Resource IDs corresponding to each axis are:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''X + = IDC_RightStep, IDC_Right, IDC_Right2'''&lt;br /&gt;
&lt;br /&gt;
'''X - = IDC_LeftStep, IDC_Left, IDC_Left2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Y + = IDC_UpStep, IDC_Up, IDC_Up2'''&lt;br /&gt;
&lt;br /&gt;
'''Y - = IDC_DownStep, IDC_Down, IDC_Down2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Z + = IDC_ZplusStep, IDC_Zplus, IDC_Zplus2'''&lt;br /&gt;
&lt;br /&gt;
'''Z - = IDC_ZminusStep, IDC_Zminus, IDC_Zminus2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''A + = IDC_AplusStep, IDC_Aplus, IDC_Aplus2'''&lt;br /&gt;
&lt;br /&gt;
'''A - = IDC_AminusStep, IDC_Aminus, IDC_Aminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''B + = IDC_BplusStep, IDC_Bplus, IDC_Bplus2'''&lt;br /&gt;
&lt;br /&gt;
'''B - = IDC_BminusStep, IDC_Bminus, IDC_Bminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''C + = IDC_CplusStep, IDC_Cplus, IDC_Cplus2'''&lt;br /&gt;
&lt;br /&gt;
'''C - = IDC_CminusStep, IDC_Cminus, IDC_Cminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note the HotKeys for all 3 Motion Buttons for each axis/direction must be set to the same value.''' This is because the same HotKey combined with CTRL and SHIFT alter the behavior to Step and Fast respectively.  If not all 3 buttons are desired for the screen the others may be hidden but should be all defined to the same HotKey for the HotKey functionality to work correctly.  Furthermore no other buttons should be defined with the same HotKeys.  The Screen Editor has a special feature to test for Duplicate HotKey assignments called &amp;quot;check dup hotkey&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also one associated IDC_StopStep button which will stop any Step Movement currently in progress.&lt;br /&gt;
&lt;br /&gt;
=====Performing an action Immediately within Screen Script=====&lt;br /&gt;
Normally when processing a Screen Script, the &amp;quot;Script&amp;quot; Parameter defines for a Push Button Control what should happen when the Push Button is pushed. However when a &amp;quot;Script&amp;quot; Parameter is specified for a static Label the Action will occur immediately after the Screen Script is processed.&lt;br /&gt;
&lt;br /&gt;
For example: when loading a screen intended for Simulation we might want to have the Simulation mode automatically selected on. So the Script for the IDC_SimulateStatic Label might be set to check the simulate checkbox with:&lt;br /&gt;
&lt;br /&gt;
WinMsg:DlgName;IDC_Simulate;BM_SETCHECK;BST_CHECKED&lt;br /&gt;
&lt;br /&gt;
=====Scaling an Entire Screen or Portion of a Screen=====&lt;br /&gt;
A new Screen Editor feature has been added to stretch/shrink a number of selected screen controls by a specified percentage.  The height and width of the controls can be stretched as with their XY positions.  The horizontal and vertical directions can be Stretched/Shrunk independently.  Scaling the Vertical direction will also scale any Font point settings.  The Width and Height of the entire dialog will also be scaled accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To Scale a Screen:&lt;br /&gt;
&lt;br /&gt;
# Select the controls to be scaled - usually all controls (drag a box to select multiple controls)&lt;br /&gt;
# Select mode: Screen Scale&lt;br /&gt;
# Select the desired Size Change as a percentage 1-100% (ie 60% corresponds to a stretch/shrink factor of 1.6)&lt;br /&gt;
# Push Increase/Decrease Width button&lt;br /&gt;
# Push Increase/Decrease Height button&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: it is best to scale in one step vs multiple steps as control widths and font sizes are integers and may have rounding after each step.&lt;br /&gt;
&lt;br /&gt;
Note: any bitmap images will be unchanged and remain the same size.  They can be manually scaled with a graphics app if necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen Editor with Screen Scale of 60% and all controls selected:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale.png|none|link=|710x627px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Original Screen:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale100.png|none|link=|639x471px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Scaled up 60%&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale160.png|none|link=|879x641px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Hierarchical Sub Script Files=====&lt;br /&gt;
When creating multiple Screens with sections of Controls that are duplicated among screens, possibly re-positioned on the Screen, it is useful to make use of SubScript files. Selecting one or more Controls and setting a SubScript file name for them will move them to a separate file which will then be referenced from the main file. SubScript files can also reference SubScript files in a hierarchical manner.&lt;br /&gt;
&lt;br /&gt;
See this Video Demonstration&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|bWToNV6922s}}&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor</id>
		<title>KMotionCNC Screen Editor</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor"/>
				<updated>2025-03-30T22:52:48Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Hierarchical Sub Script Files Description added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' '''&lt;br /&gt;
&lt;br /&gt;
=====Introduction=====&lt;br /&gt;
&lt;br /&gt;
 Video: [https://www.youtube.com/watch?v=uQWDttzKuDA https://www.youtube.com/watch?v=uQWDttzKuDA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|uQWDttzKuDA}}&lt;br /&gt;
&lt;br /&gt;
'''Features include:'''&lt;br /&gt;
&lt;br /&gt;
* Show/Hide Controls&lt;br /&gt;
* Change Size and Position of Controls&lt;br /&gt;
* Change Label/Button Text&lt;br /&gt;
* International Character Support&lt;br /&gt;
* Change Font/Text Size&lt;br /&gt;
* Bitmap Buttons and Labels&lt;br /&gt;
* JPG, BMP, PNG Bitmaps&lt;br /&gt;
* Toggle Bitmap Labels (LEDs)&lt;br /&gt;
* Customizable Keyboard Hotkeys&lt;br /&gt;
* Customizable Button Tool Tips&lt;br /&gt;
* Programmable DRO (Digital Read Output) Labels&lt;br /&gt;
* Custom User Entry Controls&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 6-axes default screen is changed to a 5-axes screen by deleting the z-axis. We start by installing KMotion 4.34b or later. Note that if you don’t already have Dot Net version 4.62 or Visual Studio 2015 libraries installed, you will be prompted to load those. Create desktop icons for KMotion, KMotionCNC and KMotionCNC Screen Editor. Run KMotion and observe the default 3-axes resizable screen.&lt;br /&gt;
&lt;br /&gt;
[[File:3axes-resizable-screen.png|none|link=|504x286px]]&lt;br /&gt;
&lt;br /&gt;
Close the G Viewer window and change the dialog face to Default Custom Screen with no screen script specified. (Tool Setup):&lt;br /&gt;
&lt;br /&gt;
[[File:Default-custom-screen.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Now run the KMotionCNC Screen Editor. It automatically syncs to KMotionCNC’s controls and they are graphically displayed.&lt;br /&gt;
&lt;br /&gt;
This graphical representation allows you to select which controls you want to modify.&lt;br /&gt;
&lt;br /&gt;
Notice we can select a control and immediately hide or show it over at KMotionCNC. The controls can be moved or resized. There is also unlimited undo/redo. Multiple controls can be selected by dragging the mouse over the graphical display. Click SHIFT to add more controls, or CTRL to remove from the selection.&lt;br /&gt;
&lt;br /&gt;
'''Examples: '''&lt;br /&gt;
&lt;br /&gt;
* Select multiple controls for hiding and moving.&lt;br /&gt;
* Change main dialog screen dimensions.&lt;br /&gt;
* Change label text. Push SET key and KMotion CNC screen updates the text.&lt;br /&gt;
* Increase the size of the controls.&lt;br /&gt;
&lt;br /&gt;
The screen editor features international text support. Note that only certain fonts are capable of displaying international text. In our example, we selected Arial.&lt;br /&gt;
&lt;br /&gt;
Labels can show or toggle bitmaps based on an IO bit. As an example, we first we select bitmap 1, then bitmap 2. Increase the size of the label, so the bitmap shows properly. Then assign an IO bit number that will control the bitmap displayed. Notice the bitmap turns green, because the bit is currently on. Open KMotion and look at the state of IO bit #46 and see that it is on. Toggling the bit affects the bitmap on the screen:&lt;br /&gt;
&lt;br /&gt;
[[File:Toggle-IO-bit.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Users can configure push buttons for text, font, size, color, and tool tip. Select two sample labels and change them to type: button. Select both buttons and modify their fonts as well as their size. Four colors are available for text and background, each in normal and depressed button state. You can then change the name of each button individually, one to say “On” and the other“Off”. You can assign tool tips to each of the buttons, so when the operator hovers over the buttons, they will be prompted with a tool tip notification.&lt;br /&gt;
&lt;br /&gt;
Buttons can be assigned to perform actions. Select a script that can either be a screen script or an action. We select an action type to set bit 46 to 1. Notice that this is the script that indicated that. For the other button, we select an action which sets bit 46 to 0. Now pushing the buttons will perform these actions. Save your new screen as a screen script file. Screen script is under the KMotionCNC directory and the sub-directory“Screens”. Configure KMotionCNC to use this new screen at every new startup.Notice that tool setup screen can be accessed by right-mouse clicking on the KMotionCNC title (in “Tools/Setup files”). Select the screen you just created.&lt;br /&gt;
&lt;br /&gt;
Some more advanced features include input fields, C program actions, label DROs. Load the addition example in the screen editor. Example contains two user input controls and one DRO label control. The input edit controls are associated with KFLOP persist variables 160 and 161. The DRO label is associated with KFLOP persist variable 162. The Add button is configured for screen script action to run a C program in KFLOP. The C program is contained in the file “Add.c”. Test it by entering two values and pushing the Add button. Now open KMotion and look at the simple C code that is behind the function. (Open the file “Add.c”).&lt;br /&gt;
&lt;br /&gt;
=====Momentary and Toggle button types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|eE2mSUXxN2M}}&lt;br /&gt;
&lt;br /&gt;
Start KMotion CNC Screen Editor, and click on the “Main” tab, then on “Read Script” and choose the file named MomentaryToggle.scr&lt;br /&gt;
&lt;br /&gt;
You will see two buttons, a Momentary button assigned to bit46 and a Toggle button assigned to bit 47. You will also see two labels to display the status of bits 46 and 47 as LED bitmaps. We also have KMotion displaying the status of bits 46 and 47.&lt;br /&gt;
&lt;br /&gt;
[[File:Momentary-button-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Clicking the Momentary button activates the bit; releasing it, deactivates it. Clicking the Toggle button once sets the bit; clicking it again releases it.&lt;br /&gt;
&lt;br /&gt;
=====Dual Button Types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|8dAEeGnLaRg}}&lt;br /&gt;
&lt;br /&gt;
Certain buttons connected to internal status modes display one of 2 bitmaps depending on the state. Such as the Cycle Start Button displays either a Play image or a Halt image dependent on whether a Job is running. The 2 bitmaps can be reassigned to override the default images.&lt;br /&gt;
&lt;br /&gt;
=====Instantaneous Feed Rate Display=====&lt;br /&gt;
[https://youtu.be/w-bKvqXCd0Q https://youtu.be/w-bKvqXCd0Q]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|[https://youtu.be/w-bKvqXCd0Q w-bKvqXCd0Q]}}&lt;br /&gt;
&lt;br /&gt;
Normally the feed rate indication in KMotionCNC shows ''average'' feed rate over 100ms, assuming straight line motion. Here we use a C program to calculate a more instantaneous rate and display it on the KMotionCNC screen using the KMotionCNC screen editor. Here the C program samples two positions and times, computes the delta position and the delta time, formats it to a string and displays it onto DRO label 162 in KMotionCNC and it performs this action roughly every one ½ seconds. Here is the screen script for the screen shown on the left, we’ve added a type DRO label in the screen editor, edited colors and it is connected to persist variable 162. This job consist of a rapid helix bore at a rate of about 6 revolutions per second. It shows the instant feed rate being more correct.&lt;br /&gt;
&lt;br /&gt;
There is a newer example which also displays the feed rate as a vertical bar graph.  See:&lt;br /&gt;
&lt;br /&gt;
ShowInstantFeedRate3AxisBar.scr and related C Program ShowInstantVelocityDROBar.c&lt;br /&gt;
&lt;br /&gt;
=====Split/Full/Hidden GViewer Display on Main Dialog Face=====&lt;br /&gt;
[https://youtu.be/VkBhYpyGpNU https://youtu.be/VkBhYpyGpNU]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|VkBhYpyGpNU}}&lt;br /&gt;
&lt;br /&gt;
=====Using Resizeable/Floating GViewer Control with Custom Screen=====&lt;br /&gt;
Normally with a Custom Screen the GViewer Plotting is sent to the GViewer Control on the Main Dialog Face and the floating/re-sizable GViewer window is not used.  It is normally closed and the GViwer Button to open it is hidden.  However if it is desired to use the floating/re-sizable GViewer window rather than the Control on the Main Screen (which is hidden), this can be accomplished by setting the Var parameter for the Main Screen GViewer Control (IDC_viewctrl) to 0.  Non-zero values will direct the Plotting to the GViewer Control on the Main Dialog Face.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Main Screen Style=====&lt;br /&gt;
KMotionCNC Screen Editor supports changing main screen style. See the Main Dialog Screen Option under the Main Tab.  Boolean Screen Script Options: &amp;quot;Caption:&amp;quot; &amp;quot;MaxBox:&amp;quot; &amp;quot;MinBox:&amp;quot; &amp;quot;ResizeFrame:&amp;quot; &amp;quot;Maximize:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Maximized Captionless KMotionCNC Screens=====&lt;br /&gt;
[https://youtu.be/R44F0_upIoA https://youtu.be/R44F0_upIoA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|R44F0_upIoA}}&lt;br /&gt;
&lt;br /&gt;
New option in KMotionCNC Screen Editor V4.34e allows screens to be maximized to full screen and with or without Window Frame/Title. New options in Screen Editor: turn minimum box on or off, maximum box on or off, resizing frame on or off. Caption on top can be present or absent.&lt;br /&gt;
&lt;br /&gt;
Available viewing options (three buttons on the top-right hand side of the screen: “Split”: Split screen mode, “View”: G Code Viewer or “Code”: G Code.&lt;br /&gt;
&lt;br /&gt;
=====Control styles=====&lt;br /&gt;
'''&amp;lt;br /&amp;gt; '''Available style options:&amp;lt;br /&amp;gt; [[File:Style-options.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Label''' &amp;lt;br /&amp;gt; Can be text or bitmap. The background is determined by the main dialog background.&lt;br /&gt;
* '''Button''' &amp;lt;br /&amp;gt; Buttons can have all 4 options (foreground and background colors in on- and off-state) or they can also be bitmaps. Labels can load actions/scripts when the main screen is loaded.&lt;br /&gt;
* '''MotionButton''' &amp;lt;br /&amp;gt; Motion buttons are strictly for jog button use only.&lt;br /&gt;
* '''ToggleButton''' &amp;lt;br /&amp;gt; See description above and [https://www.youtube.com/watch?v=eE2mSUXxN2M video].&lt;br /&gt;
* '''DROLabel &amp;lt;br /&amp;gt; '''('''D'''igital '''R'''ead '''O'''ut) runs a program in KFLOP, e.g. reads two edit cells in the “Add” example and passes back the result. X, Y, and Z are other examples of DRO labels.&lt;br /&gt;
* '''VertBar''' &amp;lt;br /&amp;gt; Plots a vertical graph from 0 to 100% and is read by KFLOP like DRO labels. See also the [https://youtu.be/w-bKvqXCd0Q Instant Feed Rate Display video].&lt;br /&gt;
* '''Radio''' button&lt;br /&gt;
* '''Momentary''' '''button''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
* '''DualButton''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
* '''Checkbox&amp;lt;br /&amp;gt; '''&lt;br /&gt;
* '''DualLabel&amp;lt;br /&amp;gt; '''F for feed rate and S for spindle are example of dual labels. They display the state (one or another). They are fixed and cannot be edited.&lt;br /&gt;
&lt;br /&gt;
=====Control attributes=====&lt;br /&gt;
'''[[File:Control-attributes.png|none|link=]]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Select ID'''&amp;lt;br /&amp;gt; Defines the name of the control on the screen.&lt;br /&gt;
* '''Type'''&amp;lt;br /&amp;gt; Defines the type of control, e.g.: CONTROL, PUSHBUTTON, COMBOBOX.&lt;br /&gt;
* '''Font'''&amp;lt;br /&amp;gt; Set the font type, size and normal, bold, or italic.&lt;br /&gt;
* '''BitmapFile1, BitMapFile2&amp;lt;br /&amp;gt; '''Select a bitmap image (.bmp, .gif or .png) for your buttons. BitMapFile1 will show the selected file when the button is in normal state, BitMapFile2 when the button pressed.&lt;br /&gt;
* '''Colors''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (text).&lt;br /&gt;
* '''Highlight''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (background).&lt;br /&gt;
* '''Tool Tip''' &amp;lt;br /&amp;gt; Compose text to describe the button action. This text will be visible when the user hovers over the button.&lt;br /&gt;
* '''HotKey''' &amp;lt;br /&amp;gt; Assigns a keyboard key to perform an action. This field is by default set to “-1”. For example, select a control like “mm” and type “CTRL M” or select “in” and type “CTRL I” and click “Set”. The “x” button next to the field will restore the value back to “-1”.&lt;br /&gt;
* '''Var&amp;lt;br /&amp;gt; '''Numeric variable attribute. Assigning a number toggles the corresponding bit in KFLOP (from 0 to 2047).&lt;br /&gt;
* '''X, Y&amp;lt;br /&amp;gt; '''Changes the horizontal and vertical position of the control.&lt;br /&gt;
* '''Width, Height'''&amp;lt;br /&amp;gt; Changes the size of the control.&lt;br /&gt;
* '''Script'''&amp;lt;br /&amp;gt; Using this field, the user has three options:&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Video demonstration of the creation of Screen Script to perform Windows Messages&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|9x4JTswwWvk}}&lt;br /&gt;
&lt;br /&gt;
a) Selecting a screen script file from the library:&lt;br /&gt;
&lt;br /&gt;
[[File:Script-Option-1.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
b) Selecting an Action:&amp;lt;br /&amp;gt;[[File:Script-Option-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
c) Selecting a Windows Message:&amp;lt;br /&amp;gt; [[File:Script-Option-3.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Show/Hide'''&amp;lt;br /&amp;gt; Select a control and immediately show or hide it.&lt;br /&gt;
&lt;br /&gt;
* '''Move/Resize'''&amp;lt;br /&amp;gt; Move the position of the control or change its size.&lt;br /&gt;
* '''Undo/Redo &amp;lt;br /&amp;gt; '''An unlimited number of undoes and redoes is available.&lt;br /&gt;
* '''Copy/Paste &amp;lt;br /&amp;gt; '''The user can edit all three screens (Split, View, and Code) by clicking “Copy” after making an edit such as moving a button, then loading the next screen, clicking outside the editable area and selecting “Paste”.&lt;br /&gt;
* '''General &amp;lt;br /&amp;gt; '''When selecting multiple controls, white fields are shown when all settings are the same, and grey fields when the values are different. In the example below note that we have selected the radio buttons labeled 1 through 7. While they all share the same font type, size, width and horizontal (x) position etc., “text” and “y-position” are grayed-out, since the radio buttons’ text labels and their vertical position are unique to each field. To override this, just click into the grayed-out field(s) and start editing.&amp;lt;br /&amp;gt;[[File:General.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Main Window attributes=====&lt;br /&gt;
* '''Main Dialog Screen&amp;lt;br /&amp;gt; '''Defines the look and feel as well as the size of your KMotionCNC screen. You can choose a background color, or select a bitmap file as your background. Choose the size of the window, or whether the window should be resizable or fixed and so on. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
* '''Script File'''&amp;lt;br /&amp;gt;Select a screen script file from the library or set an action. A screen script file defines the look of a page. You can assign an action to a button to load a screen script file.&amp;lt;br /&amp;gt;[[File:Style-file.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Bitmap types, Alpha, and locations=====&lt;br /&gt;
&amp;lt;br /&amp;gt;The following bitmap types are supported: .bmp, .gif, and.png. Out of these, only the png file type supports alpha channels, i.e. background transparency.&amp;lt;br /&amp;gt;Images are stored in the following “Resources” location:&amp;lt;br /&amp;gt;\KMotion434i\PC VC Examples\KMotionCNC\res&lt;br /&gt;
&lt;br /&gt;
=====Motion Buttons (for Jogging)=====&lt;br /&gt;
Special Buttons for Jogging exist with Style MotionButton. Although these buttons can be customized with regard to Bitmap images, size, positions, Font, ToolTips, Show/Hide, and Hotkeys they have fixed functionality for the 6 GCode Axes XYZABC.  They support momentary Hotkey and combined mouse operation with the ability to have multiple Hotkeys pushed simultaneously and dynamically change speed using the SHIFT key.  Additional MotionButtons can not be currently added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:MotionButtons.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Jog Buttons are grouped into 6 buttons per axis.  3 of the 6 buttons are used for moving one direction and 3 for the other direction.  The 3 buttons correspond to Stepping a fixed distance, Jogging slow, and Jogging Fast.   The Resource IDs corresponding to each axis are:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''X + = IDC_RightStep, IDC_Right, IDC_Right2'''&lt;br /&gt;
&lt;br /&gt;
'''X - = IDC_LeftStep, IDC_Left, IDC_Left2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Y + = IDC_UpStep, IDC_Up, IDC_Up2'''&lt;br /&gt;
&lt;br /&gt;
'''Y - = IDC_DownStep, IDC_Down, IDC_Down2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Z + = IDC_ZplusStep, IDC_Zplus, IDC_Zplus2'''&lt;br /&gt;
&lt;br /&gt;
'''Z - = IDC_ZminusStep, IDC_Zminus, IDC_Zminus2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''A + = IDC_AplusStep, IDC_Aplus, IDC_Aplus2'''&lt;br /&gt;
&lt;br /&gt;
'''A - = IDC_AminusStep, IDC_Aminus, IDC_Aminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''B + = IDC_BplusStep, IDC_Bplus, IDC_Bplus2'''&lt;br /&gt;
&lt;br /&gt;
'''B - = IDC_BminusStep, IDC_Bminus, IDC_Bminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''C + = IDC_CplusStep, IDC_Cplus, IDC_Cplus2'''&lt;br /&gt;
&lt;br /&gt;
'''C - = IDC_CminusStep, IDC_Cminus, IDC_Cminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note the HotKeys for all 3 Motion Buttons for each axis/direction must be set to the same value.''' This is because the same HotKey combined with CTRL and SHIFT alter the behavior to Step and Fast respectively.  If not all 3 buttons are desired for the screen the others may be hidden but should be all defined to the same HotKey for the HotKey functionality to work correctly.  Furthermore no other buttons should be defined with the same HotKeys.  The Screen Editor has a special feature to test for Duplicate HotKey assignments called &amp;quot;check dup hotkey&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also one associated IDC_StopStep button which will stop any Step Movement currently in progress.&lt;br /&gt;
&lt;br /&gt;
=====Performing an action Immediately within Screen Script=====&lt;br /&gt;
Normally when processing a Screen Script, the &amp;quot;Script&amp;quot; Parameter defines for a Push Button Control what should happen when the Push Button is pushed. However when a &amp;quot;Script&amp;quot; Parameter is specified for a static Label the Action will occur immediately after the Screen Script is processed.&lt;br /&gt;
&lt;br /&gt;
For example: when loading a screen intended for Simulation we might want to have the Simulation mode automatically selected on. So the Script for the IDC_SimulateStatic Label might be set to check the simulate checkbox with:&lt;br /&gt;
&lt;br /&gt;
WinMsg:DlgName;IDC_Simulate;BM_SETCHECK;BST_CHECKED&lt;br /&gt;
&lt;br /&gt;
=====Scaling an Entire Screen or Portion of a Screen=====&lt;br /&gt;
A new Screen Editor feature has been added to stretch/shrink a number of selected screen controls by a specified percentage.  The height and width of the controls can be stretched as with their XY positions.  The horizontal and vertical directions can be Stretched/Shrunk independently.  Scaling the Vertical direction will also scale any Font point settings.  The Width and Height of the entire dialog will also be scaled accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To Scale a Screen:&lt;br /&gt;
&lt;br /&gt;
# Select the controls to be scaled - usually all controls (drag a box to select multiple controls)&lt;br /&gt;
# Select mode: Screen Scale&lt;br /&gt;
# Select the desired Size Change as a percentage 1-100% (ie 60% corresponds to a stretch/shrink factor of 1.6)&lt;br /&gt;
# Push Increase/Decrease Width button&lt;br /&gt;
# Push Increase/Decrease Height button&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: it is best to scale in one step vs multiple steps as control widths and font sizes are integers and may have rounding after each step.&lt;br /&gt;
&lt;br /&gt;
Note: any bitmap images will be unchanged and remain the same size.  They can be manually scaled with a graphics app if necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen Editor with Screen Scale of 60% and all controls selected:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale.png|none|link=|710x627px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Original Screen:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale100.png|none|link=|639x471px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Scaled up 60%&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale160.png|none|link=|879x641px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Hierarchical Sub Script Files=====&lt;br /&gt;
When creating multiple Screens with sections of Controls that are duplicated among screens, possibly re-positioned on the Screen, it is useful to make use of SubScript files. Selecting one or more Controls and setting a SubScript file name to them will move them to a separate file which will then be referenced from the main file. SubScript files can also reference SubScript files in a hierarchical manner.&lt;br /&gt;
&lt;br /&gt;
See this Video Demonstration&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|bWToNV6922s}}&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor</id>
		<title>KMotionCNC Screen Editor</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor"/>
				<updated>2025-03-30T22:28:22Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Add Screen Script for Windows Messages Video&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' '''&lt;br /&gt;
&lt;br /&gt;
=====Introduction=====&lt;br /&gt;
&lt;br /&gt;
 Video: [https://www.youtube.com/watch?v=uQWDttzKuDA https://www.youtube.com/watch?v=uQWDttzKuDA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|uQWDttzKuDA}}&lt;br /&gt;
&lt;br /&gt;
'''Features include:'''&lt;br /&gt;
&lt;br /&gt;
* Show/Hide Controls&lt;br /&gt;
* Change Size and Position of Controls&lt;br /&gt;
* Change Label/Button Text&lt;br /&gt;
* International Character Support&lt;br /&gt;
* Change Font/Text Size&lt;br /&gt;
* Bitmap Buttons and Labels&lt;br /&gt;
* JPG, BMP, PNG Bitmaps&lt;br /&gt;
* Toggle Bitmap Labels (LEDs)&lt;br /&gt;
* Customizable Keyboard Hotkeys&lt;br /&gt;
* Customizable Button Tool Tips&lt;br /&gt;
* Programmable DRO (Digital Read Output) Labels&lt;br /&gt;
* Custom User Entry Controls&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 6-axes default screen is changed to a 5-axes screen by deleting the z-axis. We start by installing KMotion 4.34b or later. Note that if you don’t already have Dot Net version 4.62 or Visual Studio 2015 libraries installed, you will be prompted to load those. Create desktop icons for KMotion, KMotionCNC and KMotionCNC Screen Editor. Run KMotion and observe the default 3-axes resizable screen.&lt;br /&gt;
&lt;br /&gt;
[[File:3axes-resizable-screen.png|none|link=|504x286px]]&lt;br /&gt;
&lt;br /&gt;
Close the G Viewer window and change the dialog face to Default Custom Screen with no screen script specified. (Tool Setup):&lt;br /&gt;
&lt;br /&gt;
[[File:Default-custom-screen.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Now run the KMotionCNC Screen Editor. It automatically syncs to KMotionCNC’s controls and they are graphically displayed.&lt;br /&gt;
&lt;br /&gt;
This graphical representation allows you to select which controls you want to modify.&lt;br /&gt;
&lt;br /&gt;
Notice we can select a control and immediately hide or show it over at KMotionCNC. The controls can be moved or resized. There is also unlimited undo/redo. Multiple controls can be selected by dragging the mouse over the graphical display. Click SHIFT to add more controls, or CTRL to remove from the selection.&lt;br /&gt;
&lt;br /&gt;
'''Examples: '''&lt;br /&gt;
&lt;br /&gt;
* Select multiple controls for hiding and moving.&lt;br /&gt;
* Change main dialog screen dimensions.&lt;br /&gt;
* Change label text. Push SET key and KMotion CNC screen updates the text.&lt;br /&gt;
* Increase the size of the controls.&lt;br /&gt;
&lt;br /&gt;
The screen editor features international text support. Note that only certain fonts are capable of displaying international text. In our example, we selected Arial.&lt;br /&gt;
&lt;br /&gt;
Labels can show or toggle bitmaps based on an IO bit. As an example, we first we select bitmap 1, then bitmap 2. Increase the size of the label, so the bitmap shows properly. Then assign an IO bit number that will control the bitmap displayed. Notice the bitmap turns green, because the bit is currently on. Open KMotion and look at the state of IO bit #46 and see that it is on. Toggling the bit affects the bitmap on the screen:&lt;br /&gt;
&lt;br /&gt;
[[File:Toggle-IO-bit.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Users can configure push buttons for text, font, size, color, and tool tip. Select two sample labels and change them to type: button. Select both buttons and modify their fonts as well as their size. Four colors are available for text and background, each in normal and depressed button state. You can then change the name of each button individually, one to say “On” and the other“Off”. You can assign tool tips to each of the buttons, so when the operator hovers over the buttons, they will be prompted with a tool tip notification.&lt;br /&gt;
&lt;br /&gt;
Buttons can be assigned to perform actions. Select a script that can either be a screen script or an action. We select an action type to set bit 46 to 1. Notice that this is the script that indicated that. For the other button, we select an action which sets bit 46 to 0. Now pushing the buttons will perform these actions. Save your new screen as a screen script file. Screen script is under the KMotionCNC directory and the sub-directory“Screens”. Configure KMotionCNC to use this new screen at every new startup.Notice that tool setup screen can be accessed by right-mouse clicking on the KMotionCNC title (in “Tools/Setup files”). Select the screen you just created.&lt;br /&gt;
&lt;br /&gt;
Some more advanced features include input fields, C program actions, label DROs. Load the addition example in the screen editor. Example contains two user input controls and one DRO label control. The input edit controls are associated with KFLOP persist variables 160 and 161. The DRO label is associated with KFLOP persist variable 162. The Add button is configured for screen script action to run a C program in KFLOP. The C program is contained in the file “Add.c”. Test it by entering two values and pushing the Add button. Now open KMotion and look at the simple C code that is behind the function. (Open the file “Add.c”).&lt;br /&gt;
&lt;br /&gt;
=====Momentary and Toggle button types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|eE2mSUXxN2M}}&lt;br /&gt;
&lt;br /&gt;
Start KMotion CNC Screen Editor, and click on the “Main” tab, then on “Read Script” and choose the file named MomentaryToggle.scr&lt;br /&gt;
&lt;br /&gt;
You will see two buttons, a Momentary button assigned to bit46 and a Toggle button assigned to bit 47. You will also see two labels to display the status of bits 46 and 47 as LED bitmaps. We also have KMotion displaying the status of bits 46 and 47.&lt;br /&gt;
&lt;br /&gt;
[[File:Momentary-button-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Clicking the Momentary button activates the bit; releasing it, deactivates it. Clicking the Toggle button once sets the bit; clicking it again releases it.&lt;br /&gt;
&lt;br /&gt;
=====Dual Button Types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|8dAEeGnLaRg}}&lt;br /&gt;
&lt;br /&gt;
Certain buttons connected to internal status modes display one of 2 bitmaps depending on the state. Such as the Cycle Start Button displays either a Play image or a Halt image dependent on whether a Job is running. The 2 bitmaps can be reassigned to override the default images.&lt;br /&gt;
&lt;br /&gt;
=====Instantaneous Feed Rate Display=====&lt;br /&gt;
[https://youtu.be/w-bKvqXCd0Q https://youtu.be/w-bKvqXCd0Q]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|[https://youtu.be/w-bKvqXCd0Q w-bKvqXCd0Q]}}&lt;br /&gt;
&lt;br /&gt;
Normally the feed rate indication in KMotionCNC shows ''average'' feed rate over 100ms, assuming straight line motion. Here we use a C program to calculate a more instantaneous rate and display it on the KMotionCNC screen using the KMotionCNC screen editor. Here the C program samples two positions and times, computes the delta position and the delta time, formats it to a string and displays it onto DRO label 162 in KMotionCNC and it performs this action roughly every one ½ seconds. Here is the screen script for the screen shown on the left, we’ve added a type DRO label in the screen editor, edited colors and it is connected to persist variable 162. This job consist of a rapid helix bore at a rate of about 6 revolutions per second. It shows the instant feed rate being more correct.&lt;br /&gt;
&lt;br /&gt;
There is a newer example which also displays the feed rate as a vertical bar graph.  See:&lt;br /&gt;
&lt;br /&gt;
ShowInstantFeedRate3AxisBar.scr and related C Program ShowInstantVelocityDROBar.c&lt;br /&gt;
&lt;br /&gt;
=====Split/Full/Hidden GViewer Display on Main Dialog Face=====&lt;br /&gt;
[https://youtu.be/VkBhYpyGpNU https://youtu.be/VkBhYpyGpNU]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|VkBhYpyGpNU}}&lt;br /&gt;
&lt;br /&gt;
=====Using Resizeable/Floating GViewer Control with Custom Screen=====&lt;br /&gt;
Normally with a Custom Screen the GViewer Plotting is sent to the GViewer Control on the Main Dialog Face and the floating/re-sizable GViewer window is not used.  It is normally closed and the GViwer Button to open it is hidden.  However if it is desired to use the floating/re-sizable GViewer window rather than the Control on the Main Screen (which is hidden), this can be accomplished by setting the Var parameter for the Main Screen GViewer Control (IDC_viewctrl) to 0.  Non-zero values will direct the Plotting to the GViewer Control on the Main Dialog Face.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Main Screen Style=====&lt;br /&gt;
KMotionCNC Screen Editor supports changing main screen style. See the Main Dialog Screen Option under the Main Tab.  Boolean Screen Script Options: &amp;quot;Caption:&amp;quot; &amp;quot;MaxBox:&amp;quot; &amp;quot;MinBox:&amp;quot; &amp;quot;ResizeFrame:&amp;quot; &amp;quot;Maximize:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Maximized Captionless KMotionCNC Screens=====&lt;br /&gt;
[https://youtu.be/R44F0_upIoA https://youtu.be/R44F0_upIoA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|R44F0_upIoA}}&lt;br /&gt;
&lt;br /&gt;
New option in KMotionCNC Screen Editor V4.34e allows screens to be maximized to full screen and with or without Window Frame/Title. New options in Screen Editor: turn minimum box on or off, maximum box on or off, resizing frame on or off. Caption on top can be present or absent.&lt;br /&gt;
&lt;br /&gt;
Available viewing options (three buttons on the top-right hand side of the screen: “Split”: Split screen mode, “View”: G Code Viewer or “Code”: G Code.&lt;br /&gt;
&lt;br /&gt;
=====Control styles=====&lt;br /&gt;
'''&amp;lt;br /&amp;gt; '''Available style options:&amp;lt;br /&amp;gt; [[File:Style-options.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Label''' &amp;lt;br /&amp;gt; Can be text or bitmap. The background is determined by the main dialog background.&lt;br /&gt;
* '''Button''' &amp;lt;br /&amp;gt; Buttons can have all 4 options (foreground and background colors in on- and off-state) or they can also be bitmaps. Labels can load actions/scripts when the main screen is loaded.&lt;br /&gt;
* '''MotionButton''' &amp;lt;br /&amp;gt; Motion buttons are strictly for jog button use only.&lt;br /&gt;
* '''ToggleButton''' &amp;lt;br /&amp;gt; See description above and [https://www.youtube.com/watch?v=eE2mSUXxN2M video].&lt;br /&gt;
* '''DROLabel &amp;lt;br /&amp;gt; '''('''D'''igital '''R'''ead '''O'''ut) runs a program in KFLOP, e.g. reads two edit cells in the “Add” example and passes back the result. X, Y, and Z are other examples of DRO labels.&lt;br /&gt;
* '''VertBar''' &amp;lt;br /&amp;gt; Plots a vertical graph from 0 to 100% and is read by KFLOP like DRO labels. See also the [https://youtu.be/w-bKvqXCd0Q Instant Feed Rate Display video].&lt;br /&gt;
* '''Radio''' button&lt;br /&gt;
* '''Momentary''' '''button''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
* '''DualButton''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
* '''Checkbox&amp;lt;br /&amp;gt; '''&lt;br /&gt;
* '''DualLabel&amp;lt;br /&amp;gt; '''F for feed rate and S for spindle are example of dual labels. They display the state (one or another). They are fixed and cannot be edited.&lt;br /&gt;
&lt;br /&gt;
=====Control attributes=====&lt;br /&gt;
'''[[File:Control-attributes.png|none|link=]]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Select ID'''&amp;lt;br /&amp;gt; Defines the name of the control on the screen.&lt;br /&gt;
* '''Type'''&amp;lt;br /&amp;gt; Defines the type of control, e.g.: CONTROL, PUSHBUTTON, COMBOBOX.&lt;br /&gt;
* '''Font'''&amp;lt;br /&amp;gt; Set the font type, size and normal, bold, or italic.&lt;br /&gt;
* '''BitmapFile1, BitMapFile2&amp;lt;br /&amp;gt; '''Select a bitmap image (.bmp, .gif or .png) for your buttons. BitMapFile1 will show the selected file when the button is in normal state, BitMapFile2 when the button pressed.&lt;br /&gt;
* '''Colors''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (text).&lt;br /&gt;
* '''Highlight''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (background).&lt;br /&gt;
* '''Tool Tip''' &amp;lt;br /&amp;gt; Compose text to describe the button action. This text will be visible when the user hovers over the button.&lt;br /&gt;
* '''HotKey''' &amp;lt;br /&amp;gt; Assigns a keyboard key to perform an action. This field is by default set to “-1”. For example, select a control like “mm” and type “CTRL M” or select “in” and type “CTRL I” and click “Set”. The “x” button next to the field will restore the value back to “-1”.&lt;br /&gt;
* '''Var&amp;lt;br /&amp;gt; '''Numeric variable attribute. Assigning a number toggles the corresponding bit in KFLOP (from 0 to 2047).&lt;br /&gt;
* '''X, Y&amp;lt;br /&amp;gt; '''Changes the horizontal and vertical position of the control.&lt;br /&gt;
* '''Width, Height'''&amp;lt;br /&amp;gt; Changes the size of the control.&lt;br /&gt;
* '''Script'''&amp;lt;br /&amp;gt; Using this field, the user has three options:&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Video demonstration of the creation of Screen Script to perform Windows Messages&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|9x4JTswwWvk}}&lt;br /&gt;
&lt;br /&gt;
a) Selecting a screen script file from the library:&lt;br /&gt;
&lt;br /&gt;
[[File:Script-Option-1.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
b) Selecting an Action:&amp;lt;br /&amp;gt;[[File:Script-Option-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
c) Selecting a Windows Message:&amp;lt;br /&amp;gt; [[File:Script-Option-3.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Show/Hide'''&amp;lt;br /&amp;gt; Select a control and immediately show or hide it.&lt;br /&gt;
&lt;br /&gt;
* '''Move/Resize'''&amp;lt;br /&amp;gt; Move the position of the control or change its size.&lt;br /&gt;
* '''Undo/Redo &amp;lt;br /&amp;gt; '''An unlimited number of undoes and redoes is available.&lt;br /&gt;
* '''Copy/Paste &amp;lt;br /&amp;gt; '''The user can edit all three screens (Split, View, and Code) by clicking “Copy” after making an edit such as moving a button, then loading the next screen, clicking outside the editable area and selecting “Paste”.&lt;br /&gt;
* '''General &amp;lt;br /&amp;gt; '''When selecting multiple controls, white fields are shown when all settings are the same, and grey fields when the values are different. In the example below note that we have selected the radio buttons labeled 1 through 7. While they all share the same font type, size, width and horizontal (x) position etc., “text” and “y-position” are grayed-out, since the radio buttons’ text labels and their vertical position are unique to each field. To override this, just click into the grayed-out field(s) and start editing.&amp;lt;br /&amp;gt;[[File:General.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Main Window attributes=====&lt;br /&gt;
* '''Main Dialog Screen&amp;lt;br /&amp;gt; '''Defines the look and feel as well as the size of your KMotionCNC screen. You can choose a background color, or select a bitmap file as your background. Choose the size of the window, or whether the window should be resizable or fixed and so on. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
* '''Script File'''&amp;lt;br /&amp;gt;Select a screen script file from the library or set an action. A screen script file defines the look of a page. You can assign an action to a button to load a screen script file.&amp;lt;br /&amp;gt;[[File:Style-file.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Bitmap types, Alpha, and locations=====&lt;br /&gt;
&amp;lt;br /&amp;gt;The following bitmap types are supported: .bmp, .gif, and.png. Out of these, only the png file type supports alpha channels, i.e. background transparency.&amp;lt;br /&amp;gt;Images are stored in the following “Resources” location:&amp;lt;br /&amp;gt;\KMotion434i\PC VC Examples\KMotionCNC\res&lt;br /&gt;
&lt;br /&gt;
=====Motion Buttons (for Jogging)=====&lt;br /&gt;
Special Buttons for Jogging exist with Style MotionButton. Although these buttons can be customized with regard to Bitmap images, size, positions, Font, ToolTips, Show/Hide, and Hotkeys they have fixed functionality for the 6 GCode Axes XYZABC.  They support momentary Hotkey and combined mouse operation with the ability to have multiple Hotkeys pushed simultaneously and dynamically change speed using the SHIFT key.  Additional MotionButtons can not be currently added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:MotionButtons.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Jog Buttons are grouped into 6 buttons per axis.  3 of the 6 buttons are used for moving one direction and 3 for the other direction.  The 3 buttons correspond to Stepping a fixed distance, Jogging slow, and Jogging Fast.   The Resource IDs corresponding to each axis are:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''X + = IDC_RightStep, IDC_Right, IDC_Right2'''&lt;br /&gt;
&lt;br /&gt;
'''X - = IDC_LeftStep, IDC_Left, IDC_Left2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Y + = IDC_UpStep, IDC_Up, IDC_Up2'''&lt;br /&gt;
&lt;br /&gt;
'''Y - = IDC_DownStep, IDC_Down, IDC_Down2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Z + = IDC_ZplusStep, IDC_Zplus, IDC_Zplus2'''&lt;br /&gt;
&lt;br /&gt;
'''Z - = IDC_ZminusStep, IDC_Zminus, IDC_Zminus2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''A + = IDC_AplusStep, IDC_Aplus, IDC_Aplus2'''&lt;br /&gt;
&lt;br /&gt;
'''A - = IDC_AminusStep, IDC_Aminus, IDC_Aminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''B + = IDC_BplusStep, IDC_Bplus, IDC_Bplus2'''&lt;br /&gt;
&lt;br /&gt;
'''B - = IDC_BminusStep, IDC_Bminus, IDC_Bminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''C + = IDC_CplusStep, IDC_Cplus, IDC_Cplus2'''&lt;br /&gt;
&lt;br /&gt;
'''C - = IDC_CminusStep, IDC_Cminus, IDC_Cminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note the HotKeys for all 3 Motion Buttons for each axis/direction must be set to the same value.''' This is because the same HotKey combined with CTRL and SHIFT alter the behavior to Step and Fast respectively.  If not all 3 buttons are desired for the screen the others may be hidden but should be all defined to the same HotKey for the HotKey functionality to work correctly.  Furthermore no other buttons should be defined with the same HotKeys.  The Screen Editor has a special feature to test for Duplicate HotKey assignments called &amp;quot;check dup hotkey&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also one associated IDC_StopStep button which will stop any Step Movement currently in progress.&lt;br /&gt;
&lt;br /&gt;
=====Performing an action Immediately within Screen Script=====&lt;br /&gt;
Normally when processing a Screen Script, the &amp;quot;Script&amp;quot; Parameter defines for a Push Button Control what should happen when the Push Button is pushed. However when a &amp;quot;Script&amp;quot; Parameter is specified for a static Label the Action will occur immediately after the Screen Script is processed.&lt;br /&gt;
&lt;br /&gt;
For example: when loading a screen intended for Simulation we might want to have the Simulation mode automatically selected on. So the Script for the IDC_SimulateStatic Label might be set to check the simulate checkbox with:&lt;br /&gt;
&lt;br /&gt;
WinMsg:DlgName;IDC_Simulate;BM_SETCHECK;BST_CHECKED&lt;br /&gt;
&lt;br /&gt;
=====Scaling an Entire Screen or Portion of a Screen=====&lt;br /&gt;
A new Screen Editor feature has been added to stretch/shrink a number of selected screen controls by a specified percentage.  The height and width of the controls can be stretched as with their XY positions.  The horizontal and vertical directions can be Stretched/Shrunk independently.  Scaling the Vertical direction will also scale any Font point settings.  The Width and Height of the entire dialog will also be scaled accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To Scale a Screen:&lt;br /&gt;
&lt;br /&gt;
# Select the controls to be scaled - usually all controls (drag a box to select multiple controls)&lt;br /&gt;
# Select mode: Screen Scale&lt;br /&gt;
# Select the desired Size Change as a percentage 1-100% (ie 60% corresponds to a stretch/shrink factor of 1.6)&lt;br /&gt;
# Push Increase/Decrease Width button&lt;br /&gt;
# Push Increase/Decrease Height button&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: it is best to scale in one step vs multiple steps as control widths and font sizes are integers and may have rounding after each step.&lt;br /&gt;
&lt;br /&gt;
Note: any bitmap images will be unchanged and remain the same size.  They can be manually scaled with a graphics app if necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen Editor with Screen Scale of 60% and all controls selected:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale.png|none|link=|710x627px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Original Screen:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale100.png|none|link=|639x471px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Scaled up 60%&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale160.png|none|link=|879x641px]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor</id>
		<title>KMotionCNC Screen Editor</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor"/>
				<updated>2025-03-30T22:14:08Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Remove unnecessary obsolete code link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' '''&lt;br /&gt;
&lt;br /&gt;
=====Introduction=====&lt;br /&gt;
&lt;br /&gt;
 Video: [https://www.youtube.com/watch?v=uQWDttzKuDA https://www.youtube.com/watch?v=uQWDttzKuDA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|uQWDttzKuDA}}&lt;br /&gt;
&lt;br /&gt;
'''Features include:'''&lt;br /&gt;
&lt;br /&gt;
* Show/Hide Controls&lt;br /&gt;
* Change Size and Position of Controls&lt;br /&gt;
* Change Label/Button Text&lt;br /&gt;
* International Character Support&lt;br /&gt;
* Change Font/Text Size&lt;br /&gt;
* Bitmap Buttons and Labels&lt;br /&gt;
* JPG, BMP, PNG Bitmaps&lt;br /&gt;
* Toggle Bitmap Labels (LEDs)&lt;br /&gt;
* Customizable Keyboard Hotkeys&lt;br /&gt;
* Customizable Button Tool Tips&lt;br /&gt;
* Programmable DRO (Digital Read Output) Labels&lt;br /&gt;
* Custom User Entry Controls&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 6-axes default screen is changed to a 5-axes screen by deleting the z-axis. We start by installing KMotion 4.34b or later. Note that if you don’t already have Dot Net version 4.62 or Visual Studio 2015 libraries installed, you will be prompted to load those. Create desktop icons for KMotion, KMotionCNC and KMotionCNC Screen Editor. Run KMotion and observe the default 3-axes resizable screen.&lt;br /&gt;
&lt;br /&gt;
[[File:3axes-resizable-screen.png|none|link=|504x286px]]&lt;br /&gt;
&lt;br /&gt;
Close the G Viewer window and change the dialog face to Default Custom Screen with no screen script specified. (Tool Setup):&lt;br /&gt;
&lt;br /&gt;
[[File:Default-custom-screen.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Now run the KMotionCNC Screen Editor. It automatically syncs to KMotionCNC’s controls and they are graphically displayed.&lt;br /&gt;
&lt;br /&gt;
This graphical representation allows you to select which controls you want to modify.&lt;br /&gt;
&lt;br /&gt;
Notice we can select a control and immediately hide or show it over at KMotionCNC. The controls can be moved or resized. There is also unlimited undo/redo. Multiple controls can be selected by dragging the mouse over the graphical display. Click SHIFT to add more controls, or CTRL to remove from the selection.&lt;br /&gt;
&lt;br /&gt;
'''Examples: '''&lt;br /&gt;
&lt;br /&gt;
* Select multiple controls for hiding and moving.&lt;br /&gt;
* Change main dialog screen dimensions.&lt;br /&gt;
* Change label text. Push SET key and KMotion CNC screen updates the text.&lt;br /&gt;
* Increase the size of the controls.&lt;br /&gt;
&lt;br /&gt;
The screen editor features international text support. Note that only certain fonts are capable of displaying international text. In our example, we selected Arial.&lt;br /&gt;
&lt;br /&gt;
Labels can show or toggle bitmaps based on an IO bit. As an example, we first we select bitmap 1, then bitmap 2. Increase the size of the label, so the bitmap shows properly. Then assign an IO bit number that will control the bitmap displayed. Notice the bitmap turns green, because the bit is currently on. Open KMotion and look at the state of IO bit #46 and see that it is on. Toggling the bit affects the bitmap on the screen:&lt;br /&gt;
&lt;br /&gt;
[[File:Toggle-IO-bit.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Users can configure push buttons for text, font, size, color, and tool tip. Select two sample labels and change them to type: button. Select both buttons and modify their fonts as well as their size. Four colors are available for text and background, each in normal and depressed button state. You can then change the name of each button individually, one to say “On” and the other“Off”. You can assign tool tips to each of the buttons, so when the operator hovers over the buttons, they will be prompted with a tool tip notification.&lt;br /&gt;
&lt;br /&gt;
Buttons can be assigned to perform actions. Select a script that can either be a screen script or an action. We select an action type to set bit 46 to 1. Notice that this is the script that indicated that. For the other button, we select an action which sets bit 46 to 0. Now pushing the buttons will perform these actions. Save your new screen as a screen script file. Screen script is under the KMotionCNC directory and the sub-directory“Screens”. Configure KMotionCNC to use this new screen at every new startup.Notice that tool setup screen can be accessed by right-mouse clicking on the KMotionCNC title (in “Tools/Setup files”). Select the screen you just created.&lt;br /&gt;
&lt;br /&gt;
Some more advanced features include input fields, C program actions, label DROs. Load the addition example in the screen editor. Example contains two user input controls and one DRO label control. The input edit controls are associated with KFLOP persist variables 160 and 161. The DRO label is associated with KFLOP persist variable 162. The Add button is configured for screen script action to run a C program in KFLOP. The C program is contained in the file “Add.c”. Test it by entering two values and pushing the Add button. Now open KMotion and look at the simple C code that is behind the function. (Open the file “Add.c”).&lt;br /&gt;
&lt;br /&gt;
=====Momentary and Toggle button types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|eE2mSUXxN2M}}&lt;br /&gt;
&lt;br /&gt;
Start KMotion CNC Screen Editor, and click on the “Main” tab, then on “Read Script” and choose the file named MomentaryToggle.scr&lt;br /&gt;
&lt;br /&gt;
You will see two buttons, a Momentary button assigned to bit46 and a Toggle button assigned to bit 47. You will also see two labels to display the status of bits 46 and 47 as LED bitmaps. We also have KMotion displaying the status of bits 46 and 47.&lt;br /&gt;
&lt;br /&gt;
[[File:Momentary-button-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Clicking the Momentary button activates the bit; releasing it, deactivates it. Clicking the Toggle button once sets the bit; clicking it again releases it.&lt;br /&gt;
&lt;br /&gt;
=====Dual Button Types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|8dAEeGnLaRg}}&lt;br /&gt;
&lt;br /&gt;
Certain buttons connected to internal status modes display one of 2 bitmaps depending on the state. Such as the Cycle Start Button displays either a Play image or a Halt image dependent on whether a Job is running. The 2 bitmaps can be reassigned to override the default images.&lt;br /&gt;
&lt;br /&gt;
=====Instantaneous Feed Rate Display=====&lt;br /&gt;
[https://youtu.be/w-bKvqXCd0Q https://youtu.be/w-bKvqXCd0Q]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|[https://youtu.be/w-bKvqXCd0Q w-bKvqXCd0Q]}}&lt;br /&gt;
&lt;br /&gt;
Normally the feed rate indication in KMotionCNC shows ''average'' feed rate over 100ms, assuming straight line motion. Here we use a C program to calculate a more instantaneous rate and display it on the KMotionCNC screen using the KMotionCNC screen editor. Here the C program samples two positions and times, computes the delta position and the delta time, formats it to a string and displays it onto DRO label 162 in KMotionCNC and it performs this action roughly every one ½ seconds. Here is the screen script for the screen shown on the left, we’ve added a type DRO label in the screen editor, edited colors and it is connected to persist variable 162. This job consist of a rapid helix bore at a rate of about 6 revolutions per second. It shows the instant feed rate being more correct.&lt;br /&gt;
&lt;br /&gt;
There is a newer example which also displays the feed rate as a vertical bar graph.  See:&lt;br /&gt;
&lt;br /&gt;
ShowInstantFeedRate3AxisBar.scr and related C Program ShowInstantVelocityDROBar.c&lt;br /&gt;
&lt;br /&gt;
=====Split/Full/Hidden GViewer Display on Main Dialog Face=====&lt;br /&gt;
[https://youtu.be/VkBhYpyGpNU https://youtu.be/VkBhYpyGpNU]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|VkBhYpyGpNU}}&lt;br /&gt;
&lt;br /&gt;
=====Using Resizeable/Floating GViewer Control with Custom Screen=====&lt;br /&gt;
Normally with a Custom Screen the GViewer Plotting is sent to the GViewer Control on the Main Dialog Face and the floating/re-sizable GViewer window is not used.  It is normally closed and the GViwer Button to open it is hidden.  However if it is desired to use the floating/re-sizable GViewer window rather than the Control on the Main Screen (which is hidden), this can be accomplished by setting the Var parameter for the Main Screen GViewer Control (IDC_viewctrl) to 0.  Non-zero values will direct the Plotting to the GViewer Control on the Main Dialog Face.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Main Screen Style=====&lt;br /&gt;
KMotionCNC Screen Editor supports changing main screen style. See the Main Dialog Screen Option under the Main Tab.  Boolean Screen Script Options: &amp;quot;Caption:&amp;quot; &amp;quot;MaxBox:&amp;quot; &amp;quot;MinBox:&amp;quot; &amp;quot;ResizeFrame:&amp;quot; &amp;quot;Maximize:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Maximized Captionless KMotionCNC Screens=====&lt;br /&gt;
[https://youtu.be/R44F0_upIoA https://youtu.be/R44F0_upIoA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|R44F0_upIoA}}&lt;br /&gt;
&lt;br /&gt;
New option in KMotionCNC Screen Editor V4.34e allows screens to be maximized to full screen and with or without Window Frame/Title. New options in Screen Editor: turn minimum box on or off, maximum box on or off, resizing frame on or off. Caption on top can be present or absent.&lt;br /&gt;
&lt;br /&gt;
Available viewing options (three buttons on the top-right hand side of the screen: “Split”: Split screen mode, “View”: G Code Viewer or “Code”: G Code.&lt;br /&gt;
&lt;br /&gt;
=====Control styles=====&lt;br /&gt;
'''&amp;lt;br /&amp;gt; '''Available style options:&amp;lt;br /&amp;gt; [[File:Style-options.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Label''' &amp;lt;br /&amp;gt; Can be text or bitmap. The background is determined by the main dialog background.&lt;br /&gt;
* '''Button''' &amp;lt;br /&amp;gt; Buttons can have all 4 options (foreground and background colors in on- and off-state) or they can also be bitmaps. Labels can load actions/scripts when the main screen is loaded.&lt;br /&gt;
* '''MotionButton''' &amp;lt;br /&amp;gt; Motion buttons are strictly for jog button use only.&lt;br /&gt;
* '''ToggleButton''' &amp;lt;br /&amp;gt; See description above and [https://www.youtube.com/watch?v=eE2mSUXxN2M video].&lt;br /&gt;
* '''DROLabel &amp;lt;br /&amp;gt; '''('''D'''igital '''R'''ead '''O'''ut) runs a program in KFLOP, e.g. reads two edit cells in the “Add” example and passes back the result. X, Y, and Z are other examples of DRO labels.&lt;br /&gt;
* '''VertBar''' &amp;lt;br /&amp;gt; Plots a vertical graph from 0 to 100% and is read by KFLOP like DRO labels. See also the [https://youtu.be/w-bKvqXCd0Q Instant Feed Rate Display video].&lt;br /&gt;
* '''Radio''' button&lt;br /&gt;
* '''Momentary''' '''button''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
* '''DualButton''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
* '''Checkbox&amp;lt;br /&amp;gt; '''&lt;br /&gt;
* '''DualLabel&amp;lt;br /&amp;gt; '''F for feed rate and S for spindle are example of dual labels. They display the state (one or another). They are fixed and cannot be edited.&lt;br /&gt;
&lt;br /&gt;
=====Control attributes=====&lt;br /&gt;
'''[[File:Control-attributes.png|none|link=]]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Select ID'''&amp;lt;br /&amp;gt; Defines the name of the control on the screen.&lt;br /&gt;
* '''Type'''&amp;lt;br /&amp;gt; Defines the type of control, e.g.: CONTROL, PUSHBUTTON, COMBOBOX.&lt;br /&gt;
* '''Font'''&amp;lt;br /&amp;gt; Set the font type, size and normal, bold, or italic.&lt;br /&gt;
* '''BitmapFile1, BitMapFile2&amp;lt;br /&amp;gt; '''Select a bitmap image (.bmp, .gif or .png) for your buttons. BitMapFile1 will show the selected file when the button is in normal state, BitMapFile2 when the button pressed.&lt;br /&gt;
* '''Colors''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (text).&lt;br /&gt;
* '''Highlight''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (background).&lt;br /&gt;
* '''Tool Tip''' &amp;lt;br /&amp;gt; Compose text to describe the button action. This text will be visible when the user hovers over the button.&lt;br /&gt;
* '''HotKey''' &amp;lt;br /&amp;gt; Assigns a keyboard key to perform an action. This field is by default set to “-1”. For example, select a control like “mm” and type “CTRL M” or select “in” and type “CTRL I” and click “Set”. The “x” button next to the field will restore the value back to “-1”.&lt;br /&gt;
* '''Var&amp;lt;br /&amp;gt; '''Numeric variable attribute. Assigning a number toggles the corresponding bit in KFLOP (from 0 to 2047).&lt;br /&gt;
* '''X, Y&amp;lt;br /&amp;gt; '''Changes the horizontal and vertical position of the control.&lt;br /&gt;
* '''Width, Height'''&amp;lt;br /&amp;gt; Changes the size of the control.&lt;br /&gt;
* '''Script'''&amp;lt;br /&amp;gt; Using this field, the user has three options:&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a) Selecting a screen script file from the library:&lt;br /&gt;
&lt;br /&gt;
[[File:Script-Option-1.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
b) Selecting an Action:&amp;lt;br /&amp;gt;[[File:Script-Option-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
c) Selecting a Windows Message:&amp;lt;br /&amp;gt; [[File:Script-Option-3.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Show/Hide'''&amp;lt;br /&amp;gt; Select a control and immediately show or hide it.&lt;br /&gt;
&lt;br /&gt;
* '''Move/Resize'''&amp;lt;br /&amp;gt; Move the position of the control or change its size.&lt;br /&gt;
* '''Undo/Redo &amp;lt;br /&amp;gt; '''An unlimited number of undoes and redoes is available.&lt;br /&gt;
* '''Copy/Paste &amp;lt;br /&amp;gt; '''The user can edit all three screens (Split, View, and Code) by clicking “Copy” after making an edit such as moving a button, then loading the next screen, clicking outside the editable area and selecting “Paste”.&lt;br /&gt;
* '''General &amp;lt;br /&amp;gt; '''When selecting multiple controls, white fields are shown when all settings are the same, and grey fields when the values are different. In the example below note that we have selected the radio buttons labeled 1 through 7. While they all share the same font type, size, width and horizontal (x) position etc., “text” and “y-position” are grayed-out, since the radio buttons’ text labels and their vertical position are unique to each field. To override this, just click into the grayed-out field(s) and start editing.&amp;lt;br /&amp;gt;[[File:General.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Main Window attributes=====&lt;br /&gt;
* '''Main Dialog Screen&amp;lt;br /&amp;gt; '''Defines the look and feel as well as the size of your KMotionCNC screen. You can choose a background color, or select a bitmap file as your background. Choose the size of the window, or whether the window should be resizable or fixed and so on. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
* '''Script File'''&amp;lt;br /&amp;gt;Select a screen script file from the library or set an action. A screen script file defines the look of a page. You can assign an action to a button to load a screen script file.&amp;lt;br /&amp;gt;[[File:Style-file.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Bitmap types, Alpha, and locations=====&lt;br /&gt;
&amp;lt;br /&amp;gt;The following bitmap types are supported: .bmp, .gif, and.png. Out of these, only the png file type supports alpha channels, i.e. background transparency.&amp;lt;br /&amp;gt;Images are stored in the following “Resources” location:&amp;lt;br /&amp;gt;\KMotion434i\PC VC Examples\KMotionCNC\res&lt;br /&gt;
&lt;br /&gt;
=====Motion Buttons (for Jogging)=====&lt;br /&gt;
Special Buttons for Jogging exist with Style MotionButton. Although these buttons can be customized with regard to Bitmap images, size, positions, Font, ToolTips, Show/Hide, and Hotkeys they have fixed functionality for the 6 GCode Axes XYZABC.  They support momentary Hotkey and combined mouse operation with the ability to have multiple Hotkeys pushed simultaneously and dynamically change speed using the SHIFT key.  Additional MotionButtons can not be currently added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:MotionButtons.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Jog Buttons are grouped into 6 buttons per axis.  3 of the 6 buttons are used for moving one direction and 3 for the other direction.  The 3 buttons correspond to Stepping a fixed distance, Jogging slow, and Jogging Fast.   The Resource IDs corresponding to each axis are:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''X + = IDC_RightStep, IDC_Right, IDC_Right2'''&lt;br /&gt;
&lt;br /&gt;
'''X - = IDC_LeftStep, IDC_Left, IDC_Left2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Y + = IDC_UpStep, IDC_Up, IDC_Up2'''&lt;br /&gt;
&lt;br /&gt;
'''Y - = IDC_DownStep, IDC_Down, IDC_Down2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Z + = IDC_ZplusStep, IDC_Zplus, IDC_Zplus2'''&lt;br /&gt;
&lt;br /&gt;
'''Z - = IDC_ZminusStep, IDC_Zminus, IDC_Zminus2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''A + = IDC_AplusStep, IDC_Aplus, IDC_Aplus2'''&lt;br /&gt;
&lt;br /&gt;
'''A - = IDC_AminusStep, IDC_Aminus, IDC_Aminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''B + = IDC_BplusStep, IDC_Bplus, IDC_Bplus2'''&lt;br /&gt;
&lt;br /&gt;
'''B - = IDC_BminusStep, IDC_Bminus, IDC_Bminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''C + = IDC_CplusStep, IDC_Cplus, IDC_Cplus2'''&lt;br /&gt;
&lt;br /&gt;
'''C - = IDC_CminusStep, IDC_Cminus, IDC_Cminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note the HotKeys for all 3 Motion Buttons for each axis/direction must be set to the same value.''' This is because the same HotKey combined with CTRL and SHIFT alter the behavior to Step and Fast respectively.  If not all 3 buttons are desired for the screen the others may be hidden but should be all defined to the same HotKey for the HotKey functionality to work correctly.  Furthermore no other buttons should be defined with the same HotKeys.  The Screen Editor has a special feature to test for Duplicate HotKey assignments called &amp;quot;check dup hotkey&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also one associated IDC_StopStep button which will stop any Step Movement currently in progress.&lt;br /&gt;
&lt;br /&gt;
=====Performing an action Immediately within Screen Script=====&lt;br /&gt;
Normally when processing a Screen Script, the &amp;quot;Script&amp;quot; Parameter defines for a Push Button Control what should happen when the Push Button is pushed. However when a &amp;quot;Script&amp;quot; Parameter is specified for a static Label the Action will occur immediately after the Screen Script is processed.&lt;br /&gt;
&lt;br /&gt;
For example: when loading a screen intended for Simulation we might want to have the Simulation mode automatically selected on. So the Script for the IDC_SimulateStatic Label might be set to check the simulate checkbox with:&lt;br /&gt;
&lt;br /&gt;
WinMsg:DlgName;IDC_Simulate;BM_SETCHECK;BST_CHECKED&lt;br /&gt;
&lt;br /&gt;
=====Scaling an Entire Screen or Portion of a Screen=====&lt;br /&gt;
A new Screen Editor feature has been added to stretch/shrink a number of selected screen controls by a specified percentage.  The height and width of the controls can be stretched as with their XY positions.  The horizontal and vertical directions can be Stretched/Shrunk independently.  Scaling the Vertical direction will also scale any Font point settings.  The Width and Height of the entire dialog will also be scaled accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To Scale a Screen:&lt;br /&gt;
&lt;br /&gt;
# Select the controls to be scaled - usually all controls (drag a box to select multiple controls)&lt;br /&gt;
# Select mode: Screen Scale&lt;br /&gt;
# Select the desired Size Change as a percentage 1-100% (ie 60% corresponds to a stretch/shrink factor of 1.6)&lt;br /&gt;
# Push Increase/Decrease Width button&lt;br /&gt;
# Push Increase/Decrease Height button&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: it is best to scale in one step vs multiple steps as control widths and font sizes are integers and may have rounding after each step.&lt;br /&gt;
&lt;br /&gt;
Note: any bitmap images will be unchanged and remain the same size.  They can be manually scaled with a graphics app if necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen Editor with Screen Scale of 60% and all controls selected:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale.png|none|link=|710x627px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Original Screen:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale100.png|none|link=|639x471px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Scaled up 60%&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale160.png|none|link=|879x641px]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor</id>
		<title>KMotionCNC Screen Editor</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor"/>
				<updated>2025-03-30T22:09:27Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Embed Video&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' '''&lt;br /&gt;
&lt;br /&gt;
=====Introduction=====&lt;br /&gt;
&lt;br /&gt;
 Video: [https://www.youtube.com/watch?v=uQWDttzKuDA https://www.youtube.com/watch?v=uQWDttzKuDA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|uQWDttzKuDA}}&lt;br /&gt;
&lt;br /&gt;
'''Features include:'''&lt;br /&gt;
&lt;br /&gt;
* Show/Hide Controls&lt;br /&gt;
* Change Size and Position of Controls&lt;br /&gt;
* Change Label/Button Text&lt;br /&gt;
* International Character Support&lt;br /&gt;
* Change Font/Text Size&lt;br /&gt;
* Bitmap Buttons and Labels&lt;br /&gt;
* JPG, BMP, PNG Bitmaps&lt;br /&gt;
* Toggle Bitmap Labels (LEDs)&lt;br /&gt;
* Customizable Keyboard Hotkeys&lt;br /&gt;
* Customizable Button Tool Tips&lt;br /&gt;
* Programmable DRO (Digital Read Output) Labels&lt;br /&gt;
* Custom User Entry Controls&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 6-axes default screen is changed to a 5-axes screen by deleting the z-axis. We start by installing KMotion 4.34b or later. Note that if you don’t already have Dot Net version 4.62 or Visual Studio 2015 libraries installed, you will be prompted to load those. Create desktop icons for KMotion, KMotionCNC and KMotionCNC Screen Editor. Run KMotion and observe the default 3-axes resizable screen.&lt;br /&gt;
&lt;br /&gt;
[[File:3axes-resizable-screen.png|none|link=|504x286px]]&lt;br /&gt;
&lt;br /&gt;
Close the G Viewer window and change the dialog face to Default Custom Screen with no screen script specified. (Tool Setup):&lt;br /&gt;
&lt;br /&gt;
[[File:Default-custom-screen.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Now run the KMotionCNC Screen Editor. It automatically syncs to KMotionCNC’s controls and they are graphically displayed.&lt;br /&gt;
&lt;br /&gt;
This graphical representation allows you to select which controls you want to modify.&lt;br /&gt;
&lt;br /&gt;
Notice we can select a control and immediately hide or show it over at KMotionCNC. The controls can be moved or resized. There is also unlimited undo/redo. Multiple controls can be selected by dragging the mouse over the graphical display. Click SHIFT to add more controls, or CTRL to remove from the selection.&lt;br /&gt;
&lt;br /&gt;
'''Examples: '''&lt;br /&gt;
&lt;br /&gt;
* Select multiple controls for hiding and moving.&lt;br /&gt;
* Change main dialog screen dimensions.&lt;br /&gt;
* Change label text. Push SET key and KMotion CNC screen updates the text.&lt;br /&gt;
* Increase the size of the controls.&lt;br /&gt;
&lt;br /&gt;
The screen editor features international text support. Note that only certain fonts are capable of displaying international text. In our example, we selected Arial.&lt;br /&gt;
&lt;br /&gt;
Labels can show or toggle bitmaps based on an IO bit. As an example, we first we select bitmap 1, then bitmap 2. Increase the size of the label, so the bitmap shows properly. Then assign an IO bit number that will control the bitmap displayed. Notice the bitmap turns green, because the bit is currently on. Open KMotion and look at the state of IO bit #46 and see that it is on. Toggling the bit affects the bitmap on the screen:&lt;br /&gt;
&lt;br /&gt;
[[File:Toggle-IO-bit.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Users can configure push buttons for text, font, size, color, and tool tip. Select two sample labels and change them to type: button. Select both buttons and modify their fonts as well as their size. Four colors are available for text and background, each in normal and depressed button state. You can then change the name of each button individually, one to say “On” and the other“Off”. You can assign tool tips to each of the buttons, so when the operator hovers over the buttons, they will be prompted with a tool tip notification.&lt;br /&gt;
&lt;br /&gt;
Buttons can be assigned to perform actions. Select a script that can either be a screen script or an action. We select an action type to set bit 46 to 1. Notice that this is the script that indicated that. For the other button, we select an action which sets bit 46 to 0. Now pushing the buttons will perform these actions. Save your new screen as a screen script file. Screen script is under the KMotionCNC directory and the sub-directory“Screens”. Configure KMotionCNC to use this new screen at every new startup.Notice that tool setup screen can be accessed by right-mouse clicking on the KMotionCNC title (in “Tools/Setup files”). Select the screen you just created.&lt;br /&gt;
&lt;br /&gt;
Some more advanced features include input fields, C program actions, label DROs. Load the addition example in the screen editor. Example contains two user input controls and one DRO label control. The input edit controls are associated with KFLOP persist variables 160 and 161. The DRO label is associated with KFLOP persist variable 162. The Add button is configured for screen script action to run a C program in KFLOP. The C program is contained in the file “Add.c”. Test it by entering two values and pushing the Add button. Now open KMotion and look at the simple C code that is behind the function. (Open the file “Add.c”).&lt;br /&gt;
&lt;br /&gt;
=====Momentary and Toggle button types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|eE2mSUXxN2M}}&lt;br /&gt;
&lt;br /&gt;
Start KMotion CNC Screen Editor, and click on the “Main” tab, then on “Read Script” and choose the file named MomentaryToggle.scr&lt;br /&gt;
&lt;br /&gt;
You will see two buttons, a Momentary button assigned to bit46 and a Toggle button assigned to bit 47. You will also see two labels to display the status of bits 46 and 47 as LED bitmaps. We also have KMotion displaying the status of bits 46 and 47.&lt;br /&gt;
&lt;br /&gt;
[[File:Momentary-button-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Clicking the Momentary button activates the bit; releasing it, deactivates it. Clicking the Toggle button once sets the bit; clicking it again releases it.&lt;br /&gt;
&lt;br /&gt;
=====Dual Button Types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|8dAEeGnLaRg}}&lt;br /&gt;
&lt;br /&gt;
Certain buttons connected to internal status modes display one of 2 bitmaps depending on the state. Such as the Cycle Start Button displays either a Play image or a Halt image dependent on whether a Job is running. The 2 bitmaps can be reassigned to override the default images.&lt;br /&gt;
&lt;br /&gt;
=====Instantaneous Feed Rate Display=====&lt;br /&gt;
[https://youtu.be/w-bKvqXCd0Q https://youtu.be/w-bKvqXCd0Q]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|[https://youtu.be/w-bKvqXCd0Q w-bKvqXCd0Q]}}&lt;br /&gt;
&lt;br /&gt;
Normally the feed rate indication in KMotionCNC shows ''average'' feed rate over 100ms, assuming straight line motion. Here we use a C program to calculate a more instantaneous rate and display it on the KMotionCNC screen using the KMotionCNC screen editor. Here the C program samples two positions and times, computes the delta position and the delta time, formats it to a string and displays it onto DRO label 162 in KMotionCNC and it performs this action roughly every one ½ seconds. Here is the screen script for the screen shown on the left, we’ve added a type DRO label in the screen editor, edited colors and it is connected to persist variable 162. This job consist of a rapid helix bore at a rate of about 6 revolutions per second. It shows the instant feed rate being more correct.&lt;br /&gt;
&lt;br /&gt;
There is a newer example which also displays the feed rate as a vertical bar graph.  See:&lt;br /&gt;
&lt;br /&gt;
ShowInstantFeedRate3AxisBar.scr and related C Program ShowInstantVelocityDROBar.c&lt;br /&gt;
&lt;br /&gt;
=====Split/Full/Hidden GViewer Display on Main Dialog Face=====&lt;br /&gt;
[https://youtu.be/VkBhYpyGpNU https://youtu.be/VkBhYpyGpNU]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|VkBhYpyGpNU}}&lt;br /&gt;
&lt;br /&gt;
=====Using Resizeable/Floating GViewer Control with Custom Screen=====&lt;br /&gt;
Normally with a Custom Screen the GViewer Plotting is sent to the GViewer Control on the Main Dialog Face and the floating/re-sizable GViewer window is not used.  It is normally closed and the GViwer Button to open it is hidden.  However if it is desired to use the floating/re-sizable GViewer window rather than the Control on the Main Screen (which is hidden), this can be accomplished by setting the Var parameter for the Main Screen GViewer Control (IDC_viewctrl) to 0.  Non-zero values will direct the Plotting to the GViewer Control on the Main Dialog Face.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Main Screen Style=====&lt;br /&gt;
KMotionCNC Screen Editor supports changing main screen style. See the Main Dialog Screen Option under the Main Tab.  Boolean Screen Script Options: &amp;quot;Caption:&amp;quot; &amp;quot;MaxBox:&amp;quot; &amp;quot;MinBox:&amp;quot; &amp;quot;ResizeFrame:&amp;quot; &amp;quot;Maximize:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Maximized Captionless KMotionCNC Screens=====&lt;br /&gt;
[https://youtu.be/R44F0_upIoA https://youtu.be/R44F0_upIoA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|R44F0_upIoA}}&lt;br /&gt;
&lt;br /&gt;
New option in KMotionCNC Screen Editor V4.34e allows screens to be maximized to full screen and with or without Window Frame/Title. New options in Screen Editor: turn minimum box on or off, maximum box on or off, resizing frame on or off. Caption on top can be present or absent.&lt;br /&gt;
&lt;br /&gt;
Available viewing options (three buttons on the top-right hand side of the screen: “Split”: Split screen mode, “View”: G Code Viewer or “Code”: G Code.&lt;br /&gt;
&lt;br /&gt;
=====Control styles=====&lt;br /&gt;
'''&amp;lt;br /&amp;gt; '''Available style options:&amp;lt;br /&amp;gt; [[File:Style-options.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Label''' &amp;lt;br /&amp;gt; Can be text or bitmap. The background is determined by the main dialog background.&lt;br /&gt;
* '''Button''' &amp;lt;br /&amp;gt; Buttons can have all 4 options (foreground and background colors in on- and off-state) or they can also be bitmaps. Labels can load actions/scripts when the main screen is loaded.&lt;br /&gt;
* '''MotionButton''' &amp;lt;br /&amp;gt; Motion buttons are strictly for jog button use only.&lt;br /&gt;
* '''ToggleButton''' &amp;lt;br /&amp;gt; See description above and [https://www.youtube.com/watch?v=eE2mSUXxN2M video].&lt;br /&gt;
* '''DROLabel &amp;lt;br /&amp;gt; '''('''D'''igital '''R'''ead '''O'''ut) runs a program in KFLOP, e.g. reads two edit cells in the “Add” example and passes back the result. X, Y, and Z are other examples of DRO labels.&lt;br /&gt;
* '''VertBar''' &amp;lt;br /&amp;gt; Plots a vertical graph from 0 to 100% and is read by KFLOP like DRO labels. See also the [https://youtu.be/w-bKvqXCd0Q Instant Feed Rate Display video].&lt;br /&gt;
* '''Radio''' button&lt;br /&gt;
* '''Momentary''' '''button''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
* '''DualButton''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
* '''Checkbox&amp;lt;br /&amp;gt; '''&lt;br /&gt;
* '''DualLabel&amp;lt;br /&amp;gt; '''F for feed rate and S for spindle are example of dual labels. They display the state (one or another). They are fixed and cannot be edited.&lt;br /&gt;
&lt;br /&gt;
=====Control attributes=====&lt;br /&gt;
'''[[File:Control-attributes.png|none|link=]]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Select ID'''&amp;lt;br /&amp;gt; Defines the name of the control on the screen.&lt;br /&gt;
* '''Type'''&amp;lt;br /&amp;gt; Defines the type of control, e.g.: CONTROL, PUSHBUTTON, COMBOBOX.&lt;br /&gt;
* '''Font'''&amp;lt;br /&amp;gt; Set the font type, size and normal, bold, or italic.&lt;br /&gt;
* '''BitmapFile1, BitMapFile2&amp;lt;br /&amp;gt; '''Select a bitmap image (.bmp, .gif or .png) for your buttons. BitMapFile1 will show the selected file when the button is in normal state, BitMapFile2 when the button pressed.&lt;br /&gt;
* '''Colors''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (text).&lt;br /&gt;
* '''Highlight''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (background).&lt;br /&gt;
* '''Tool Tip''' &amp;lt;br /&amp;gt; Compose text to describe the button action. This text will be visible when the user hovers over the button.&lt;br /&gt;
* '''HotKey''' &amp;lt;br /&amp;gt; Assigns a keyboard key to perform an action. This field is by default set to “-1”. For example, select a control like “mm” and type “CTRL M” or select “in” and type “CTRL I” and click “Set”. The “x” button next to the field will restore the value back to “-1”.&lt;br /&gt;
* '''Var&amp;lt;br /&amp;gt; '''Numeric variable attribute. Assigning a number toggles the corresponding bit in KFLOP (from 0 to 2047).&lt;br /&gt;
* '''X, Y&amp;lt;br /&amp;gt; '''Changes the horizontal and vertical position of the control.&lt;br /&gt;
* '''Width, Height'''&amp;lt;br /&amp;gt; Changes the size of the control.&lt;br /&gt;
* '''Script'''&amp;lt;br /&amp;gt; Using this field, the user has three options:&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a) Selecting a screen script file from the library:&lt;br /&gt;
&lt;br /&gt;
[[File:Script-Option-1.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
b) Selecting an Action:&amp;lt;br /&amp;gt;[[File:Script-Option-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
c) Selecting a Windows Message:&amp;lt;br /&amp;gt; [[File:Script-Option-3.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Show/Hide'''&amp;lt;br /&amp;gt; Select a control and immediately show or hide it.&lt;br /&gt;
&lt;br /&gt;
* '''Move/Resize'''&amp;lt;br /&amp;gt; Move the position of the control or change its size.&lt;br /&gt;
* '''Undo/Redo &amp;lt;br /&amp;gt; '''An unlimited number of undoes and redoes is available.&lt;br /&gt;
* '''Copy/Paste &amp;lt;br /&amp;gt; '''The user can edit all three screens (Split, View, and Code) by clicking “Copy” after making an edit such as moving a button, then loading the next screen, clicking outside the editable area and selecting “Paste”.&lt;br /&gt;
* '''General &amp;lt;br /&amp;gt; '''When selecting multiple controls, white fields are shown when all settings are the same, and grey fields when the values are different. In the example below note that we have selected the radio buttons labeled 1 through 7. While they all share the same font type, size, width and horizontal (x) position etc., “text” and “y-position” are grayed-out, since the radio buttons’ text labels and their vertical position are unique to each field. To override this, just click into the grayed-out field(s) and start editing.&amp;lt;br /&amp;gt;[[File:General.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Main Window attributes=====&lt;br /&gt;
* '''Main Dialog Screen&amp;lt;br /&amp;gt; '''Defines the look and feel as well as the size of your KMotionCNC screen. You can choose a background color, or select a bitmap file as your background. Choose the size of the window, or whether the window should be resizable or fixed and so on. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
* '''Script File'''&amp;lt;br /&amp;gt;Select a screen script file from the library or set an action. A screen script file defines the look of a page. You can assign an action to a button to load a screen script file.&amp;lt;br /&amp;gt;[[File:Style-file.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Bitmap types, Alpha, and locations=====&lt;br /&gt;
&amp;lt;br /&amp;gt;The following bitmap types are supported: .bmp, .gif, and.png. Out of these, only the png file type supports alpha channels, i.e. background transparency.&amp;lt;br /&amp;gt;Images are stored in the following “Resources” location:&amp;lt;br /&amp;gt;\KMotion434i\PC VC Examples\KMotionCNC\res&lt;br /&gt;
&lt;br /&gt;
=====Motion Buttons (for Jogging)=====&lt;br /&gt;
Special Buttons for Jogging exist with Style MotionButton. Although these buttons can be customized with regard to Bitmap images, size, positions, Font, ToolTips, Show/Hide, and Hotkeys they have fixed functionality for the 6 GCode Axes XYZABC.  They support momentary Hotkey and combined mouse operation with the ability to have multiple Hotkeys pushed simultaneously and dynamically change speed using the SHIFT key.  Additional MotionButtons can not be currently added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:MotionButtons.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Jog Buttons are grouped into 6 buttons per axis.  3 of the 6 buttons are used for moving one direction and 3 for the other direction.  The 3 buttons correspond to Stepping a fixed distance, Jogging slow, and Jogging Fast.   The Resource IDs corresponding to each axis are:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''X + = IDC_RightStep, IDC_Right, IDC_Right2'''&lt;br /&gt;
&lt;br /&gt;
'''X - = IDC_LeftStep, IDC_Left, IDC_Left2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Y + = IDC_UpStep, IDC_Up, IDC_Up2'''&lt;br /&gt;
&lt;br /&gt;
'''Y - = IDC_DownStep, IDC_Down, IDC_Down2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Z + = IDC_ZplusStep, IDC_Zplus, IDC_Zplus2'''&lt;br /&gt;
&lt;br /&gt;
'''Z - = IDC_ZminusStep, IDC_Zminus, IDC_Zminus2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''A + = IDC_AplusStep, IDC_Aplus, IDC_Aplus2'''&lt;br /&gt;
&lt;br /&gt;
'''A - = IDC_AminusStep, IDC_Aminus, IDC_Aminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''B + = IDC_BplusStep, IDC_Bplus, IDC_Bplus2'''&lt;br /&gt;
&lt;br /&gt;
'''B - = IDC_BminusStep, IDC_Bminus, IDC_Bminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''C + = IDC_CplusStep, IDC_Cplus, IDC_Cplus2'''&lt;br /&gt;
&lt;br /&gt;
'''C - = IDC_CminusStep, IDC_Cminus, IDC_Cminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note the HotKeys for all 3 Motion Buttons for each axis/direction must be set to the same value.''' This is because the same HotKey combined with CTRL and SHIFT alter the behavior to Step and Fast respectively.  If not all 3 buttons are desired for the screen the others may be hidden but should be all defined to the same HotKey for the HotKey functionality to work correctly.  Furthermore no other buttons should be defined with the same HotKeys.  The Screen Editor has a special feature to test for Duplicate HotKey assignments called &amp;quot;check dup hotkey&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also one associated IDC_StopStep button which will stop any Step Movement currently in progress.&lt;br /&gt;
&lt;br /&gt;
=====Performing an action Immediately within Screen Script=====&lt;br /&gt;
Normally when processing a Screen Script, the &amp;quot;Script&amp;quot; Parameter defines for a Push Button Control what should happen when the Push Button is pushed. However when a &amp;quot;Script&amp;quot; Parameter is specified for a static Label the Action will occur immediately after the Screen Script is processed.&lt;br /&gt;
&lt;br /&gt;
For example: when loading a screen intended for Simulation we might want to have the Simulation mode automatically selected on. So the Script for the IDC_SimulateStatic Label might be set to check the simulate checkbox with:&lt;br /&gt;
&lt;br /&gt;
WinMsg:DlgName;IDC_Simulate;BM_SETCHECK;BST_CHECKED&lt;br /&gt;
&lt;br /&gt;
=====Scaling an Entire Screen or Portion of a Screen=====&lt;br /&gt;
A new Screen Editor feature has been added to stretch/shrink a number of selected screen controls by a specified percentage.  The height and width of the controls can be stretched as with their XY positions.  The horizontal and vertical directions can be Stretched/Shrunk independently.  Scaling the Vertical direction will also scale any Font point settings.  The Width and Height of the entire dialog will also be scaled accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To Scale a Screen:&lt;br /&gt;
&lt;br /&gt;
# Select the controls to be scaled - usually all controls (drag a box to select multiple controls)&lt;br /&gt;
# Select mode: Screen Scale&lt;br /&gt;
# Select the desired Size Change as a percentage 1-100% (ie 60% corresponds to a stretch/shrink factor of 1.6)&lt;br /&gt;
# Push Increase/Decrease Width button&lt;br /&gt;
# Push Increase/Decrease Height button&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: it is best to scale in one step vs multiple steps as control widths and font sizes are integers and may have rounding after each step.&lt;br /&gt;
&lt;br /&gt;
Note: any bitmap images will be unchanged and remain the same size.  They can be manually scaled with a graphics app if necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If not in the current Version a Version with scaling added can be downloaded here (place in \KMotion\Release Directory):&lt;br /&gt;
&lt;br /&gt;
[http://dynomotion.com/Software/Patch/ScreenEditorWithScaling_V434j/KMotionCNCScreenEditor.exe KMotionCNC Screen Editor with Scaling]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen Editor with Screen Scale of 60% and all controls selected:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale.png|none|link=|710x627px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Original Screen:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale100.png|none|link=|639x471px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Scaled up 60%&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale160.png|none|link=|879x641px]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor</id>
		<title>KMotionCNC Screen Editor</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor"/>
				<updated>2025-03-30T21:48:47Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Embed Video&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' '''&lt;br /&gt;
&lt;br /&gt;
=====Introduction=====&lt;br /&gt;
&lt;br /&gt;
 Video: [https://www.youtube.com/watch?v=uQWDttzKuDA https://www.youtube.com/watch?v=uQWDttzKuDA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|uQWDttzKuDA}}&lt;br /&gt;
&lt;br /&gt;
'''Features include:'''&lt;br /&gt;
&lt;br /&gt;
* Show/Hide Controls&lt;br /&gt;
* Change Size and Position of Controls&lt;br /&gt;
* Change Label/Button Text&lt;br /&gt;
* International Character Support&lt;br /&gt;
* Change Font/Text Size&lt;br /&gt;
* Bitmap Buttons and Labels&lt;br /&gt;
* JPG, BMP, PNG Bitmaps&lt;br /&gt;
* Toggle Bitmap Labels (LEDs)&lt;br /&gt;
* Customizable Keyboard Hotkeys&lt;br /&gt;
* Customizable Button Tool Tips&lt;br /&gt;
* Programmable DRO (Digital Read Output) Labels&lt;br /&gt;
* Custom User Entry Controls&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 6-axes default screen is changed to a 5-axes screen by deleting the z-axis. We start by installing KMotion 4.34b or later. Note that if you don’t already have Dot Net version 4.62 or Visual Studio 2015 libraries installed, you will be prompted to load those. Create desktop icons for KMotion, KMotionCNC and KMotionCNC Screen Editor. Run KMotion and observe the default 3-axes resizable screen.&lt;br /&gt;
&lt;br /&gt;
[[File:3axes-resizable-screen.png|none|link=|504x286px]]&lt;br /&gt;
&lt;br /&gt;
Close the G Viewer window and change the dialog face to Default Custom Screen with no screen script specified. (Tool Setup):&lt;br /&gt;
&lt;br /&gt;
[[File:Default-custom-screen.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Now run the KMotionCNC Screen Editor. It automatically syncs to KMotionCNC’s controls and they are graphically displayed.&lt;br /&gt;
&lt;br /&gt;
This graphical representation allows you to select which controls you want to modify.&lt;br /&gt;
&lt;br /&gt;
Notice we can select a control and immediately hide or show it over at KMotionCNC. The controls can be moved or resized. There is also unlimited undo/redo. Multiple controls can be selected by dragging the mouse over the graphical display. Click SHIFT to add more controls, or CTRL to remove from the selection.&lt;br /&gt;
&lt;br /&gt;
'''Examples: '''&lt;br /&gt;
&lt;br /&gt;
* Select multiple controls for hiding and moving.&lt;br /&gt;
* Change main dialog screen dimensions.&lt;br /&gt;
* Change label text. Push SET key and KMotion CNC screen updates the text.&lt;br /&gt;
* Increase the size of the controls.&lt;br /&gt;
&lt;br /&gt;
The screen editor features international text support. Note that only certain fonts are capable of displaying international text. In our example, we selected Arial.&lt;br /&gt;
&lt;br /&gt;
Labels can show or toggle bitmaps based on an IO bit. As an example, we first we select bitmap 1, then bitmap 2. Increase the size of the label, so the bitmap shows properly. Then assign an IO bit number that will control the bitmap displayed. Notice the bitmap turns green, because the bit is currently on. Open KMotion and look at the state of IO bit #46 and see that it is on. Toggling the bit affects the bitmap on the screen:&lt;br /&gt;
&lt;br /&gt;
[[File:Toggle-IO-bit.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Users can configure push buttons for text, font, size, color, and tool tip. Select two sample labels and change them to type: button. Select both buttons and modify their fonts as well as their size. Four colors are available for text and background, each in normal and depressed button state. You can then change the name of each button individually, one to say “On” and the other“Off”. You can assign tool tips to each of the buttons, so when the operator hovers over the buttons, they will be prompted with a tool tip notification.&lt;br /&gt;
&lt;br /&gt;
Buttons can be assigned to perform actions. Select a script that can either be a screen script or an action. We select an action type to set bit 46 to 1. Notice that this is the script that indicated that. For the other button, we select an action which sets bit 46 to 0. Now pushing the buttons will perform these actions. Save your new screen as a screen script file. Screen script is under the KMotionCNC directory and the sub-directory“Screens”. Configure KMotionCNC to use this new screen at every new startup.Notice that tool setup screen can be accessed by right-mouse clicking on the KMotionCNC title (in “Tools/Setup files”). Select the screen you just created.&lt;br /&gt;
&lt;br /&gt;
Some more advanced features include input fields, C program actions, label DROs. Load the addition example in the screen editor. Example contains two user input controls and one DRO label control. The input edit controls are associated with KFLOP persist variables 160 and 161. The DRO label is associated with KFLOP persist variable 162. The Add button is configured for screen script action to run a C program in KFLOP. The C program is contained in the file “Add.c”. Test it by entering two values and pushing the Add button. Now open KMotion and look at the simple C code that is behind the function. (Open the file “Add.c”).&lt;br /&gt;
&lt;br /&gt;
=====Momentary and Toggle button types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|eE2mSUXxN2M}}&lt;br /&gt;
&lt;br /&gt;
Start KMotion CNC Screen Editor, and click on the “Main” tab, then on “Read Script” and choose the file named MomentaryToggle.scr&lt;br /&gt;
&lt;br /&gt;
You will see two buttons, a Momentary button assigned to bit46 and a Toggle button assigned to bit 47. You will also see two labels to display the status of bits 46 and 47 as LED bitmaps. We also have KMotion displaying the status of bits 46 and 47.&lt;br /&gt;
&lt;br /&gt;
[[File:Momentary-button-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Clicking the Momentary button activates the bit; releasing it,deactivates it. Clicking the Toggle button once sets the bit; clicking it again releases it.&lt;br /&gt;
&lt;br /&gt;
=====Instantaneous Feed Rate Display=====&lt;br /&gt;
[https://youtu.be/w-bKvqXCd0Q https://youtu.be/w-bKvqXCd0Q]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|[https://youtu.be/w-bKvqXCd0Q w-bKvqXCd0Q]}}&lt;br /&gt;
&lt;br /&gt;
Normally the feed rate indication in KMotionCNC shows ''average'' feed rate over 100ms, assuming straight line motion. Here we use a C program to calculate a more instantaneous rate and display it on the KMotionCNC screen using the KMotionCNC screen editor. Here the C program samples two positions and times, computes the delta position and the delta time, formats it to a string and displays it onto DRO label 162 in KMotionCNC and it performs this action roughly every one ½ seconds. Here is the screen script for the screen shown on the left, we’ve added a type DRO label in the screen editor, edited colors and it is connected to persist variable 162. This job consist of a rapid helix bore at a rate of about 6 revolutions per second. It shows the instant feed rate being more correct.&lt;br /&gt;
&lt;br /&gt;
There is a newer example which also displays the feed rate as a vertical bar graph.  See:&lt;br /&gt;
&lt;br /&gt;
ShowInstantFeedRate3AxisBar.scr and related C Program ShowInstantVelocityDROBar.c&lt;br /&gt;
&lt;br /&gt;
=====Split/Full/Hidden GViewer Display on Main Dialog Face=====&lt;br /&gt;
[https://youtu.be/VkBhYpyGpNU https://youtu.be/VkBhYpyGpNU]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|VkBhYpyGpNU}}&lt;br /&gt;
&lt;br /&gt;
=====Using Resizeable/Floating GViewer Control with Custom Screen=====&lt;br /&gt;
Normally with a Custom Screen the GViewer Plotting is sent to the GViewer Control on the Main Dialog Face and the floating/re-sizable GViewer window is not used.  It is normally closed and the GViwer Button to open it is hidden.  However if it is desired to use the floating/re-sizable GViewer window rather than the Control on the Main Screen (which is hidden), this can be accomplished by setting the Var parameter for the Main Screen GViewer Control (IDC_viewctrl) to 0.  Non-zero values will direct the Plotting to the GViewer Control on the Main Dialog Face.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Main Screen Style=====&lt;br /&gt;
KMotionCNC Screen Editor supports changing main screen style. See the Main Dialog Screen Option under the Main Tab.  Boolean Screen Script Options: &amp;quot;Caption:&amp;quot; &amp;quot;MaxBox:&amp;quot; &amp;quot;MinBox:&amp;quot; &amp;quot;ResizeFrame:&amp;quot; &amp;quot;Maximize:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Maximized Captionless KMotionCNC Screens=====&lt;br /&gt;
[https://youtu.be/R44F0_upIoA https://youtu.be/R44F0_upIoA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|R44F0_upIoA}}&lt;br /&gt;
&lt;br /&gt;
New option in KMotionCNC Screen Editor V4.34e allows screens to be maximized to full screen and with or without Window Frame/Title. New options in Screen Editor: turn minimum box on or off, maximum box on or off, resizing frame on or off. Caption on top can be present or absent.&lt;br /&gt;
&lt;br /&gt;
Available viewing options (three buttons on the top-right hand side of the screen: “Split”: Split screen mode, “View”: G Code Viewer or “Code”: G Code.&lt;br /&gt;
&lt;br /&gt;
=====Control styles=====&lt;br /&gt;
'''&amp;lt;br /&amp;gt; '''Available style options:&amp;lt;br /&amp;gt; [[File:Style-options.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Label''' &amp;lt;br /&amp;gt; Can be text or bitmap. The background is determined by the main dialog background.&lt;br /&gt;
* '''Button''' &amp;lt;br /&amp;gt; Buttons can have all 4 options (foreground and background colors in on- and off-state) or they can also be bitmaps. Labels can load actions/scripts when the main screen is loaded.&lt;br /&gt;
* '''MotionButton''' &amp;lt;br /&amp;gt; Motion buttons are strictly for jog button use only.&lt;br /&gt;
* '''ToggleButton''' &amp;lt;br /&amp;gt; See description above and [https://www.youtube.com/watch?v=eE2mSUXxN2M video].&lt;br /&gt;
* '''DROLabel &amp;lt;br /&amp;gt; '''('''D'''igital '''R'''ead '''O'''ut) runs a program in KFLOP, e.g. reads two edit cells in the “Add” example and passes back the result. X, Y, and Z are other examples of DRO labels.&lt;br /&gt;
* '''VertBar''' &amp;lt;br /&amp;gt; Plots a vertical graph from 0 to 100% and is read by KFLOP like DRO labels. See also the [https://youtu.be/w-bKvqXCd0Q Instant Feed Rate Display video].&lt;br /&gt;
* '''Radio''' button&lt;br /&gt;
* '''Momentary''' '''button''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
* '''DualButton''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
* '''Checkbox&amp;lt;br /&amp;gt; '''&lt;br /&gt;
* '''DualLabel&amp;lt;br /&amp;gt; '''F for feed rate and S for spindle are example of dual labels. They display the state (one or another). They are fixed and cannot be edited.&lt;br /&gt;
&lt;br /&gt;
=====Control attributes=====&lt;br /&gt;
'''[[File:Control-attributes.png|none|link=]]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Select ID'''&amp;lt;br /&amp;gt; Defines the name of the control on the screen.&lt;br /&gt;
* '''Type'''&amp;lt;br /&amp;gt; Defines the type of control, e.g.: CONTROL, PUSHBUTTON, COMBOBOX.&lt;br /&gt;
* '''Font'''&amp;lt;br /&amp;gt; Set the font type, size and normal, bold, or italic.&lt;br /&gt;
* '''BitmapFile1, BitMapFile2&amp;lt;br /&amp;gt; '''Select a bitmap image (.bmp, .gif or .png) for your buttons. BitMapFile1 will show the selected file when the button is in normal state, BitMapFile2 when the button pressed.&lt;br /&gt;
* '''Colors''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (text).&lt;br /&gt;
* '''Highlight''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (background).&lt;br /&gt;
* '''Tool Tip''' &amp;lt;br /&amp;gt; Compose text to describe the button action. This text will be visible when the user hovers over the button.&lt;br /&gt;
* '''HotKey''' &amp;lt;br /&amp;gt; Assigns a keyboard key to perform an action. This field is by default set to “-1”. For example, select a control like “mm” and type “CTRL M” or select “in” and type “CTRL I” and click “Set”. The “x” button next to the field will restore the value back to “-1”.&lt;br /&gt;
* '''Var&amp;lt;br /&amp;gt; '''Numeric variable attribute. Assigning a number toggles the corresponding bit in KFLOP (from 0 to 2047).&lt;br /&gt;
* '''X, Y&amp;lt;br /&amp;gt; '''Changes the horizontal and vertical position of the control.&lt;br /&gt;
* '''Width, Height'''&amp;lt;br /&amp;gt; Changes the size of the control.&lt;br /&gt;
* '''Script'''&amp;lt;br /&amp;gt; Using this field, the user has three options:&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a) Selecting a screen script file from the library:&lt;br /&gt;
&lt;br /&gt;
[[File:Script-Option-1.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
b) Selecting an Action:&amp;lt;br /&amp;gt;[[File:Script-Option-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
c) Selecting a Windows Message:&amp;lt;br /&amp;gt; [[File:Script-Option-3.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Show/Hide'''&amp;lt;br /&amp;gt; Select a control and immediately show or hide it.&lt;br /&gt;
&lt;br /&gt;
* '''Move/Resize'''&amp;lt;br /&amp;gt; Move the position of the control or change its size.&lt;br /&gt;
* '''Undo/Redo &amp;lt;br /&amp;gt; '''An unlimited number of undoes and redoes is available.&lt;br /&gt;
* '''Copy/Paste &amp;lt;br /&amp;gt; '''The user can edit all three screens (Split, View, and Code) by clicking “Copy” after making an edit such as moving a button, then loading the next screen, clicking outside the editable area and selecting “Paste”.&lt;br /&gt;
* '''General &amp;lt;br /&amp;gt; '''When selecting multiple controls, white fields are shown when all settings are the same, and grey fields when the values are different. In the example below note that we have selected the radio buttons labeled 1 through 7. While they all share the same font type, size, width and horizontal (x) position etc., “text” and “y-position” are grayed-out, since the radio buttons’ text labels and their vertical position are unique to each field. To override this, just click into the grayed-out field(s) and start editing.&amp;lt;br /&amp;gt;[[File:General.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Main Window attributes=====&lt;br /&gt;
* '''Main Dialog Screen&amp;lt;br /&amp;gt; '''Defines the look and feel as well as the size of your KMotionCNC screen. You can choose a background color, or select a bitmap file as your background. Choose the size of the window, or whether the window should be resizable or fixed and so on. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
* '''Script File'''&amp;lt;br /&amp;gt;Select a screen script file from the library or set an action. A screen script file defines the look of a page. You can assign an action to a button to load a screen script file.&amp;lt;br /&amp;gt;[[File:Style-file.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Bitmap types, Alpha, and locations=====&lt;br /&gt;
&amp;lt;br /&amp;gt;The following bitmap types are supported: .bmp, .gif, and.png. Out of these, only the png file type supports alpha channels, i.e. background transparency.&amp;lt;br /&amp;gt;Images are stored in the following “Resources” location:&amp;lt;br /&amp;gt;\KMotion434i\PC VC Examples\KMotionCNC\res&lt;br /&gt;
&lt;br /&gt;
=====Motion Buttons (for Jogging)=====&lt;br /&gt;
Special Buttons for Jogging exist with Style MotionButton. Although these buttons can be customized with regard to Bitmap images, size, positions, Font, ToolTips, Show/Hide, and Hotkeys they have fixed functionality for the 6 GCode Axes XYZABC.  They support momentary Hotkey and combined mouse operation with the ability to have multiple Hotkeys pushed simultaneously and dynamically change speed using the SHIFT key.  Additional MotionButtons can not be currently added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:MotionButtons.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Jog Buttons are grouped into 6 buttons per axis.  3 of the 6 buttons are used for moving one direction and 3 for the other direction.  The 3 buttons correspond to Stepping a fixed distance, Jogging slow, and Jogging Fast.   The Resource IDs corresponding to each axis are:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''X + = IDC_RightStep, IDC_Right, IDC_Right2'''&lt;br /&gt;
&lt;br /&gt;
'''X - = IDC_LeftStep, IDC_Left, IDC_Left2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Y + = IDC_UpStep, IDC_Up, IDC_Up2'''&lt;br /&gt;
&lt;br /&gt;
'''Y - = IDC_DownStep, IDC_Down, IDC_Down2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Z + = IDC_ZplusStep, IDC_Zplus, IDC_Zplus2'''&lt;br /&gt;
&lt;br /&gt;
'''Z - = IDC_ZminusStep, IDC_Zminus, IDC_Zminus2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''A + = IDC_AplusStep, IDC_Aplus, IDC_Aplus2'''&lt;br /&gt;
&lt;br /&gt;
'''A - = IDC_AminusStep, IDC_Aminus, IDC_Aminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''B + = IDC_BplusStep, IDC_Bplus, IDC_Bplus2'''&lt;br /&gt;
&lt;br /&gt;
'''B - = IDC_BminusStep, IDC_Bminus, IDC_Bminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''C + = IDC_CplusStep, IDC_Cplus, IDC_Cplus2'''&lt;br /&gt;
&lt;br /&gt;
'''C - = IDC_CminusStep, IDC_Cminus, IDC_Cminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note the HotKeys for all 3 Motion Buttons for each axis/direction must be set to the same value.''' This is because the same HotKey combined with CTRL and SHIFT alter the behavior to Step and Fast respectively.  If not all 3 buttons are desired for the screen the others may be hidden but should be all defined to the same HotKey for the HotKey functionality to work correctly.  Furthermore no other buttons should be defined with the same HotKeys.  The Screen Editor has a special feature to test for Duplicate HotKey assignments called &amp;quot;check dup hotkey&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also one associated IDC_StopStep button which will stop any Step Movement currently in progress.&lt;br /&gt;
&lt;br /&gt;
=====Performing an action Immediately within Screen Script=====&lt;br /&gt;
Normally when processing a Screen Script, the &amp;quot;Script&amp;quot; Parameter defines for a Push Button Control what should happen when the Push Button is pushed. However when a &amp;quot;Script&amp;quot; Parameter is specified for a static Label the Action will occur immediately after the Screen Script is processed.&lt;br /&gt;
&lt;br /&gt;
For example: when loading a screen intended for Simulation we might want to have the Simulation mode automatically selected on. So the Script for the IDC_SimulateStatic Label might be set to check the simulate checkbox with:&lt;br /&gt;
&lt;br /&gt;
WinMsg:DlgName;IDC_Simulate;BM_SETCHECK;BST_CHECKED&lt;br /&gt;
&lt;br /&gt;
=====Scaling an Entire Screen or Portion of a Screen=====&lt;br /&gt;
A new Screen Editor feature has been added to stretch/shrink a number of selected screen controls by a specified percentage.  The height and width of the controls can be stretched as with their XY positions.  The horizontal and vertical directions can be Stretched/Shrunk independently.  Scaling the Vertical direction will also scale any Font point settings.  The Width and Height of the entire dialog will also be scaled accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To Scale a Screen:&lt;br /&gt;
&lt;br /&gt;
# Select the controls to be scaled - usually all controls (drag a box to select multiple controls)&lt;br /&gt;
# Select mode: Screen Scale&lt;br /&gt;
# Select the desired Size Change as a percentage 1-100% (ie 60% corresponds to a stretch/shrink factor of 1.6)&lt;br /&gt;
# Push Increase/Decrease Width button&lt;br /&gt;
# Push Increase/Decrease Height button&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: it is best to scale in one step vs multiple steps as control widths and font sizes are integers and may have rounding after each step.&lt;br /&gt;
&lt;br /&gt;
Note: any bitmap images will be unchanged and remain the same size.  They can be manually scaled with a graphics app if necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If not in the current Version a Version with scaling added can be downloaded here (place in \KMotion\Release Directory):&lt;br /&gt;
&lt;br /&gt;
[http://dynomotion.com/Software/Patch/ScreenEditorWithScaling_V434j/KMotionCNCScreenEditor.exe KMotionCNC Screen Editor with Scaling]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen Editor with Screen Scale of 60% and all controls selected:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale.png|none|link=|710x627px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Original Screen:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale100.png|none|link=|639x471px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Scaled up 60%&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale160.png|none|link=|879x641px]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor</id>
		<title>KMotionCNC Screen Editor</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor"/>
				<updated>2025-03-30T21:44:31Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Embed Video&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' '''&lt;br /&gt;
&lt;br /&gt;
=====Introduction=====&lt;br /&gt;
&lt;br /&gt;
 Video: [https://www.youtube.com/watch?v=uQWDttzKuDA https://www.youtube.com/watch?v=uQWDttzKuDA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|uQWDttzKuDA}}&lt;br /&gt;
&lt;br /&gt;
'''Features include:'''&lt;br /&gt;
&lt;br /&gt;
* Show/Hide Controls&lt;br /&gt;
* Change Size and Position of Controls&lt;br /&gt;
* Change Label/Button Text&lt;br /&gt;
* International Character Support&lt;br /&gt;
* Change Font/Text Size&lt;br /&gt;
* Bitmap Buttons and Labels&lt;br /&gt;
* JPG, BMP, PNG Bitmaps&lt;br /&gt;
* Toggle Bitmap Labels (LEDs)&lt;br /&gt;
* Customizable Keyboard Hotkeys&lt;br /&gt;
* Customizable Button Tool Tips&lt;br /&gt;
* Programmable DRO (Digital Read Output) Labels&lt;br /&gt;
* Custom User Entry Controls&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 6-axes default screen is changed to a 5-axes screen by deleting the z-axis. We start by installing KMotion 4.34b or later. Note that if you don’t already have Dot Net version 4.62 or Visual Studio 2015 libraries installed, you will be prompted to load those. Create desktop icons for KMotion, KMotionCNC and KMotionCNC Screen Editor. Run KMotion and observe the default 3-axes resizable screen.&lt;br /&gt;
&lt;br /&gt;
[[File:3axes-resizable-screen.png|none|link=|504x286px]]&lt;br /&gt;
&lt;br /&gt;
Close the G Viewer window and change the dialog face to Default Custom Screen with no screen script specified. (Tool Setup):&lt;br /&gt;
&lt;br /&gt;
[[File:Default-custom-screen.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Now run the KMotionCNC Screen Editor. It automatically syncs to KMotionCNC’s controls and they are graphically displayed.&lt;br /&gt;
&lt;br /&gt;
This graphical representation allows you to select which controls you want to modify.&lt;br /&gt;
&lt;br /&gt;
Notice we can select a control and immediately hide or show it over at KMotionCNC. The controls can be moved or resized. There is also unlimited undo/redo. Multiple controls can be selected by dragging the mouse over the graphical display. Click SHIFT to add more controls, or CTRL to remove from the selection.&lt;br /&gt;
&lt;br /&gt;
'''Examples: '''&lt;br /&gt;
&lt;br /&gt;
* Select multiple controls for hiding and moving.&lt;br /&gt;
* Change main dialog screen dimensions.&lt;br /&gt;
* Change label text. Push SET key and KMotion CNC screen updates the text.&lt;br /&gt;
* Increase the size of the controls.&lt;br /&gt;
&lt;br /&gt;
The screen editor features international text support. Note that only certain fonts are capable of displaying international text. In our example, we selected Arial.&lt;br /&gt;
&lt;br /&gt;
Labels can show or toggle bitmaps based on an IO bit. As an example, we first we select bitmap 1, then bitmap 2. Increase the size of the label, so the bitmap shows properly. Then assign an IO bit number that will control the bitmap displayed. Notice the bitmap turns green, because the bit is currently on. Open KMotion and look at the state of IO bit #46 and see that it is on. Toggling the bit affects the bitmap on the screen:&lt;br /&gt;
&lt;br /&gt;
[[File:Toggle-IO-bit.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Users can configure push buttons for text, font, size, color, and tool tip. Select two sample labels and change them to type: button. Select both buttons and modify their fonts as well as their size. Four colors are available for text and background, each in normal and depressed button state. You can then change the name of each button individually, one to say “On” and the other“Off”. You can assign tool tips to each of the buttons, so when the operator hovers over the buttons, they will be prompted with a tool tip notification.&lt;br /&gt;
&lt;br /&gt;
Buttons can be assigned to perform actions. Select a script that can either be a screen script or an action. We select an action type to set bit 46 to 1. Notice that this is the script that indicated that. For the other button, we select an action which sets bit 46 to 0. Now pushing the buttons will perform these actions. Save your new screen as a screen script file. Screen script is under the KMotionCNC directory and the sub-directory“Screens”. Configure KMotionCNC to use this new screen at every new startup.Notice that tool setup screen can be accessed by right-mouse clicking on the KMotionCNC title (in “Tools/Setup files”). Select the screen you just created.&lt;br /&gt;
&lt;br /&gt;
Some more advanced features include input fields, C program actions, label DROs. Load the addition example in the screen editor. Example contains two user input controls and one DRO label control. The input edit controls are associated with KFLOP persist variables 160 and 161. The DRO label is associated with KFLOP persist variable 162. The Add button is configured for screen script action to run a C program in KFLOP. The C program is contained in the file “Add.c”. Test it by entering two values and pushing the Add button. Now open KMotion and look at the simple C code that is behind the function. (Open the file “Add.c”).&lt;br /&gt;
&lt;br /&gt;
=====Momentary and Toggle button types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|eE2mSUXxN2M}}&lt;br /&gt;
&lt;br /&gt;
Start KMotion CNC Screen Editor, and click on the “Main” tab, then on “Read Script” and choose the file named MomentaryToggle.scr&lt;br /&gt;
&lt;br /&gt;
You will see two buttons, a Momentary button assigned to bit46 and a Toggle button assigned to bit 47. You will also see two labels to display the status of bits 46 and 47 as LED bitmaps. We also have KMotion displaying the status of bits 46 and 47.&lt;br /&gt;
&lt;br /&gt;
[[File:Momentary-button-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Clicking the Momentary button activates the bit; releasing it,deactivates it. Clicking the Toggle button once sets the bit; clicking it again releases it.&lt;br /&gt;
&lt;br /&gt;
=====Instantaneous Feed Rate Display=====&lt;br /&gt;
[https://youtu.be/w-bKvqXCd0Q https://youtu.be/w-bKvqXCd0Q]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|[https://youtu.be/w-bKvqXCd0Q w-bKvqXCd0Q]}}&lt;br /&gt;
&lt;br /&gt;
Normally the feed rate indication in KMotionCNC shows ''average'' feed rate over 100ms, assuming straight line motion. Here we use a C program to calculate a more instantaneous rate and display it on the KMotionCNC screen using the KMotionCNC screen editor. Here the C program samples two positions and times, computes the delta position and the delta time, formats it to a string and displays it onto DRO label 162 in KMotionCNC and it performs this action roughly every one ½ seconds. Here is the screen script for the screen shown on the left, we’ve added a type DRO label in the screen editor, edited colors and it is connected to persist variable 162. This job consist of a rapid helix bore at a rate of about 6 revolutions per second. It shows the instant feed rate being more correct.&lt;br /&gt;
&lt;br /&gt;
There is a newer example which also displays the feed rate as a vertical bar graph.  See:&lt;br /&gt;
&lt;br /&gt;
ShowInstantFeedRate3AxisBar.scr and related C Program ShowInstantVelocityDROBar.c&lt;br /&gt;
&lt;br /&gt;
=====Split/Full/Hidden GViewer Display on Main Dialog Face=====&lt;br /&gt;
[https://youtu.be/VkBhYpyGpNU https://youtu.be/VkBhYpyGpNU]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|VkBhYpyGpNU}}&lt;br /&gt;
&lt;br /&gt;
=====Using Resizeable/Floating GViewer Control with Custom Screen=====&lt;br /&gt;
Normally with a Custom Screen the GViewer Plotting is sent to the GViewer Control on the Main Dialog Face and the floating/re-sizable GViewer window is not used.  It is normally closed and the GViwer Button to open it is hidden.  However if it is desired to use the floating/re-sizable GViewer window rather than the Control on the Main Screen (which is hidden), this can be accomplished by setting the Var parameter for the Main Screen GViewer Control (IDC_viewctrl) to 0.  Non-zero values will direct the Plotting to the GViewer Control on the Main Dialog Face.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Main Screen Style=====&lt;br /&gt;
KMotionCNC Screen Editor supports changing main screen style. See the Main Dialog Screen Option under the Main Tab.  Boolean Screen Script Options: &amp;quot;Caption:&amp;quot; &amp;quot;MaxBox:&amp;quot; &amp;quot;MinBox:&amp;quot; &amp;quot;ResizeFrame:&amp;quot; &amp;quot;Maximize:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Maximized Captionless KMotionCNC Screens=====&lt;br /&gt;
[https://youtu.be/R44F0_upIoA https://youtu.be/R44F0_upIoA]&lt;br /&gt;
&lt;br /&gt;
New option in KMotionCNC Screen Editor V4.34e allows screens to be maximized to full screen and with or without Window Frame/Title. New options in Screen Editor: turn minimum box on or off, maximum box on or off, resizing frame on or off. Caption on top can be present or absent.&lt;br /&gt;
&lt;br /&gt;
Available viewing options (three buttons on the top-right hand side of the screen: “Split”: Split screen mode, “View”: G Code Viewer or “Code”: G Code.&lt;br /&gt;
&lt;br /&gt;
=====Control styles=====&lt;br /&gt;
'''&amp;lt;br /&amp;gt; '''Available style options:&amp;lt;br /&amp;gt; [[File:Style-options.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Label''' &amp;lt;br /&amp;gt; Can be text or bitmap. The background is determined by the main dialog background.&lt;br /&gt;
* '''Button''' &amp;lt;br /&amp;gt; Buttons can have all 4 options (foreground and background colors in on- and off-state) or they can also be bitmaps. Labels can load actions/scripts when the main screen is loaded.&lt;br /&gt;
* '''MotionButton''' &amp;lt;br /&amp;gt; Motion buttons are strictly for jog button use only.&lt;br /&gt;
* '''ToggleButton''' &amp;lt;br /&amp;gt; See description above and [https://www.youtube.com/watch?v=eE2mSUXxN2M video].&lt;br /&gt;
* '''DROLabel &amp;lt;br /&amp;gt; '''('''D'''igital '''R'''ead '''O'''ut) runs a program in KFLOP, e.g. reads two edit cells in the “Add” example and passes back the result. X, Y, and Z are other examples of DRO labels.&lt;br /&gt;
* '''VertBar''' &amp;lt;br /&amp;gt; Plots a vertical graph from 0 to 100% and is read by KFLOP like DRO labels. See also the [https://youtu.be/w-bKvqXCd0Q Instant Feed Rate Display video].&lt;br /&gt;
* '''Radio''' button&lt;br /&gt;
* '''Momentary''' '''button''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
* '''DualButton''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
* '''Checkbox&amp;lt;br /&amp;gt; '''&lt;br /&gt;
* '''DualLabel&amp;lt;br /&amp;gt; '''F for feed rate and S for spindle are example of dual labels. They display the state (one or another). They are fixed and cannot be edited.&lt;br /&gt;
&lt;br /&gt;
=====Control attributes=====&lt;br /&gt;
'''[[File:Control-attributes.png|none|link=]]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Select ID'''&amp;lt;br /&amp;gt; Defines the name of the control on the screen.&lt;br /&gt;
* '''Type'''&amp;lt;br /&amp;gt; Defines the type of control, e.g.: CONTROL, PUSHBUTTON, COMBOBOX.&lt;br /&gt;
* '''Font'''&amp;lt;br /&amp;gt; Set the font type, size and normal, bold, or italic.&lt;br /&gt;
* '''BitmapFile1, BitMapFile2&amp;lt;br /&amp;gt; '''Select a bitmap image (.bmp, .gif or .png) for your buttons. BitMapFile1 will show the selected file when the button is in normal state, BitMapFile2 when the button pressed.&lt;br /&gt;
* '''Colors''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (text).&lt;br /&gt;
* '''Highlight''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (background).&lt;br /&gt;
* '''Tool Tip''' &amp;lt;br /&amp;gt; Compose text to describe the button action. This text will be visible when the user hovers over the button.&lt;br /&gt;
* '''HotKey''' &amp;lt;br /&amp;gt; Assigns a keyboard key to perform an action. This field is by default set to “-1”. For example, select a control like “mm” and type “CTRL M” or select “in” and type “CTRL I” and click “Set”. The “x” button next to the field will restore the value back to “-1”.&lt;br /&gt;
* '''Var&amp;lt;br /&amp;gt; '''Numeric variable attribute. Assigning a number toggles the corresponding bit in KFLOP (from 0 to 2047).&lt;br /&gt;
* '''X, Y&amp;lt;br /&amp;gt; '''Changes the horizontal and vertical position of the control.&lt;br /&gt;
* '''Width, Height'''&amp;lt;br /&amp;gt; Changes the size of the control.&lt;br /&gt;
* '''Script'''&amp;lt;br /&amp;gt; Using this field, the user has three options:&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a) Selecting a screen script file from the library:&lt;br /&gt;
&lt;br /&gt;
[[File:Script-Option-1.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
b) Selecting an Action:&amp;lt;br /&amp;gt;[[File:Script-Option-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
c) Selecting a Windows Message:&amp;lt;br /&amp;gt; [[File:Script-Option-3.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Show/Hide'''&amp;lt;br /&amp;gt; Select a control and immediately show or hide it.&lt;br /&gt;
&lt;br /&gt;
* '''Move/Resize'''&amp;lt;br /&amp;gt; Move the position of the control or change its size.&lt;br /&gt;
* '''Undo/Redo &amp;lt;br /&amp;gt; '''An unlimited number of undoes and redoes is available.&lt;br /&gt;
* '''Copy/Paste &amp;lt;br /&amp;gt; '''The user can edit all three screens (Split, View, and Code) by clicking “Copy” after making an edit such as moving a button, then loading the next screen, clicking outside the editable area and selecting “Paste”.&lt;br /&gt;
* '''General &amp;lt;br /&amp;gt; '''When selecting multiple controls, white fields are shown when all settings are the same, and grey fields when the values are different. In the example below note that we have selected the radio buttons labeled 1 through 7. While they all share the same font type, size, width and horizontal (x) position etc., “text” and “y-position” are grayed-out, since the radio buttons’ text labels and their vertical position are unique to each field. To override this, just click into the grayed-out field(s) and start editing.&amp;lt;br /&amp;gt;[[File:General.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Main Window attributes=====&lt;br /&gt;
* '''Main Dialog Screen&amp;lt;br /&amp;gt; '''Defines the look and feel as well as the size of your KMotionCNC screen. You can choose a background color, or select a bitmap file as your background. Choose the size of the window, or whether the window should be resizable or fixed and so on. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
* '''Script File'''&amp;lt;br /&amp;gt;Select a screen script file from the library or set an action. A screen script file defines the look of a page. You can assign an action to a button to load a screen script file.&amp;lt;br /&amp;gt;[[File:Style-file.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Bitmap types, Alpha, and locations=====&lt;br /&gt;
&amp;lt;br /&amp;gt;The following bitmap types are supported: .bmp, .gif, and.png. Out of these, only the png file type supports alpha channels, i.e. background transparency.&amp;lt;br /&amp;gt;Images are stored in the following “Resources” location:&amp;lt;br /&amp;gt;\KMotion434i\PC VC Examples\KMotionCNC\res&lt;br /&gt;
&lt;br /&gt;
=====Motion Buttons (for Jogging)=====&lt;br /&gt;
Special Buttons for Jogging exist with Style MotionButton. Although these buttons can be customized with regard to Bitmap images, size, positions, Font, ToolTips, Show/Hide, and Hotkeys they have fixed functionality for the 6 GCode Axes XYZABC.  They support momentary Hotkey and combined mouse operation with the ability to have multiple Hotkeys pushed simultaneously and dynamically change speed using the SHIFT key.  Additional MotionButtons can not be currently added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:MotionButtons.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Jog Buttons are grouped into 6 buttons per axis.  3 of the 6 buttons are used for moving one direction and 3 for the other direction.  The 3 buttons correspond to Stepping a fixed distance, Jogging slow, and Jogging Fast.   The Resource IDs corresponding to each axis are:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''X + = IDC_RightStep, IDC_Right, IDC_Right2'''&lt;br /&gt;
&lt;br /&gt;
'''X - = IDC_LeftStep, IDC_Left, IDC_Left2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Y + = IDC_UpStep, IDC_Up, IDC_Up2'''&lt;br /&gt;
&lt;br /&gt;
'''Y - = IDC_DownStep, IDC_Down, IDC_Down2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Z + = IDC_ZplusStep, IDC_Zplus, IDC_Zplus2'''&lt;br /&gt;
&lt;br /&gt;
'''Z - = IDC_ZminusStep, IDC_Zminus, IDC_Zminus2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''A + = IDC_AplusStep, IDC_Aplus, IDC_Aplus2'''&lt;br /&gt;
&lt;br /&gt;
'''A - = IDC_AminusStep, IDC_Aminus, IDC_Aminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''B + = IDC_BplusStep, IDC_Bplus, IDC_Bplus2'''&lt;br /&gt;
&lt;br /&gt;
'''B - = IDC_BminusStep, IDC_Bminus, IDC_Bminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''C + = IDC_CplusStep, IDC_Cplus, IDC_Cplus2'''&lt;br /&gt;
&lt;br /&gt;
'''C - = IDC_CminusStep, IDC_Cminus, IDC_Cminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note the HotKeys for all 3 Motion Buttons for each axis/direction must be set to the same value.''' This is because the same HotKey combined with CTRL and SHIFT alter the behavior to Step and Fast respectively.  If not all 3 buttons are desired for the screen the others may be hidden but should be all defined to the same HotKey for the HotKey functionality to work correctly.  Furthermore no other buttons should be defined with the same HotKeys.  The Screen Editor has a special feature to test for Duplicate HotKey assignments called &amp;quot;check dup hotkey&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also one associated IDC_StopStep button which will stop any Step Movement currently in progress.&lt;br /&gt;
&lt;br /&gt;
=====Performing an action Immediately within Screen Script=====&lt;br /&gt;
Normally when processing a Screen Script, the &amp;quot;Script&amp;quot; Parameter defines for a Push Button Control what should happen when the Push Button is pushed. However when a &amp;quot;Script&amp;quot; Parameter is specified for a static Label the Action will occur immediately after the Screen Script is processed.&lt;br /&gt;
&lt;br /&gt;
For example: when loading a screen intended for Simulation we might want to have the Simulation mode automatically selected on. So the Script for the IDC_SimulateStatic Label might be set to check the simulate checkbox with:&lt;br /&gt;
&lt;br /&gt;
WinMsg:DlgName;IDC_Simulate;BM_SETCHECK;BST_CHECKED&lt;br /&gt;
&lt;br /&gt;
=====Scaling an Entire Screen or Portion of a Screen=====&lt;br /&gt;
A new Screen Editor feature has been added to stretch/shrink a number of selected screen controls by a specified percentage.  The height and width of the controls can be stretched as with their XY positions.  The horizontal and vertical directions can be Stretched/Shrunk independently.  Scaling the Vertical direction will also scale any Font point settings.  The Width and Height of the entire dialog will also be scaled accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To Scale a Screen:&lt;br /&gt;
&lt;br /&gt;
# Select the controls to be scaled - usually all controls (drag a box to select multiple controls)&lt;br /&gt;
# Select mode: Screen Scale&lt;br /&gt;
# Select the desired Size Change as a percentage 1-100% (ie 60% corresponds to a stretch/shrink factor of 1.6)&lt;br /&gt;
# Push Increase/Decrease Width button&lt;br /&gt;
# Push Increase/Decrease Height button&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: it is best to scale in one step vs multiple steps as control widths and font sizes are integers and may have rounding after each step.&lt;br /&gt;
&lt;br /&gt;
Note: any bitmap images will be unchanged and remain the same size.  They can be manually scaled with a graphics app if necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If not in the current Version a Version with scaling added can be downloaded here (place in \KMotion\Release Directory):&lt;br /&gt;
&lt;br /&gt;
[http://dynomotion.com/Software/Patch/ScreenEditorWithScaling_V434j/KMotionCNCScreenEditor.exe KMotionCNC Screen Editor with Scaling]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen Editor with Screen Scale of 60% and all controls selected:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale.png|none|link=|710x627px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Original Screen:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale100.png|none|link=|639x471px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Scaled up 60%&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale160.png|none|link=|879x641px]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor</id>
		<title>KMotionCNC Screen Editor</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor"/>
				<updated>2025-03-30T21:42:44Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Embed Video&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' '''&lt;br /&gt;
&lt;br /&gt;
=====Introduction=====&lt;br /&gt;
&lt;br /&gt;
 Video: [https://www.youtube.com/watch?v=uQWDttzKuDA https://www.youtube.com/watch?v=uQWDttzKuDA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|uQWDttzKuDA}}&lt;br /&gt;
&lt;br /&gt;
'''Features include:'''&lt;br /&gt;
&lt;br /&gt;
* Show/Hide Controls&lt;br /&gt;
* Change Size and Position of Controls&lt;br /&gt;
* Change Label/Button Text&lt;br /&gt;
* International Character Support&lt;br /&gt;
* Change Font/Text Size&lt;br /&gt;
* Bitmap Buttons and Labels&lt;br /&gt;
* JPG, BMP, PNG Bitmaps&lt;br /&gt;
* Toggle Bitmap Labels (LEDs)&lt;br /&gt;
* Customizable Keyboard Hotkeys&lt;br /&gt;
* Customizable Button Tool Tips&lt;br /&gt;
* Programmable DRO (Digital Read Output) Labels&lt;br /&gt;
* Custom User Entry Controls&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 6-axes default screen is changed to a 5-axes screen by deleting the z-axis. We start by installing KMotion 4.34b or later. Note that if you don’t already have Dot Net version 4.62 or Visual Studio 2015 libraries installed, you will be prompted to load those. Create desktop icons for KMotion, KMotionCNC and KMotionCNC Screen Editor. Run KMotion and observe the default 3-axes resizable screen.&lt;br /&gt;
&lt;br /&gt;
[[File:3axes-resizable-screen.png|none|link=|504x286px]]&lt;br /&gt;
&lt;br /&gt;
Close the G Viewer window and change the dialog face to Default Custom Screen with no screen script specified. (Tool Setup):&lt;br /&gt;
&lt;br /&gt;
[[File:Default-custom-screen.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Now run the KMotionCNC Screen Editor. It automatically syncs to KMotionCNC’s controls and they are graphically displayed.&lt;br /&gt;
&lt;br /&gt;
This graphical representation allows you to select which controls you want to modify.&lt;br /&gt;
&lt;br /&gt;
Notice we can select a control and immediately hide or show it over at KMotionCNC. The controls can be moved or resized. There is also unlimited undo/redo. Multiple controls can be selected by dragging the mouse over the graphical display. Click SHIFT to add more controls, or CTRL to remove from the selection.&lt;br /&gt;
&lt;br /&gt;
'''Examples: '''&lt;br /&gt;
&lt;br /&gt;
* Select multiple controls for hiding and moving.&lt;br /&gt;
* Change main dialog screen dimensions.&lt;br /&gt;
* Change label text. Push SET key and KMotion CNC screen updates the text.&lt;br /&gt;
* Increase the size of the controls.&lt;br /&gt;
&lt;br /&gt;
The screen editor features international text support. Note that only certain fonts are capable of displaying international text. In our example, we selected Arial.&lt;br /&gt;
&lt;br /&gt;
Labels can show or toggle bitmaps based on an IO bit. As an example, we first we select bitmap 1, then bitmap 2. Increase the size of the label, so the bitmap shows properly. Then assign an IO bit number that will control the bitmap displayed. Notice the bitmap turns green, because the bit is currently on. Open KMotion and look at the state of IO bit #46 and see that it is on. Toggling the bit affects the bitmap on the screen:&lt;br /&gt;
&lt;br /&gt;
[[File:Toggle-IO-bit.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Users can configure push buttons for text, font, size, color, and tool tip. Select two sample labels and change them to type: button. Select both buttons and modify their fonts as well as their size. Four colors are available for text and background, each in normal and depressed button state. You can then change the name of each button individually, one to say “On” and the other“Off”. You can assign tool tips to each of the buttons, so when the operator hovers over the buttons, they will be prompted with a tool tip notification.&lt;br /&gt;
&lt;br /&gt;
Buttons can be assigned to perform actions. Select a script that can either be a screen script or an action. We select an action type to set bit 46 to 1. Notice that this is the script that indicated that. For the other button, we select an action which sets bit 46 to 0. Now pushing the buttons will perform these actions. Save your new screen as a screen script file. Screen script is under the KMotionCNC directory and the sub-directory“Screens”. Configure KMotionCNC to use this new screen at every new startup.Notice that tool setup screen can be accessed by right-mouse clicking on the KMotionCNC title (in “Tools/Setup files”). Select the screen you just created.&lt;br /&gt;
&lt;br /&gt;
Some more advanced features include input fields, C program actions, label DROs. Load the addition example in the screen editor. Example contains two user input controls and one DRO label control. The input edit controls are associated with KFLOP persist variables 160 and 161. The DRO label is associated with KFLOP persist variable 162. The Add button is configured for screen script action to run a C program in KFLOP. The C program is contained in the file “Add.c”. Test it by entering two values and pushing the Add button. Now open KMotion and look at the simple C code that is behind the function. (Open the file “Add.c”).&lt;br /&gt;
&lt;br /&gt;
=====Momentary and Toggle button types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|eE2mSUXxN2M}}&lt;br /&gt;
&lt;br /&gt;
Start KMotion CNC Screen Editor, and click on the “Main” tab, then on “Read Script” and choose the file named MomentaryToggle.scr&lt;br /&gt;
&lt;br /&gt;
You will see two buttons, a Momentary button assigned to bit46 and a Toggle button assigned to bit 47. You will also see two labels to display the status of bits 46 and 47 as LED bitmaps. We also have KMotion displaying the status of bits 46 and 47.&lt;br /&gt;
&lt;br /&gt;
[[File:Momentary-button-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Clicking the Momentary button activates the bit; releasing it,deactivates it. Clicking the Toggle button once sets the bit; clicking it again releases it.&lt;br /&gt;
&lt;br /&gt;
=====Instantaneous Feed Rate Display=====&lt;br /&gt;
[https://youtu.be/w-bKvqXCd0Q https://youtu.be/w-bKvqXCd0Q]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|[https://youtu.be/w-bKvqXCd0Q w-bKvqXCd0Q]}}&lt;br /&gt;
&lt;br /&gt;
Normally the feed rate indication in KMotionCNC shows ''average'' feed rate over 100ms, assuming straight line motion. Here we use a C program to calculate a more instantaneous rate and display it on the KMotionCNC screen using the KMotionCNC screen editor. Here the C program samples two positions and times, computes the delta position and the delta time, formats it to a string and displays it onto DRO label 162 in KMotionCNC and it performs this action roughly every one ½ seconds. Here is the screen script for the screen shown on the left, we’ve added a type DRO label in the screen editor, edited colors and it is connected to persist variable 162. This job consist of a rapid helix bore at a rate of about 6 revolutions per second. It shows the instant feed rate being more correct.&lt;br /&gt;
&lt;br /&gt;
There is a newer example which also displays the feed rate as a vertical bar graph.  See:&lt;br /&gt;
&lt;br /&gt;
ShowInstantFeedRate3AxisBar.scr and related C Program ShowInstantVelocityDROBar.c&lt;br /&gt;
&lt;br /&gt;
=====Split/Full/Hidden GViewer Display on Main Dialog Face=====&lt;br /&gt;
[https://youtu.be/VkBhYpyGpNU https://youtu.be/VkBhYpyGpNU]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Using Resizeable/Floating GViewer Control with Custom Screen=====&lt;br /&gt;
Normally with a Custom Screen the GViewer Plotting is sent to the GViewer Control on the Main Dialog Face and the floating/re-sizable GViewer window is not used.  It is normally closed and the GViwer Button to open it is hidden.  However if it is desired to use the floating/re-sizable GViewer window rather than the Control on the Main Screen (which is hidden), this can be accomplished by setting the Var parameter for the Main Screen GViewer Control (IDC_viewctrl) to 0.  Non-zero values will direct the Plotting to the GViewer Control on the Main Dialog Face.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Main Screen Style=====&lt;br /&gt;
KMotionCNC Screen Editor supports changing main screen style. See the Main Dialog Screen Option under the Main Tab.  Boolean Screen Script Options: &amp;quot;Caption:&amp;quot; &amp;quot;MaxBox:&amp;quot; &amp;quot;MinBox:&amp;quot; &amp;quot;ResizeFrame:&amp;quot; &amp;quot;Maximize:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Maximized Captionless KMotionCNC Screens=====&lt;br /&gt;
[https://youtu.be/R44F0_upIoA https://youtu.be/R44F0_upIoA]&lt;br /&gt;
&lt;br /&gt;
New option in KMotionCNC Screen Editor V4.34e allows screens to be maximized to full screen and with or without Window Frame/Title. New options in Screen Editor: turn minimum box on or off, maximum box on or off, resizing frame on or off. Caption on top can be present or absent.&lt;br /&gt;
&lt;br /&gt;
Available viewing options (three buttons on the top-right hand side of the screen: “Split”: Split screen mode, “View”: G Code Viewer or “Code”: G Code.&lt;br /&gt;
&lt;br /&gt;
=====Control styles=====&lt;br /&gt;
'''&amp;lt;br /&amp;gt; '''Available style options:&amp;lt;br /&amp;gt; [[File:Style-options.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Label''' &amp;lt;br /&amp;gt; Can be text or bitmap. The background is determined by the main dialog background.&lt;br /&gt;
* '''Button''' &amp;lt;br /&amp;gt; Buttons can have all 4 options (foreground and background colors in on- and off-state) or they can also be bitmaps. Labels can load actions/scripts when the main screen is loaded.&lt;br /&gt;
* '''MotionButton''' &amp;lt;br /&amp;gt; Motion buttons are strictly for jog button use only.&lt;br /&gt;
* '''ToggleButton''' &amp;lt;br /&amp;gt; See description above and [https://www.youtube.com/watch?v=eE2mSUXxN2M video].&lt;br /&gt;
* '''DROLabel &amp;lt;br /&amp;gt; '''('''D'''igital '''R'''ead '''O'''ut) runs a program in KFLOP, e.g. reads two edit cells in the “Add” example and passes back the result. X, Y, and Z are other examples of DRO labels.&lt;br /&gt;
* '''VertBar''' &amp;lt;br /&amp;gt; Plots a vertical graph from 0 to 100% and is read by KFLOP like DRO labels. See also the [https://youtu.be/w-bKvqXCd0Q Instant Feed Rate Display video].&lt;br /&gt;
* '''Radio''' button&lt;br /&gt;
* '''Momentary''' '''button''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
* '''DualButton''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
* '''Checkbox&amp;lt;br /&amp;gt; '''&lt;br /&gt;
* '''DualLabel&amp;lt;br /&amp;gt; '''F for feed rate and S for spindle are example of dual labels. They display the state (one or another). They are fixed and cannot be edited.&lt;br /&gt;
&lt;br /&gt;
=====Control attributes=====&lt;br /&gt;
'''[[File:Control-attributes.png|none|link=]]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Select ID'''&amp;lt;br /&amp;gt; Defines the name of the control on the screen.&lt;br /&gt;
* '''Type'''&amp;lt;br /&amp;gt; Defines the type of control, e.g.: CONTROL, PUSHBUTTON, COMBOBOX.&lt;br /&gt;
* '''Font'''&amp;lt;br /&amp;gt; Set the font type, size and normal, bold, or italic.&lt;br /&gt;
* '''BitmapFile1, BitMapFile2&amp;lt;br /&amp;gt; '''Select a bitmap image (.bmp, .gif or .png) for your buttons. BitMapFile1 will show the selected file when the button is in normal state, BitMapFile2 when the button pressed.&lt;br /&gt;
* '''Colors''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (text).&lt;br /&gt;
* '''Highlight''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (background).&lt;br /&gt;
* '''Tool Tip''' &amp;lt;br /&amp;gt; Compose text to describe the button action. This text will be visible when the user hovers over the button.&lt;br /&gt;
* '''HotKey''' &amp;lt;br /&amp;gt; Assigns a keyboard key to perform an action. This field is by default set to “-1”. For example, select a control like “mm” and type “CTRL M” or select “in” and type “CTRL I” and click “Set”. The “x” button next to the field will restore the value back to “-1”.&lt;br /&gt;
* '''Var&amp;lt;br /&amp;gt; '''Numeric variable attribute. Assigning a number toggles the corresponding bit in KFLOP (from 0 to 2047).&lt;br /&gt;
* '''X, Y&amp;lt;br /&amp;gt; '''Changes the horizontal and vertical position of the control.&lt;br /&gt;
* '''Width, Height'''&amp;lt;br /&amp;gt; Changes the size of the control.&lt;br /&gt;
* '''Script'''&amp;lt;br /&amp;gt; Using this field, the user has three options:&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a) Selecting a screen script file from the library:&lt;br /&gt;
&lt;br /&gt;
[[File:Script-Option-1.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
b) Selecting an Action:&amp;lt;br /&amp;gt;[[File:Script-Option-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
c) Selecting a Windows Message:&amp;lt;br /&amp;gt; [[File:Script-Option-3.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Show/Hide'''&amp;lt;br /&amp;gt; Select a control and immediately show or hide it.&lt;br /&gt;
&lt;br /&gt;
* '''Move/Resize'''&amp;lt;br /&amp;gt; Move the position of the control or change its size.&lt;br /&gt;
* '''Undo/Redo &amp;lt;br /&amp;gt; '''An unlimited number of undoes and redoes is available.&lt;br /&gt;
* '''Copy/Paste &amp;lt;br /&amp;gt; '''The user can edit all three screens (Split, View, and Code) by clicking “Copy” after making an edit such as moving a button, then loading the next screen, clicking outside the editable area and selecting “Paste”.&lt;br /&gt;
* '''General &amp;lt;br /&amp;gt; '''When selecting multiple controls, white fields are shown when all settings are the same, and grey fields when the values are different. In the example below note that we have selected the radio buttons labeled 1 through 7. While they all share the same font type, size, width and horizontal (x) position etc., “text” and “y-position” are grayed-out, since the radio buttons’ text labels and their vertical position are unique to each field. To override this, just click into the grayed-out field(s) and start editing.&amp;lt;br /&amp;gt;[[File:General.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Main Window attributes=====&lt;br /&gt;
* '''Main Dialog Screen&amp;lt;br /&amp;gt; '''Defines the look and feel as well as the size of your KMotionCNC screen. You can choose a background color, or select a bitmap file as your background. Choose the size of the window, or whether the window should be resizable or fixed and so on. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
* '''Script File'''&amp;lt;br /&amp;gt;Select a screen script file from the library or set an action. A screen script file defines the look of a page. You can assign an action to a button to load a screen script file.&amp;lt;br /&amp;gt;[[File:Style-file.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Bitmap types, Alpha, and locations=====&lt;br /&gt;
&amp;lt;br /&amp;gt;The following bitmap types are supported: .bmp, .gif, and.png. Out of these, only the png file type supports alpha channels, i.e. background transparency.&amp;lt;br /&amp;gt;Images are stored in the following “Resources” location:&amp;lt;br /&amp;gt;\KMotion434i\PC VC Examples\KMotionCNC\res&lt;br /&gt;
&lt;br /&gt;
=====Motion Buttons (for Jogging)=====&lt;br /&gt;
Special Buttons for Jogging exist with Style MotionButton. Although these buttons can be customized with regard to Bitmap images, size, positions, Font, ToolTips, Show/Hide, and Hotkeys they have fixed functionality for the 6 GCode Axes XYZABC.  They support momentary Hotkey and combined mouse operation with the ability to have multiple Hotkeys pushed simultaneously and dynamically change speed using the SHIFT key.  Additional MotionButtons can not be currently added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:MotionButtons.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Jog Buttons are grouped into 6 buttons per axis.  3 of the 6 buttons are used for moving one direction and 3 for the other direction.  The 3 buttons correspond to Stepping a fixed distance, Jogging slow, and Jogging Fast.   The Resource IDs corresponding to each axis are:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''X + = IDC_RightStep, IDC_Right, IDC_Right2'''&lt;br /&gt;
&lt;br /&gt;
'''X - = IDC_LeftStep, IDC_Left, IDC_Left2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Y + = IDC_UpStep, IDC_Up, IDC_Up2'''&lt;br /&gt;
&lt;br /&gt;
'''Y - = IDC_DownStep, IDC_Down, IDC_Down2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Z + = IDC_ZplusStep, IDC_Zplus, IDC_Zplus2'''&lt;br /&gt;
&lt;br /&gt;
'''Z - = IDC_ZminusStep, IDC_Zminus, IDC_Zminus2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''A + = IDC_AplusStep, IDC_Aplus, IDC_Aplus2'''&lt;br /&gt;
&lt;br /&gt;
'''A - = IDC_AminusStep, IDC_Aminus, IDC_Aminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''B + = IDC_BplusStep, IDC_Bplus, IDC_Bplus2'''&lt;br /&gt;
&lt;br /&gt;
'''B - = IDC_BminusStep, IDC_Bminus, IDC_Bminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''C + = IDC_CplusStep, IDC_Cplus, IDC_Cplus2'''&lt;br /&gt;
&lt;br /&gt;
'''C - = IDC_CminusStep, IDC_Cminus, IDC_Cminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note the HotKeys for all 3 Motion Buttons for each axis/direction must be set to the same value.''' This is because the same HotKey combined with CTRL and SHIFT alter the behavior to Step and Fast respectively.  If not all 3 buttons are desired for the screen the others may be hidden but should be all defined to the same HotKey for the HotKey functionality to work correctly.  Furthermore no other buttons should be defined with the same HotKeys.  The Screen Editor has a special feature to test for Duplicate HotKey assignments called &amp;quot;check dup hotkey&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also one associated IDC_StopStep button which will stop any Step Movement currently in progress.&lt;br /&gt;
&lt;br /&gt;
=====Performing an action Immediately within Screen Script=====&lt;br /&gt;
Normally when processing a Screen Script, the &amp;quot;Script&amp;quot; Parameter defines for a Push Button Control what should happen when the Push Button is pushed. However when a &amp;quot;Script&amp;quot; Parameter is specified for a static Label the Action will occur immediately after the Screen Script is processed.&lt;br /&gt;
&lt;br /&gt;
For example: when loading a screen intended for Simulation we might want to have the Simulation mode automatically selected on. So the Script for the IDC_SimulateStatic Label might be set to check the simulate checkbox with:&lt;br /&gt;
&lt;br /&gt;
WinMsg:DlgName;IDC_Simulate;BM_SETCHECK;BST_CHECKED&lt;br /&gt;
&lt;br /&gt;
=====Scaling an Entire Screen or Portion of a Screen=====&lt;br /&gt;
A new Screen Editor feature has been added to stretch/shrink a number of selected screen controls by a specified percentage.  The height and width of the controls can be stretched as with their XY positions.  The horizontal and vertical directions can be Stretched/Shrunk independently.  Scaling the Vertical direction will also scale any Font point settings.  The Width and Height of the entire dialog will also be scaled accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To Scale a Screen:&lt;br /&gt;
&lt;br /&gt;
# Select the controls to be scaled - usually all controls (drag a box to select multiple controls)&lt;br /&gt;
# Select mode: Screen Scale&lt;br /&gt;
# Select the desired Size Change as a percentage 1-100% (ie 60% corresponds to a stretch/shrink factor of 1.6)&lt;br /&gt;
# Push Increase/Decrease Width button&lt;br /&gt;
# Push Increase/Decrease Height button&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: it is best to scale in one step vs multiple steps as control widths and font sizes are integers and may have rounding after each step.&lt;br /&gt;
&lt;br /&gt;
Note: any bitmap images will be unchanged and remain the same size.  They can be manually scaled with a graphics app if necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If not in the current Version a Version with scaling added can be downloaded here (place in \KMotion\Release Directory):&lt;br /&gt;
&lt;br /&gt;
[http://dynomotion.com/Software/Patch/ScreenEditorWithScaling_V434j/KMotionCNCScreenEditor.exe KMotionCNC Screen Editor with Scaling]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen Editor with Screen Scale of 60% and all controls selected:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale.png|none|link=|710x627px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Original Screen:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale100.png|none|link=|639x471px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Scaled up 60%&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale160.png|none|link=|879x641px]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor</id>
		<title>KMotionCNC Screen Editor</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor"/>
				<updated>2025-03-30T21:41:22Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Embed Video&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' '''&lt;br /&gt;
&lt;br /&gt;
=====Introduction=====&lt;br /&gt;
&lt;br /&gt;
 Video: [https://www.youtube.com/watch?v=uQWDttzKuDA https://www.youtube.com/watch?v=uQWDttzKuDA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|uQWDttzKuDA}}&lt;br /&gt;
&lt;br /&gt;
'''Features include:'''&lt;br /&gt;
&lt;br /&gt;
* Show/Hide Controls&lt;br /&gt;
* Change Size and Position of Controls&lt;br /&gt;
* Change Label/Button Text&lt;br /&gt;
* International Character Support&lt;br /&gt;
* Change Font/Text Size&lt;br /&gt;
* Bitmap Buttons and Labels&lt;br /&gt;
* JPG, BMP, PNG Bitmaps&lt;br /&gt;
* Toggle Bitmap Labels (LEDs)&lt;br /&gt;
* Customizable Keyboard Hotkeys&lt;br /&gt;
* Customizable Button Tool Tips&lt;br /&gt;
* Programmable DRO (Digital Read Output) Labels&lt;br /&gt;
* Custom User Entry Controls&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 6-axes default screen is changed to a 5-axes screen by deleting the z-axis. We start by installing KMotion 4.34b or later. Note that if you don’t already have Dot Net version 4.62 or Visual Studio 2015 libraries installed, you will be prompted to load those. Create desktop icons for KMotion, KMotionCNC and KMotionCNC Screen Editor. Run KMotion and observe the default 3-axes resizable screen.&lt;br /&gt;
&lt;br /&gt;
[[File:3axes-resizable-screen.png|none|link=|504x286px]]&lt;br /&gt;
&lt;br /&gt;
Close the G Viewer window and change the dialog face to Default Custom Screen with no screen script specified. (Tool Setup):&lt;br /&gt;
&lt;br /&gt;
[[File:Default-custom-screen.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Now run the KMotionCNC Screen Editor. It automatically syncs to KMotionCNC’s controls and they are graphically displayed.&lt;br /&gt;
&lt;br /&gt;
This graphical representation allows you to select which controls you want to modify.&lt;br /&gt;
&lt;br /&gt;
Notice we can select a control and immediately hide or show it over at KMotionCNC. The controls can be moved or resized. There is also unlimited undo/redo. Multiple controls can be selected by dragging the mouse over the graphical display. Click SHIFT to add more controls, or CTRL to remove from the selection.&lt;br /&gt;
&lt;br /&gt;
'''Examples: '''&lt;br /&gt;
&lt;br /&gt;
* Select multiple controls for hiding and moving.&lt;br /&gt;
* Change main dialog screen dimensions.&lt;br /&gt;
* Change label text. Push SET key and KMotion CNC screen updates the text.&lt;br /&gt;
* Increase the size of the controls.&lt;br /&gt;
&lt;br /&gt;
The screen editor features international text support. Note that only certain fonts are capable of displaying international text. In our example, we selected Arial.&lt;br /&gt;
&lt;br /&gt;
Labels can show or toggle bitmaps based on an IO bit. As an example, we first we select bitmap 1, then bitmap 2. Increase the size of the label, so the bitmap shows properly. Then assign an IO bit number that will control the bitmap displayed. Notice the bitmap turns green, because the bit is currently on. Open KMotion and look at the state of IO bit #46 and see that it is on. Toggling the bit affects the bitmap on the screen:&lt;br /&gt;
&lt;br /&gt;
[[File:Toggle-IO-bit.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Users can configure push buttons for text, font, size, color, and tool tip. Select two sample labels and change them to type: button. Select both buttons and modify their fonts as well as their size. Four colors are available for text and background, each in normal and depressed button state. You can then change the name of each button individually, one to say “On” and the other“Off”. You can assign tool tips to each of the buttons, so when the operator hovers over the buttons, they will be prompted with a tool tip notification.&lt;br /&gt;
&lt;br /&gt;
Buttons can be assigned to perform actions. Select a script that can either be a screen script or an action. We select an action type to set bit 46 to 1. Notice that this is the script that indicated that. For the other button, we select an action which sets bit 46 to 0. Now pushing the buttons will perform these actions. Save your new screen as a screen script file. Screen script is under the KMotionCNC directory and the sub-directory“Screens”. Configure KMotionCNC to use this new screen at every new startup.Notice that tool setup screen can be accessed by right-mouse clicking on the KMotionCNC title (in “Tools/Setup files”). Select the screen you just created.&lt;br /&gt;
&lt;br /&gt;
Some more advanced features include input fields, C program actions, label DROs. Load the addition example in the screen editor. Example contains two user input controls and one DRO label control. The input edit controls are associated with KFLOP persist variables 160 and 161. The DRO label is associated with KFLOP persist variable 162. The Add button is configured for screen script action to run a C program in KFLOP. The C program is contained in the file “Add.c”. Test it by entering two values and pushing the Add button. Now open KMotion and look at the simple C code that is behind the function. (Open the file “Add.c”).&lt;br /&gt;
&lt;br /&gt;
=====Momentary and Toggle button types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|eE2mSUXxN2M}}&lt;br /&gt;
&lt;br /&gt;
Start KMotion CNC Screen Editor, and click on the “Main” tab, then on “Read Script” and choose the file named MomentaryToggle.scr&lt;br /&gt;
&lt;br /&gt;
You will see two buttons, a Momentary button assigned to bit46 and a Toggle button assigned to bit 47. You will also see two labels to display the status of bits 46 and 47 as LED bitmaps. We also have KMotion displaying the status of bits 46 and 47.&lt;br /&gt;
&lt;br /&gt;
[[File:Momentary-button-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Clicking the Momentary button activates the bit; releasing it,deactivates it. Clicking the Toggle button once sets the bit; clicking it again releases it.&lt;br /&gt;
&lt;br /&gt;
=====Instantaneous Feed Rate Display=====&lt;br /&gt;
[https://youtu.be/w-bKvqXCd0Q https://youtu.be/w-bKvqXCd0Q]&lt;br /&gt;
&lt;br /&gt;
Normally the feed rate indication in KMotionCNC shows ''average'' feed rate over 100ms, assuming straight line motion. Here we use a C program to calculate a more instantaneous rate and display it on the KMotionCNC screen using the KMotionCNC screen editor. Here the C program samples two positions and times, computes the delta position and the delta time, formats it to a string and displays it onto DRO label 162 in KMotionCNC and it performs this action roughly every one ½ seconds. Here is the screen script for the screen shown on the left, we’ve added a type DRO label in the screen editor, edited colors and it is connected to persist variable 162. This job consist of a rapid helix bore at a rate of about 6 revolutions per second. It shows the instant feed rate being more correct.&lt;br /&gt;
&lt;br /&gt;
There is a newer example which also displays the feed rate as a vertical bar graph.  See:&lt;br /&gt;
&lt;br /&gt;
ShowInstantFeedRate3AxisBar.scr and related C Program ShowInstantVelocityDROBar.c&lt;br /&gt;
&lt;br /&gt;
=====Split/Full/Hidden GViewer Display on Main Dialog Face=====&lt;br /&gt;
[https://youtu.be/VkBhYpyGpNU https://youtu.be/VkBhYpyGpNU]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Using Resizeable/Floating GViewer Control with Custom Screen=====&lt;br /&gt;
Normally with a Custom Screen the GViewer Plotting is sent to the GViewer Control on the Main Dialog Face and the floating/re-sizable GViewer window is not used.  It is normally closed and the GViwer Button to open it is hidden.  However if it is desired to use the floating/re-sizable GViewer window rather than the Control on the Main Screen (which is hidden), this can be accomplished by setting the Var parameter for the Main Screen GViewer Control (IDC_viewctrl) to 0.  Non-zero values will direct the Plotting to the GViewer Control on the Main Dialog Face.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Main Screen Style=====&lt;br /&gt;
KMotionCNC Screen Editor supports changing main screen style. See the Main Dialog Screen Option under the Main Tab.  Boolean Screen Script Options: &amp;quot;Caption:&amp;quot; &amp;quot;MaxBox:&amp;quot; &amp;quot;MinBox:&amp;quot; &amp;quot;ResizeFrame:&amp;quot; &amp;quot;Maximize:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Maximized Captionless KMotionCNC Screens=====&lt;br /&gt;
[https://youtu.be/R44F0_upIoA https://youtu.be/R44F0_upIoA]&lt;br /&gt;
&lt;br /&gt;
New option in KMotionCNC Screen Editor V4.34e allows screens to be maximized to full screen and with or without Window Frame/Title. New options in Screen Editor: turn minimum box on or off, maximum box on or off, resizing frame on or off. Caption on top can be present or absent.&lt;br /&gt;
&lt;br /&gt;
Available viewing options (three buttons on the top-right hand side of the screen: “Split”: Split screen mode, “View”: G Code Viewer or “Code”: G Code.&lt;br /&gt;
&lt;br /&gt;
=====Control styles=====&lt;br /&gt;
'''&amp;lt;br /&amp;gt; '''Available style options:&amp;lt;br /&amp;gt; [[File:Style-options.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Label''' &amp;lt;br /&amp;gt; Can be text or bitmap. The background is determined by the main dialog background.&lt;br /&gt;
* '''Button''' &amp;lt;br /&amp;gt; Buttons can have all 4 options (foreground and background colors in on- and off-state) or they can also be bitmaps. Labels can load actions/scripts when the main screen is loaded.&lt;br /&gt;
* '''MotionButton''' &amp;lt;br /&amp;gt; Motion buttons are strictly for jog button use only.&lt;br /&gt;
* '''ToggleButton''' &amp;lt;br /&amp;gt; See description above and [https://www.youtube.com/watch?v=eE2mSUXxN2M video].&lt;br /&gt;
* '''DROLabel &amp;lt;br /&amp;gt; '''('''D'''igital '''R'''ead '''O'''ut) runs a program in KFLOP, e.g. reads two edit cells in the “Add” example and passes back the result. X, Y, and Z are other examples of DRO labels.&lt;br /&gt;
* '''VertBar''' &amp;lt;br /&amp;gt; Plots a vertical graph from 0 to 100% and is read by KFLOP like DRO labels. See also the [https://youtu.be/w-bKvqXCd0Q Instant Feed Rate Display video].&lt;br /&gt;
* '''Radio''' button&lt;br /&gt;
* '''Momentary''' '''button''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
* '''DualButton''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
* '''Checkbox&amp;lt;br /&amp;gt; '''&lt;br /&gt;
* '''DualLabel&amp;lt;br /&amp;gt; '''F for feed rate and S for spindle are example of dual labels. They display the state (one or another). They are fixed and cannot be edited.&lt;br /&gt;
&lt;br /&gt;
=====Control attributes=====&lt;br /&gt;
'''[[File:Control-attributes.png|none|link=]]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Select ID'''&amp;lt;br /&amp;gt; Defines the name of the control on the screen.&lt;br /&gt;
* '''Type'''&amp;lt;br /&amp;gt; Defines the type of control, e.g.: CONTROL, PUSHBUTTON, COMBOBOX.&lt;br /&gt;
* '''Font'''&amp;lt;br /&amp;gt; Set the font type, size and normal, bold, or italic.&lt;br /&gt;
* '''BitmapFile1, BitMapFile2&amp;lt;br /&amp;gt; '''Select a bitmap image (.bmp, .gif or .png) for your buttons. BitMapFile1 will show the selected file when the button is in normal state, BitMapFile2 when the button pressed.&lt;br /&gt;
* '''Colors''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (text).&lt;br /&gt;
* '''Highlight''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (background).&lt;br /&gt;
* '''Tool Tip''' &amp;lt;br /&amp;gt; Compose text to describe the button action. This text will be visible when the user hovers over the button.&lt;br /&gt;
* '''HotKey''' &amp;lt;br /&amp;gt; Assigns a keyboard key to perform an action. This field is by default set to “-1”. For example, select a control like “mm” and type “CTRL M” or select “in” and type “CTRL I” and click “Set”. The “x” button next to the field will restore the value back to “-1”.&lt;br /&gt;
* '''Var&amp;lt;br /&amp;gt; '''Numeric variable attribute. Assigning a number toggles the corresponding bit in KFLOP (from 0 to 2047).&lt;br /&gt;
* '''X, Y&amp;lt;br /&amp;gt; '''Changes the horizontal and vertical position of the control.&lt;br /&gt;
* '''Width, Height'''&amp;lt;br /&amp;gt; Changes the size of the control.&lt;br /&gt;
* '''Script'''&amp;lt;br /&amp;gt; Using this field, the user has three options:&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a) Selecting a screen script file from the library:&lt;br /&gt;
&lt;br /&gt;
[[File:Script-Option-1.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
b) Selecting an Action:&amp;lt;br /&amp;gt;[[File:Script-Option-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
c) Selecting a Windows Message:&amp;lt;br /&amp;gt; [[File:Script-Option-3.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Show/Hide'''&amp;lt;br /&amp;gt; Select a control and immediately show or hide it.&lt;br /&gt;
&lt;br /&gt;
* '''Move/Resize'''&amp;lt;br /&amp;gt; Move the position of the control or change its size.&lt;br /&gt;
* '''Undo/Redo &amp;lt;br /&amp;gt; '''An unlimited number of undoes and redoes is available.&lt;br /&gt;
* '''Copy/Paste &amp;lt;br /&amp;gt; '''The user can edit all three screens (Split, View, and Code) by clicking “Copy” after making an edit such as moving a button, then loading the next screen, clicking outside the editable area and selecting “Paste”.&lt;br /&gt;
* '''General &amp;lt;br /&amp;gt; '''When selecting multiple controls, white fields are shown when all settings are the same, and grey fields when the values are different. In the example below note that we have selected the radio buttons labeled 1 through 7. While they all share the same font type, size, width and horizontal (x) position etc., “text” and “y-position” are grayed-out, since the radio buttons’ text labels and their vertical position are unique to each field. To override this, just click into the grayed-out field(s) and start editing.&amp;lt;br /&amp;gt;[[File:General.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Main Window attributes=====&lt;br /&gt;
* '''Main Dialog Screen&amp;lt;br /&amp;gt; '''Defines the look and feel as well as the size of your KMotionCNC screen. You can choose a background color, or select a bitmap file as your background. Choose the size of the window, or whether the window should be resizable or fixed and so on. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
* '''Script File'''&amp;lt;br /&amp;gt;Select a screen script file from the library or set an action. A screen script file defines the look of a page. You can assign an action to a button to load a screen script file.&amp;lt;br /&amp;gt;[[File:Style-file.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Bitmap types, Alpha, and locations=====&lt;br /&gt;
&amp;lt;br /&amp;gt;The following bitmap types are supported: .bmp, .gif, and.png. Out of these, only the png file type supports alpha channels, i.e. background transparency.&amp;lt;br /&amp;gt;Images are stored in the following “Resources” location:&amp;lt;br /&amp;gt;\KMotion434i\PC VC Examples\KMotionCNC\res&lt;br /&gt;
&lt;br /&gt;
=====Motion Buttons (for Jogging)=====&lt;br /&gt;
Special Buttons for Jogging exist with Style MotionButton. Although these buttons can be customized with regard to Bitmap images, size, positions, Font, ToolTips, Show/Hide, and Hotkeys they have fixed functionality for the 6 GCode Axes XYZABC.  They support momentary Hotkey and combined mouse operation with the ability to have multiple Hotkeys pushed simultaneously and dynamically change speed using the SHIFT key.  Additional MotionButtons can not be currently added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:MotionButtons.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Jog Buttons are grouped into 6 buttons per axis.  3 of the 6 buttons are used for moving one direction and 3 for the other direction.  The 3 buttons correspond to Stepping a fixed distance, Jogging slow, and Jogging Fast.   The Resource IDs corresponding to each axis are:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''X + = IDC_RightStep, IDC_Right, IDC_Right2'''&lt;br /&gt;
&lt;br /&gt;
'''X - = IDC_LeftStep, IDC_Left, IDC_Left2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Y + = IDC_UpStep, IDC_Up, IDC_Up2'''&lt;br /&gt;
&lt;br /&gt;
'''Y - = IDC_DownStep, IDC_Down, IDC_Down2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Z + = IDC_ZplusStep, IDC_Zplus, IDC_Zplus2'''&lt;br /&gt;
&lt;br /&gt;
'''Z - = IDC_ZminusStep, IDC_Zminus, IDC_Zminus2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''A + = IDC_AplusStep, IDC_Aplus, IDC_Aplus2'''&lt;br /&gt;
&lt;br /&gt;
'''A - = IDC_AminusStep, IDC_Aminus, IDC_Aminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''B + = IDC_BplusStep, IDC_Bplus, IDC_Bplus2'''&lt;br /&gt;
&lt;br /&gt;
'''B - = IDC_BminusStep, IDC_Bminus, IDC_Bminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''C + = IDC_CplusStep, IDC_Cplus, IDC_Cplus2'''&lt;br /&gt;
&lt;br /&gt;
'''C - = IDC_CminusStep, IDC_Cminus, IDC_Cminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note the HotKeys for all 3 Motion Buttons for each axis/direction must be set to the same value.''' This is because the same HotKey combined with CTRL and SHIFT alter the behavior to Step and Fast respectively.  If not all 3 buttons are desired for the screen the others may be hidden but should be all defined to the same HotKey for the HotKey functionality to work correctly.  Furthermore no other buttons should be defined with the same HotKeys.  The Screen Editor has a special feature to test for Duplicate HotKey assignments called &amp;quot;check dup hotkey&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also one associated IDC_StopStep button which will stop any Step Movement currently in progress.&lt;br /&gt;
&lt;br /&gt;
=====Performing an action Immediately within Screen Script=====&lt;br /&gt;
Normally when processing a Screen Script, the &amp;quot;Script&amp;quot; Parameter defines for a Push Button Control what should happen when the Push Button is pushed. However when a &amp;quot;Script&amp;quot; Parameter is specified for a static Label the Action will occur immediately after the Screen Script is processed.&lt;br /&gt;
&lt;br /&gt;
For example: when loading a screen intended for Simulation we might want to have the Simulation mode automatically selected on. So the Script for the IDC_SimulateStatic Label might be set to check the simulate checkbox with:&lt;br /&gt;
&lt;br /&gt;
WinMsg:DlgName;IDC_Simulate;BM_SETCHECK;BST_CHECKED&lt;br /&gt;
&lt;br /&gt;
=====Scaling an Entire Screen or Portion of a Screen=====&lt;br /&gt;
A new Screen Editor feature has been added to stretch/shrink a number of selected screen controls by a specified percentage.  The height and width of the controls can be stretched as with their XY positions.  The horizontal and vertical directions can be Stretched/Shrunk independently.  Scaling the Vertical direction will also scale any Font point settings.  The Width and Height of the entire dialog will also be scaled accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To Scale a Screen:&lt;br /&gt;
&lt;br /&gt;
# Select the controls to be scaled - usually all controls (drag a box to select multiple controls)&lt;br /&gt;
# Select mode: Screen Scale&lt;br /&gt;
# Select the desired Size Change as a percentage 1-100% (ie 60% corresponds to a stretch/shrink factor of 1.6)&lt;br /&gt;
# Push Increase/Decrease Width button&lt;br /&gt;
# Push Increase/Decrease Height button&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: it is best to scale in one step vs multiple steps as control widths and font sizes are integers and may have rounding after each step.&lt;br /&gt;
&lt;br /&gt;
Note: any bitmap images will be unchanged and remain the same size.  They can be manually scaled with a graphics app if necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If not in the current Version a Version with scaling added can be downloaded here (place in \KMotion\Release Directory):&lt;br /&gt;
&lt;br /&gt;
[http://dynomotion.com/Software/Patch/ScreenEditorWithScaling_V434j/KMotionCNCScreenEditor.exe KMotionCNC Screen Editor with Scaling]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen Editor with Screen Scale of 60% and all controls selected:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale.png|none|link=|710x627px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Original Screen:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale100.png|none|link=|639x471px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Scaled up 60%&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale160.png|none|link=|879x641px]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor</id>
		<title>KMotionCNC Screen Editor</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor"/>
				<updated>2025-03-30T21:28:21Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Embed Video&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' '''&lt;br /&gt;
&lt;br /&gt;
=====Introduction=====&lt;br /&gt;
&lt;br /&gt;
 Video: [https://www.youtube.com/watch?v=uQWDttzKuDA https://www.youtube.com/watch?v=uQWDttzKuDA]&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|uQWDttzKuDA}}&lt;br /&gt;
&lt;br /&gt;
'''Features include:'''&lt;br /&gt;
&lt;br /&gt;
* Show/Hide Controls&lt;br /&gt;
* Change Size and Position of Controls&lt;br /&gt;
* Change Label/Button Text&lt;br /&gt;
* International Character Support&lt;br /&gt;
* Change Font/Text Size&lt;br /&gt;
* Bitmap Buttons and Labels&lt;br /&gt;
* JPG, BMP, PNG Bitmaps&lt;br /&gt;
* Toggle Bitmap Labels (LEDs)&lt;br /&gt;
* Customizable Keyboard Hotkeys&lt;br /&gt;
* Customizable Button Tool Tips&lt;br /&gt;
* Programmable DRO (Digital Read Output) Labels&lt;br /&gt;
* Custom User Entry Controls&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 6-axes default screen is changed to a 5-axes screen by deleting the z-axis. We start by installing KMotion 4.34b or later. Note that if you don’t already have Dot Net version 4.62 or Visual Studio 2015 libraries installed, you will be prompted to load those. Create desktop icons for KMotion, KMotionCNC and KMotionCNC Screen Editor. Run KMotion and observe the default 3-axes resizable screen.&lt;br /&gt;
&lt;br /&gt;
[[File:3axes-resizable-screen.png|none|link=|504x286px]]&lt;br /&gt;
&lt;br /&gt;
Close the G Viewer window and change the dialog face to Default Custom Screen with no screen script specified. (Tool Setup):&lt;br /&gt;
&lt;br /&gt;
[[File:Default-custom-screen.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Now run the KMotionCNC Screen Editor. It automatically syncs to KMotionCNC’s controls and they are graphically displayed.&lt;br /&gt;
&lt;br /&gt;
This graphical representation allows you to select which controls you want to modify.&lt;br /&gt;
&lt;br /&gt;
Notice we can select a control and immediately hide or show it over at KMotionCNC. The controls can be moved or resized. There is also unlimited undo/redo. Multiple controls can be selected by dragging the mouse over the graphical display. Click SHIFT to add more controls, or CTRL to remove from the selection.&lt;br /&gt;
&lt;br /&gt;
'''Examples: '''&lt;br /&gt;
&lt;br /&gt;
* Select multiple controls for hiding and moving.&lt;br /&gt;
* Change main dialog screen dimensions.&lt;br /&gt;
* Change label text. Push SET key and KMotion CNC screen updates the text.&lt;br /&gt;
* Increase the size of the controls.&lt;br /&gt;
&lt;br /&gt;
The screen editor features international text support. Note that only certain fonts are capable of displaying international text. In our example, we selected Arial.&lt;br /&gt;
&lt;br /&gt;
Labels can show or toggle bitmaps based on an IO bit. As an example, we first we select bitmap 1, then bitmap 2. Increase the size of the label, so the bitmap shows properly. Then assign an IO bit number that will control the bitmap displayed. Notice the bitmap turns green, because the bit is currently on. Open KMotion and look at the state of IO bit #46 and see that it is on. Toggling the bit affects the bitmap on the screen:&lt;br /&gt;
&lt;br /&gt;
[[File:Toggle-IO-bit.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Users can configure push buttons for text, font, size, color, and tool tip. Select two sample labels and change them to type: button. Select both buttons and modify their fonts as well as their size. Four colors are available for text and background, each in normal and depressed button state. You can then change the name of each button individually, one to say “On” and the other“Off”. You can assign tool tips to each of the buttons, so when the operator hovers over the buttons, they will be prompted with a tool tip notification.&lt;br /&gt;
&lt;br /&gt;
Buttons can be assigned to perform actions. Select a script that can either be a screen script or an action. We select an action type to set bit 46 to 1. Notice that this is the script that indicated that. For the other button, we select an action which sets bit 46 to 0. Now pushing the buttons will perform these actions. Save your new screen as a screen script file. Screen script is under the KMotionCNC directory and the sub-directory“Screens”. Configure KMotionCNC to use this new screen at every new startup.Notice that tool setup screen can be accessed by right-mouse clicking on the KMotionCNC title (in “Tools/Setup files”). Select the screen you just created.&lt;br /&gt;
&lt;br /&gt;
Some more advanced features include input fields, C program actions, label DROs. Load the addition example in the screen editor. Example contains two user input controls and one DRO label control. The input edit controls are associated with KFLOP persist variables 160 and 161. The DRO label is associated with KFLOP persist variable 162. The Add button is configured for screen script action to run a C program in KFLOP. The C program is contained in the file “Add.c”. Test it by entering two values and pushing the Add button. Now open KMotion and look at the simple C code that is behind the function. (Open the file “Add.c”).&lt;br /&gt;
&lt;br /&gt;
=====Momentary and Toggle button types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
&lt;br /&gt;
Start KMotion CNC Screen Editor, and click on the “Main” tab, then on “Read Script” and choose the file named MomentaryToggle.scr&lt;br /&gt;
&lt;br /&gt;
You will see two buttons, a Momentary button assigned to bit46 and a Toggle button assigned to bit 47. You will also see two labels to display the status of bits 46 and 47 as LED bitmaps. We also have KMotion displaying the status of bits 46 and 47.&lt;br /&gt;
&lt;br /&gt;
[[File:Momentary-button-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Clicking the Momentary button activates the bit; releasing it,deactivates it. Clicking the Toggle button once sets the bit; clicking it again releases it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Instantaneous Feed Rate Display=====&lt;br /&gt;
[https://youtu.be/w-bKvqXCd0Q https://youtu.be/w-bKvqXCd0Q]&lt;br /&gt;
&lt;br /&gt;
Normally the feed rate indication in KMotionCNC shows ''average'' feed rate over 100ms, assuming straight line motion. Here we use a C program to calculate a more instantaneous rate and display it on the KMotionCNC screen using the KMotionCNC screen editor. Here the C program samples two positions and times, computes the delta position and the delta time, formats it to a string and displays it onto DRO label 162 in KMotionCNC and it performs this action roughly every one ½ seconds. Here is the screen script for the screen shown on the left, we’ve added a type DRO label in the screen editor, edited colors and it is connected to persist variable 162. This job consist of a rapid helix bore at a rate of about 6 revolutions per second. It shows the instant feed rate being more correct.&lt;br /&gt;
&lt;br /&gt;
There is a newer example which also displays the feed rate as a vertical bar graph.  See:&lt;br /&gt;
&lt;br /&gt;
ShowInstantFeedRate3AxisBar.scr and related C Program ShowInstantVelocityDROBar.c&lt;br /&gt;
&lt;br /&gt;
=====Split/Full/Hidden GViewer Display on Main Dialog Face=====&lt;br /&gt;
[https://youtu.be/VkBhYpyGpNU https://youtu.be/VkBhYpyGpNU]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Using Resizeable/Floating GViewer Control with Custom Screen=====&lt;br /&gt;
Normally with a Custom Screen the GViewer Plotting is sent to the GViewer Control on the Main Dialog Face and the floating/re-sizable GViewer window is not used.  It is normally closed and the GViwer Button to open it is hidden.  However if it is desired to use the floating/re-sizable GViewer window rather than the Control on the Main Screen (which is hidden), this can be accomplished by setting the Var parameter for the Main Screen GViewer Control (IDC_viewctrl) to 0.  Non-zero values will direct the Plotting to the GViewer Control on the Main Dialog Face.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Main Screen Style=====&lt;br /&gt;
KMotionCNC Screen Editor supports changing main screen style. See the Main Dialog Screen Option under the Main Tab.  Boolean Screen Script Options: &amp;quot;Caption:&amp;quot; &amp;quot;MaxBox:&amp;quot; &amp;quot;MinBox:&amp;quot; &amp;quot;ResizeFrame:&amp;quot; &amp;quot;Maximize:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Maximized Captionless KMotionCNC Screens=====&lt;br /&gt;
[https://youtu.be/R44F0_upIoA https://youtu.be/R44F0_upIoA]&lt;br /&gt;
&lt;br /&gt;
New option in KMotionCNC Screen Editor V4.34e allows screens to be maximized to full screen and with or without Window Frame/Title. New options in Screen Editor: turn minimum box on or off, maximum box on or off, resizing frame on or off. Caption on top can be present or absent.&lt;br /&gt;
&lt;br /&gt;
Available viewing options (three buttons on the top-right hand side of the screen: “Split”: Split screen mode, “View”: G Code Viewer or “Code”: G Code.&lt;br /&gt;
&lt;br /&gt;
=====Control styles=====&lt;br /&gt;
'''&amp;lt;br /&amp;gt; '''Available style options:&amp;lt;br /&amp;gt; [[File:Style-options.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Label''' &amp;lt;br /&amp;gt; Can be text or bitmap. The background is determined by the main dialog background.&lt;br /&gt;
* '''Button''' &amp;lt;br /&amp;gt; Buttons can have all 4 options (foreground and background colors in on- and off-state) or they can also be bitmaps. Labels can load actions/scripts when the main screen is loaded.&lt;br /&gt;
* '''MotionButton''' &amp;lt;br /&amp;gt; Motion buttons are strictly for jog button use only.&lt;br /&gt;
* '''ToggleButton''' &amp;lt;br /&amp;gt; See description above and [https://www.youtube.com/watch?v=eE2mSUXxN2M video].&lt;br /&gt;
* '''DROLabel &amp;lt;br /&amp;gt; '''('''D'''igital '''R'''ead '''O'''ut) runs a program in KFLOP, e.g. reads two edit cells in the “Add” example and passes back the result. X, Y, and Z are other examples of DRO labels.&lt;br /&gt;
* '''VertBar''' &amp;lt;br /&amp;gt; Plots a vertical graph from 0 to 100% and is read by KFLOP like DRO labels. See also the [https://youtu.be/w-bKvqXCd0Q Instant Feed Rate Display video].&lt;br /&gt;
* '''Radio''' button&lt;br /&gt;
* '''Momentary''' '''button''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
* '''DualButton''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
* '''Checkbox&amp;lt;br /&amp;gt; '''&lt;br /&gt;
* '''DualLabel&amp;lt;br /&amp;gt; '''F for feed rate and S for spindle are example of dual labels. They display the state (one or another). They are fixed and cannot be edited.&lt;br /&gt;
&lt;br /&gt;
=====Control attributes=====&lt;br /&gt;
'''[[File:Control-attributes.png|none|link=]]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Select ID'''&amp;lt;br /&amp;gt; Defines the name of the control on the screen.&lt;br /&gt;
* '''Type'''&amp;lt;br /&amp;gt; Defines the type of control, e.g.: CONTROL, PUSHBUTTON, COMBOBOX.&lt;br /&gt;
* '''Font'''&amp;lt;br /&amp;gt; Set the font type, size and normal, bold, or italic.&lt;br /&gt;
* '''BitmapFile1, BitMapFile2&amp;lt;br /&amp;gt; '''Select a bitmap image (.bmp, .gif or .png) for your buttons. BitMapFile1 will show the selected file when the button is in normal state, BitMapFile2 when the button pressed.&lt;br /&gt;
* '''Colors''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (text).&lt;br /&gt;
* '''Highlight''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (background).&lt;br /&gt;
* '''Tool Tip''' &amp;lt;br /&amp;gt; Compose text to describe the button action. This text will be visible when the user hovers over the button.&lt;br /&gt;
* '''HotKey''' &amp;lt;br /&amp;gt; Assigns a keyboard key to perform an action. This field is by default set to “-1”. For example, select a control like “mm” and type “CTRL M” or select “in” and type “CTRL I” and click “Set”. The “x” button next to the field will restore the value back to “-1”.&lt;br /&gt;
* '''Var&amp;lt;br /&amp;gt; '''Numeric variable attribute. Assigning a number toggles the corresponding bit in KFLOP (from 0 to 2047).&lt;br /&gt;
* '''X, Y&amp;lt;br /&amp;gt; '''Changes the horizontal and vertical position of the control.&lt;br /&gt;
* '''Width, Height'''&amp;lt;br /&amp;gt; Changes the size of the control.&lt;br /&gt;
* '''Script'''&amp;lt;br /&amp;gt; Using this field, the user has three options:&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a) Selecting a screen script file from the library:&lt;br /&gt;
&lt;br /&gt;
[[File:Script-Option-1.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
b) Selecting an Action:&amp;lt;br /&amp;gt;[[File:Script-Option-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
c) Selecting a Windows Message:&amp;lt;br /&amp;gt; [[File:Script-Option-3.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Show/Hide'''&amp;lt;br /&amp;gt; Select a control and immediately show or hide it.&lt;br /&gt;
&lt;br /&gt;
* '''Move/Resize'''&amp;lt;br /&amp;gt; Move the position of the control or change its size.&lt;br /&gt;
* '''Undo/Redo &amp;lt;br /&amp;gt; '''An unlimited number of undoes and redoes is available.&lt;br /&gt;
* '''Copy/Paste &amp;lt;br /&amp;gt; '''The user can edit all three screens (Split, View, and Code) by clicking “Copy” after making an edit such as moving a button, then loading the next screen, clicking outside the editable area and selecting “Paste”.&lt;br /&gt;
* '''General &amp;lt;br /&amp;gt; '''When selecting multiple controls, white fields are shown when all settings are the same, and grey fields when the values are different. In the example below note that we have selected the radio buttons labeled 1 through 7. While they all share the same font type, size, width and horizontal (x) position etc., “text” and “y-position” are grayed-out, since the radio buttons’ text labels and their vertical position are unique to each field. To override this, just click into the grayed-out field(s) and start editing.&amp;lt;br /&amp;gt;[[File:General.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Main Window attributes=====&lt;br /&gt;
* '''Main Dialog Screen&amp;lt;br /&amp;gt; '''Defines the look and feel as well as the size of your KMotionCNC screen. You can choose a background color, or select a bitmap file as your background. Choose the size of the window, or whether the window should be resizable or fixed and so on. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
* '''Script File'''&amp;lt;br /&amp;gt;Select a screen script file from the library or set an action. A screen script file defines the look of a page. You can assign an action to a button to load a screen script file.&amp;lt;br /&amp;gt;[[File:Style-file.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Bitmap types, Alpha, and locations=====&lt;br /&gt;
&amp;lt;br /&amp;gt;The following bitmap types are supported: .bmp, .gif, and.png. Out of these, only the png file type supports alpha channels, i.e. background transparency.&amp;lt;br /&amp;gt;Images are stored in the following “Resources” location:&amp;lt;br /&amp;gt;\KMotion434i\PC VC Examples\KMotionCNC\res&lt;br /&gt;
&lt;br /&gt;
=====Motion Buttons (for Jogging)=====&lt;br /&gt;
Special Buttons for Jogging exist with Style MotionButton. Although these buttons can be customized with regard to Bitmap images, size, positions, Font, ToolTips, Show/Hide, and Hotkeys they have fixed functionality for the 6 GCode Axes XYZABC.  They support momentary Hotkey and combined mouse operation with the ability to have multiple Hotkeys pushed simultaneously and dynamically change speed using the SHIFT key.  Additional MotionButtons can not be currently added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:MotionButtons.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Jog Buttons are grouped into 6 buttons per axis.  3 of the 6 buttons are used for moving one direction and 3 for the other direction.  The 3 buttons correspond to Stepping a fixed distance, Jogging slow, and Jogging Fast.   The Resource IDs corresponding to each axis are:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''X + = IDC_RightStep, IDC_Right, IDC_Right2'''&lt;br /&gt;
&lt;br /&gt;
'''X - = IDC_LeftStep, IDC_Left, IDC_Left2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Y + = IDC_UpStep, IDC_Up, IDC_Up2'''&lt;br /&gt;
&lt;br /&gt;
'''Y - = IDC_DownStep, IDC_Down, IDC_Down2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Z + = IDC_ZplusStep, IDC_Zplus, IDC_Zplus2'''&lt;br /&gt;
&lt;br /&gt;
'''Z - = IDC_ZminusStep, IDC_Zminus, IDC_Zminus2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''A + = IDC_AplusStep, IDC_Aplus, IDC_Aplus2'''&lt;br /&gt;
&lt;br /&gt;
'''A - = IDC_AminusStep, IDC_Aminus, IDC_Aminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''B + = IDC_BplusStep, IDC_Bplus, IDC_Bplus2'''&lt;br /&gt;
&lt;br /&gt;
'''B - = IDC_BminusStep, IDC_Bminus, IDC_Bminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''C + = IDC_CplusStep, IDC_Cplus, IDC_Cplus2'''&lt;br /&gt;
&lt;br /&gt;
'''C - = IDC_CminusStep, IDC_Cminus, IDC_Cminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note the HotKeys for all 3 Motion Buttons for each axis/direction must be set to the same value.''' This is because the same HotKey combined with CTRL and SHIFT alter the behavior to Step and Fast respectively.  If not all 3 buttons are desired for the screen the others may be hidden but should be all defined to the same HotKey for the HotKey functionality to work correctly.  Furthermore no other buttons should be defined with the same HotKeys.  The Screen Editor has a special feature to test for Duplicate HotKey assignments called &amp;quot;check dup hotkey&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also one associated IDC_StopStep button which will stop any Step Movement currently in progress.&lt;br /&gt;
&lt;br /&gt;
=====Performing an action Immediately within Screen Script=====&lt;br /&gt;
Normally when processing a Screen Script, the &amp;quot;Script&amp;quot; Parameter defines for a Push Button Control what should happen when the Push Button is pushed. However when a &amp;quot;Script&amp;quot; Parameter is specified for a static Label the Action will occur immediately after the Screen Script is processed.&lt;br /&gt;
&lt;br /&gt;
For example: when loading a screen intended for Simulation we might want to have the Simulation mode automatically selected on. So the Script for the IDC_SimulateStatic Label might be set to check the simulate checkbox with:&lt;br /&gt;
&lt;br /&gt;
WinMsg:DlgName;IDC_Simulate;BM_SETCHECK;BST_CHECKED&lt;br /&gt;
&lt;br /&gt;
=====Scaling an Entire Screen or Portion of a Screen=====&lt;br /&gt;
A new Screen Editor feature has been added to stretch/shrink a number of selected screen controls by a specified percentage.  The height and width of the controls can be stretched as with their XY positions.  The horizontal and vertical directions can be Stretched/Shrunk independently.  Scaling the Vertical direction will also scale any Font point settings.  The Width and Height of the entire dialog will also be scaled accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To Scale a Screen:&lt;br /&gt;
&lt;br /&gt;
# Select the controls to be scaled - usually all controls (drag a box to select multiple controls)&lt;br /&gt;
# Select mode: Screen Scale&lt;br /&gt;
# Select the desired Size Change as a percentage 1-100% (ie 60% corresponds to a stretch/shrink factor of 1.6)&lt;br /&gt;
# Push Increase/Decrease Width button&lt;br /&gt;
# Push Increase/Decrease Height button&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: it is best to scale in one step vs multiple steps as control widths and font sizes are integers and may have rounding after each step.&lt;br /&gt;
&lt;br /&gt;
Note: any bitmap images will be unchanged and remain the same size.  They can be manually scaled with a graphics app if necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If not in the current Version a Version with scaling added can be downloaded here (place in \KMotion\Release Directory):&lt;br /&gt;
&lt;br /&gt;
[http://dynomotion.com/Software/Patch/ScreenEditorWithScaling_V434j/KMotionCNCScreenEditor.exe KMotionCNC Screen Editor with Scaling]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen Editor with Screen Scale of 60% and all controls selected:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale.png|none|link=|710x627px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Original Screen:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale100.png|none|link=|639x471px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Scaled up 60%&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale160.png|none|link=|879x641px]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/Main_Page"/>
				<updated>2025-03-30T18:46:37Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Update the Projects now work with Visual Studio 2022&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Dynomotion wiki'''&amp;lt;span style=&amp;quot;color: #999999;&amp;quot;&amp;gt;'''&amp;lt;br /&amp;gt;'''&amp;lt;/span&amp;gt;==&lt;br /&gt;
Welcome to our wiki where you can find and share knowledge on Dynomotion's systems.  To begin adding information to this wiki, simply create an account, verify your email, and start editing (click pencil icon). To make editing pages easier for everyone, we have installed a [https://help.bluespice.com/index.php/VisualEditor visual editor] by default.  This visual editor allows you to edit a wiki page much like you would a standard word processing document.&amp;amp;nbsp; For the seasoned wiki editors, standard [https://www.mediawiki.org/wiki/Help:Editing MediaWiki editing] may also be used.&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Warning: Use at your own risk.&amp;amp;nbsp; Information is for example purposes only and may contain errors.&amp;amp;nbsp; It is up to the User to verify the information is correct and is safe to use. In no case will any contributor or Dynomotion be liable for incorrect information.  Dynomotion reserves the right to modify or delete any contributions.&amp;lt;br /&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Thanks for Contributing!&lt;br /&gt;
&lt;br /&gt;
[http://dynomotion.com Official Dynomotion Site]&lt;br /&gt;
&lt;br /&gt;
==Editing and Creating Wiki Pages==&lt;br /&gt;
Unintuitively, you first create a link to the page you want to make before you can make the page.  To make a new page: while editing, right-click where you want your link to be, insert a link with a descriptive title and link text, save the page, click on the link you created, then click on &amp;quot;Empty Page&amp;quot; to begin editing your new page.&lt;br /&gt;
&lt;br /&gt;
Here are a few other quick tips:&lt;br /&gt;
&lt;br /&gt;
* You can insert links or images by Right-Clicking with the mouse on the line where you want the link or image to appear.&lt;br /&gt;
* For Spell Correction you can use Ctrl-Right-Click. &lt;br /&gt;
* To insert a YouTube Video use an EmbedVideo command such as &amp;lt;nowiki&amp;gt; {{#ev:youtube|xxxxx}}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;with xxxxx changed to the Video ID.&lt;br /&gt;
* Choose a descriptive page name and link text when creating a new page: e.g. Not &amp;quot;My Machine&amp;quot;, but rather &amp;quot;Brand X Three Axis Milling Machine Retrofit&amp;quot;&lt;br /&gt;
* Create pages in an organized manner: Describe what the page is about, create clear sections that flow&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
[[Help:New Page Creation|How to create a new wiki page]]&lt;br /&gt;
&lt;br /&gt;
[[Help:Editing Pages|How to Edit and insert Media into your wiki pages]]&lt;br /&gt;
&lt;br /&gt;
==Dynomotion Software Topics==&lt;br /&gt;
===Installation Topics===&lt;br /&gt;
* Announcement of our Latest Release (5.3.7) on the [https://www.dynomotion.com/forum/viewtopic.php?f=4&amp;amp;t=1834 Dynomotion Forum]&lt;br /&gt;
* [https://dynomotion.com/Software/Download.html Latest Release] Note: For Windows 7 64bit signed Drivers to work, all Windows Updates should be performed.&lt;br /&gt;
* [[Upgrading from previous KMotion Versions]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Archive of Test Releases:&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 09/30/2024: [https://dynomotion.com/Software/KMotion5.3.6.exe KMotion.exe 5.3.6], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.6%20Changes.pdf 5.3.6 release notes (pdf)]&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 09/16/2024: [https://dynomotion.com/Software/KMotion5.3.5.exe KMotion.exe 5.3.5], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.5%20Changes.pdf 5.3.5 release notes (pdf)]&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 08/13/2024: [https://dynomotion.com/Software/KMotion5.3.4.exe KMotion.exe 5.3.4], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.4%20Changes.pdf 5.3.4 release notes (pdf)]&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 04/04/2024: [https://dynomotion.com/Software/KMotion5.3.3.exe KMotion.exe 5.3.3], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.3%20Changes.pdf 5.3.3 release notes (pdf)]&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 02/01/2024: [https://dynomotion.com/Software/KMotion5.3.2.exe KMotion.exe 5.3.2], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.2%20Changes.pdf 5.3.2 release notes (pdf)]&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 11/20/2023: [https://dynomotion.com/Software/KMotion5.3.1.exe KMotion.exe 5.3.1], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.1%20Changes.pdf 5.3.1 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/19/2023: [https://dynomotion.com/Software/KMotion5.3.0.exe KMotion.exe 5.3.0], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.0%20Changes.pdf 5.3.0 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 06/30/2023: [https://dynomotion.com/Software/KMotion5.1.0.exe KMotion.exe 5.1.0], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.1.0%20Changes.pdf 5.1.0 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 05/01/2023: [https://dynomotion.com/Software/KMotion5.0.7.exe KMotion.exe 5.0.7], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.0.7%20Changes.pdf 5.0.7 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/21/2022: [https://dynomotion.com/Software/KMotion435h.exe KMotion.exe V4.35h], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35h%20Changes.pdf V4.35h release notes (pdf)]&lt;br /&gt;
* Previous Version 4.35g was not released, but see the change notes for this version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35g%20Changes.pdf V4.35g change notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/28/2020: [https://dynomotion.com/Software/KMotion435f.exe KMotion.exe V4.35f], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35f%20Changes.pdf V4.35f release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 11/18/2019: [https://dynomotion.com/Software/KMotion435e.exe KMotion.exe V4.35e], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35e%20Changes.pdf V4.35e release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/10/2019: [https://dynomotion.com/Software/KMotion435d.exe KMotion.exe V4.35d], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35d%20Changes.pdf V4.35d release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 01/28/2019: [https://dynomotion.com/Software/KMotion435b.exe KMotion.exe V4.35b], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35b%20Changes.pdf V4.35b release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/21/2018: [https://dynomotion.com/Software/KMotion435a.exe KMotion.exe V4.35a], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35a%20Changes.pdf V4.35a release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/28/2017: [https://dynomotion.com/Software/KMotion434j.exe KMotion.exe V4.34j], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34j%20Changes.pdf V4.34j release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 05/07/2017: [https://dynomotion.com/Software/KMotion434i.exe KMotion.exe V4.34i], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34i%20Changes.pdf V4.34i release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/14/2016: [https://dynomotion.com/Software/KMotion434h.exe KMotion.exe V4.34h], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34h%20Changes.pdf V4.34h release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/13/2016: [https://dynomotion.com/Software/KMotion434g.exe KMotion.exe V4.34g], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34g%20Changes.pdf V4.34g release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/05/2016: [https://dynomotion.com/Software/KMotion434f.exe KMotion.exe V4.34f], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34f%20Changes.pdf V4.34f release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 11/07/2016: [https://dynomotion.com/Software/KMotion434e.exe KMotion.exe V4.34e], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34e%20Changes.pdf V4.34e release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/32/2016: [https://dynomotion.com/Software/KMotion434d.exe KMotion.exe V4.34d], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34d%20Changes.pdf V4.34d release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/23/2016: [https://dynomotion.com/Software/KMotion434c.exe KMotion.exe V4.34c], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34c%20Changes.pdf V4.34c release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/03/2016: [https://dynomotion.com/Software/KMotion434b.exe KMotion.exe V4.34b], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34b%20Changes.pdf V4.34b release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 03/09/2016: [https://dynomotion.com/Software/KMotion434a.exe KMotion.exe V4.34a], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34a%20Changes.pdf V4.34a release notes (pdf)]&lt;br /&gt;
* [https://dynomotion.com/Help/KFLOPQuickStart/KFLOPQuickStart.htm How to install KMotion.exe and KMotionCNC]&lt;br /&gt;
* [[How to install KMotion.exe and KMotion in Windows 10|Preparing Windows 10 for driver installation]] (no longer required)&lt;br /&gt;
* [[Special Case for Windows 8.1 Industry Embedded Enterprise]]&lt;br /&gt;
* [[Updating KFLOP Firmware|How to update KFLOP Firmware]] - whenever a new version of software is installed, the firmware within KFLOP must be updated to match the new version&lt;br /&gt;
&lt;br /&gt;
===KMotion.exe Executive Software Topics===&lt;br /&gt;
KMotion.exe is the main program that is used to configure settings in KFLOP, initialize axes, and to write C programs to configure and setup KFLOP to control your system. In this program you can plot step response, test movement, view Bode plots, monitor I/O, set filter parameters, and generally set the pertinent parameters.&lt;br /&gt;
&lt;br /&gt;
* [http://www.dynomotion.com/Help/index.htm General software information] from the manuals&lt;br /&gt;
* Insert pages for other KMotion.exe-related topics here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Configuration Topics===&lt;br /&gt;
====Channels, Channels, Channels what are they?====&lt;br /&gt;
[[Channels Channels Channels|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====How to Setup Backlash Compensation====&lt;br /&gt;
[[Backlash Compensation|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====PWM Output Mode====&lt;br /&gt;
[[PWM Output Mode|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
===KMotionCNC Software Topics===&lt;br /&gt;
KMotionCNC is Dynomotion's CNC program used as a graphical user interface to your KFLOP-enabled machine tool. KMotionCNC has all of the basic functionality you need to run a machine of up to 6 axes, in addition to spindle control.&lt;br /&gt;
&lt;br /&gt;
* Insert pages for other KMotionCNC-related general topics here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;Using KMotionCNC&amp;lt;/span&amp;gt;====&lt;br /&gt;
* Homing discussion - page to be created&lt;br /&gt;
* Insert other KMotionCNC use pages here&lt;br /&gt;
&lt;br /&gt;
[[Internal/concave Path Tool Radius Compensation Example G41/G42]]&lt;br /&gt;
&lt;br /&gt;
[[Known KMotionCNC CAD/CAM Post Processors]]&lt;br /&gt;
&lt;br /&gt;
[[Invoking C Programs with Execute Only for previously Downloaded Programs]]&lt;br /&gt;
&lt;br /&gt;
[[Rigid Tapping G84 Setup and Use]]&lt;br /&gt;
&lt;br /&gt;
[[Tool Length/Offsets G43Hn G49]]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;Customize KMotionCNC&amp;lt;/span&amp;gt;====&lt;br /&gt;
KMotionCNC is written as a Windows C++ MFC (Microsoft Foundation Classes) program developed in Visual Studio.  Source code is provided and may be customized using Visual Studio.  MFC Support is a requirement. &lt;br /&gt;
&lt;br /&gt;
: '''General Information'''&lt;br /&gt;
: Compiling KMotionCNC&lt;br /&gt;
:: The KMotionCNC's Visual Studio Project Solution (\PC VC Programs\KMotionCNC\KMotionCNC.sln) is currently written for Visual Studio 2015 Standard.  This version can be used for the simplest compatibility.  Projects can be upgraded to newer version of VS with minimal effort.  Including Microsoft's Free Visual Studio 2013 Community.  [[PC Example Applications|More info on PC Example Applications.]]&lt;br /&gt;
:: Note Test Versions 4.34a and later have project solutions targeted for Visual Studio 2015 Community which is free for most Users.&lt;br /&gt;
: '''KMotionCNC Customization Examples and Applications'''&lt;br /&gt;
:: Links to examples of projects that explain KMotionCNC customizations. Troy (tmday7) created some helpful documents (PDF format):&lt;br /&gt;
: &lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/How%20to%20Edit%20KMotionCNC%20Faces.pdf How to edit KMotionCNC faces]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20External%20Buttons.pdf Adding external buttons]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20More%20User%20Buttons.pdf Adding more user buttons]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20Jog%20Percent%20Cell%20to%20Main%20Dialog%20Face.pdf Adding Jog Percent Cell to Main Dialog Face]&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;KMotionCNC Screen Editor&amp;lt;/span&amp;gt;====&lt;br /&gt;
Introduces the capability of using Screen Script files to modify the look and function of KMotionCNC.&amp;lt;br /&amp;gt;[[KMotionCNC Screen Editor|More information.]]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;KMotionCNC Geometric Correction&amp;lt;/span&amp;gt;====&lt;br /&gt;
Information regarding the powerful [https://dynomotion.com/Help/KMotionCNC/GeoCorrection.htm Geometric Correction capability] which allows calibration and distortion correction of the XY CAD space to Machine/Actuator Space as well as flatness in Z.  Simple 4 point correction tables can apply XY Scale, Rotation, skew, offset, tilt.  Larger tables can apply more non-linear corrections.&lt;br /&gt;
&lt;br /&gt;
Note the Geometric Correction is built into the KMotion Libraries and can be utilized by Custom Programs as well as with KMotionCNC&amp;lt;br /&amp;gt;[[Geometric Correction|More information and Examples.]]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;KMotionCNC Linear Table Correction (Screw Mapping)&amp;lt;/span&amp;gt;====&lt;br /&gt;
Individual Axes can be corrected in a 1 dimensional manner referred to as Linear Table Corrections.  For more information See [[Linear Table Correction|here]].&lt;br /&gt;
&lt;br /&gt;
===PC Example Applications===&lt;br /&gt;
A number of PC Applications using the KMotion Libraries are available in the Software download.&amp;amp;nbsp; Visual Studio should be used to modify/compile the applications.&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note All the projects should work out-of-the-box with Visual Studio 2022.'''&lt;br /&gt;
&lt;br /&gt;
[[PC Example Applications|More information.]]&lt;br /&gt;
&lt;br /&gt;
===KMotion Libraries - GCode Interpreter - Trajectory Planner - Coordinated Motion - .NET===&lt;br /&gt;
The KMotion Libraries are a series of DLLs (Dynamic Link Libraries) that reside on the PC that contain the common core motion control, I/O, and communication functionality for KFLOP.  These libraries permit PC Applications to be built using high level control without being concerned with the underlying details of Interpreting GCode, Trajectory Planning, Coordinated Motion, Motion Buffering, USB Communication, etc.&lt;br /&gt;
&lt;br /&gt;
[[KMotion Libraries - GCode Interpreter - Trajectory Planner - Coordinated Motion - .NET|More information]].&lt;br /&gt;
&lt;br /&gt;
===Kinematics===&lt;br /&gt;
The KMotion Libraries contain a Kinematics Layer where Users can add their own non-linear Kinematics&lt;br /&gt;
&lt;br /&gt;
[[Kinematics|More information]].&lt;br /&gt;
&lt;br /&gt;
===KFLOP C Programs===&lt;br /&gt;
C Programs provide a powerful and flexible capability to perform almost any sequence of operations within KFLOP.   In most cases after you have tested and tuned all your hardware using the KMotion.exe setup program all the settings and initialization steps required for your system can be placed into an Initialization C Program so that your system can be fully initialized simply by executing the Initialization program.&lt;br /&gt;
&lt;br /&gt;
[[KFLOP C Programs|More Information]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ModBus===&lt;br /&gt;
Modbus can be connected to the PC or directly to KFLOP.  A PC connection will not be deterministically real-time but may work for basic speed control and on/off.  Here is a related Thread for interfacing KMotionCNC to Modbus using a [http://www.modbusdriver.com/modpoll.html free utility]:&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/sending%20ModBus%20msgs%20from%20KmotionCNC%20to%20a%20RS485%20port.html Sending ModBus msgs from KmotionCNC to a RS485 port]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To connect Modbus directly to KFLOP's [http://www.dynomotion.com/Help/RS232/RS232.htm UART] see the C Examples in \C Programs\RS232\ModBus\&lt;br /&gt;
&lt;br /&gt;
===Linux Support===&lt;br /&gt;
KMotion Motion Libraries are fully supported under Microsoft Windows. Some Users have ported the KMotion Libraries to Linux.  Dynomotion will offer support where possible but can't offer full support under Linux.  Special Thanks to [https://github.com/parhansson/KMotionX Par Hansson] for the initial Linux Port.&lt;br /&gt;
&lt;br /&gt;
See [[Linux|here]] for more info.&lt;br /&gt;
&lt;br /&gt;
==Dynomotion Hardware Topics==&lt;br /&gt;
===General Hardware Information===&lt;br /&gt;
====[[KFLOP Hardware Info|KFLOP specific Hardware Info]]====&lt;br /&gt;
====[[KStep Hardware Info|KStep specific Hardware Info]]====&lt;br /&gt;
====[[Kanalog Hardware Info|Kanalog specific Hardware Info]]====&lt;br /&gt;
====[[SnapAmp Info|SnapAmp specific Hardware Info]]====&lt;br /&gt;
====[[Konnect Hardware Info|Konnect specific Hardware Info]]====&lt;br /&gt;
===Wiring Diagrams===&lt;br /&gt;
[[Media:Kanalog_Connections.pdf|Basic Kanalog DAC and Encoder Connections 3 Axis]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KanalogSchematic3Axis.pdf|Basic Kanalog DAC and Encoder Connections 3 Axis #2]]&lt;br /&gt;
&lt;br /&gt;
[[Media:dyn4 kanalog KE1524 V1.1.png|Basic Kanalog DAC and DMM DYN4 Drive 1 Axis]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Kflop-Kanalog_wiring_11-19-2018.pdf|Kanalog with Geckos G210 updated 11-19-2018]] (Thanks to &amp;lt;span style=&amp;quot;color: windowtext;&amp;quot;&amp;gt;Joseph Mirocha&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog_to_Tree_Journeyman_325_by_Rick_B.pdf|Kanalog to Tree Journeyman 325.pdf]] (Thanks to &amp;lt;span style=&amp;quot;color: windowtext;&amp;quot;&amp;gt;Rick_B&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Media:KFlopSnapBrushMPG.pdf|KFLOP+SnapAmp DC Brush Motors with MPG]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Stepper_Wiring_Diagram_Step-Dir_on_JP5.pdf|KFLOP JP5 Open Collector Step/Dir Connections to Power Step PSD5042-2P Drives ]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Matrika_V1_wiring_diagram_Rev1.pdf|KFLOP+KStep with VFD and NPN Limit Switches for Matrika Rev1]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KonnectTouchPlate.png|Touch Plate Wiring to Konnect]]&lt;br /&gt;
&lt;br /&gt;
[https://easyeda.com/350banshee/BreakoutBoard-93bdd16e3c3d48b98ae66c34f2436c40 User Created KFLOP JP7 Breakout/OptoIsolation Board] Schematic, Gerbers, PCBs Publicly available (thanks 350banshee)&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/wiki/index.php?action=ajax&amp;amp;title=-&amp;amp;rs=SecureFileStore::getFile&amp;amp;f=/b/bb/RotarySwitchToKanalog.png Rotary Switch Connected to Kanalog Opto Inputs]&lt;br /&gt;
&lt;br /&gt;
===3D Board Models===&lt;br /&gt;
[[Media:kflop-kstep-3d-models-1.snapshot.3.zip.txt|kflop-kstep-3d-models-1.snapshot.3.zip.txt]]  STEP file format - Thanks to Curtis&lt;br /&gt;
&lt;br /&gt;
[[File:kflop_kstep_render.JPG|none|link=|329x329px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:KFLOP3D_Step_IGS_Chris.zip.txt|KFLOP3D_Step_IGS_Chris.zip.txt]] STEP and IGS models - Thanks to Chris&lt;br /&gt;
&lt;br /&gt;
[[File:KFLOP_3D.png|none|link=|413x296px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:KONNECT_BOARD_MODEL.zip.txt|KONNECT_BOARD_MODEL.zip.txt]] STEP model - Thanks to Jeff Redington&lt;br /&gt;
&lt;br /&gt;
(Component locations may be off one way or another by .5mm)&lt;br /&gt;
&lt;br /&gt;
[[File:Konnect_Board.png|none|link=|339x292px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Konnect Basic Step file showing hole locations&lt;br /&gt;
&lt;br /&gt;
[[Media:KonnectHoles.stp.txt|KonnectHoles.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KonnectHoles.png|none|link=|352x323px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kanalog Step Model with Mechanical hole and Pin locations&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog.stp.txt|Kanalog.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KanalogFromStep.png|none|link=|304x279px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kanalog Step Model with Mechanical hole and Connectors (Thanks to&lt;br /&gt;
&lt;br /&gt;
Roberto Gotti of Powertech)'''&amp;lt;br /&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
[[Media:KANALOG_BOARD.stp.txt|KANALOG_BOARD.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KanalogWithConnectors.png|none|link=|311x286px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Board Terminal DXF/DWG files===&lt;br /&gt;
[[Media:KFLOP_Terminals.dxf|KFLOP_Terminals.dxf]] [[Media:KFLOP_Terminals.dwg|KFLOP_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog_Terminals.dxf|Kanalog_Terminals.dxf]] [[Media:Kanalog_Terminals.dwg|Kanalog_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Konnect_Terminals.dxf|Konnect_Terminals.dxf]] [[Media:Konnect_Terminals.dwg|Konnect_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KStep_Terminals.dxf|KStep_Terminals.dxf]] [[Media:KStep_Terminals.dwg|KStep_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
===Wiring Topics===&lt;br /&gt;
Place links to pages on wiring inputs and&lt;br /&gt;
&lt;br /&gt;
outputs specific to your experiences and projects.  Be descriptive with page titles and links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====KFLOP IDC Connectors and Cables====&lt;br /&gt;
Cables that connect between Dynomotion boards are normally included when purchasing the boards together. They are also very common and easy to make. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Use '''16-conductor or 26-conductor ribbon cable''' (0.05 inch pitch 26 AWG preferrably or 28AWG) and IDC sockets.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;[[File:RibbonCable.png|none|link=]]16 conductor ribbon cable 3M part number 3801/16 100 &amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/3m/3801-16-100/3M156105-100-ND/1107501&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;26 conductor ribbon cable 3M part number C3801/26 100 &amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/3m/C3801-26-100/C3801-26-100-ND/1107648&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Winford also sells ribbon cable (although only the thinner 28 AWG):&amp;lt;br /&amp;gt;http://www.winford.com/products/rib.php&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Note you can usually tear off wires to reduce the number of conductors. For example from 26 down to 16. Tear off the conductors away from the red stripe that marks pin 1.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;The '''crimp tools''' are common:&amp;lt;br /&amp;gt;https://www.amazon.com/Accessories-Crimp-Ribbon-Cable-Connectors/dp/B007R2JEM4/&amp;lt;br /&amp;gt;[[File:RibbonCrimp.png|none|link=]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;'''IDC Sockets 16-pin '''(pin pitch 0.1 inch)&amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/assmann-wsw-components/AWP-16-7240-T/HHKC16H-ND/5031953&amp;lt;br /&amp;gt;Assman Part number AWP 16-7240-T[[File:16pinIDC.png|none|link=]]&lt;br /&gt;
https://www.digikey.com/product-detail/en/assmann-wsw-components/AWP-26-7240-T/HHKC26H-ND/5011313&lt;br /&gt;
[[File:26pinIDC.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
====KFLOP KStep JR1 Molex Power Connectors====&lt;br /&gt;
KFLOP and KStep JR1 are standard Disk Drive Power Connectors. Possibly one of the most common connectors. Originally used on PC ATX Power Supplies. Sometimes referred to as Molex Connectors. They have 4 pins with 0.2 inch pitch with 0.083~0.084 inch socket pins. The mating cable will have female socket pins as shown here:&lt;br /&gt;
&lt;br /&gt;
[[File:Molex_female_connector.jpg|none|link=|251x168px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Molex Series 8981 P# [https://www.digikey.com/short/zjp329 0015244048]  using Molex Series 8980 Crimp Pins P# [https://www.digikey.com/short/zjp3ff 0002081201]&lt;br /&gt;
&lt;br /&gt;
Also AMP Series MATE-N-LOK P# [https://www.digikey.com/short/zjpq3n 1-480424-0] using AMP Series MATE-N-LOK Crimp Pins P# [https://www.digikey.com/short/zjpqqw 60619-1] or P# [https://www.digikey.com/en/products/detail/molex/0194200002/2404783 194200002]&lt;br /&gt;
&lt;br /&gt;
Molex Crimp Tool P# [https://www.digikey.com/en/products/detail/molex/0640160035/665311 0640160035]&lt;br /&gt;
&lt;br /&gt;
====MPG Wiring and Interface====&lt;br /&gt;
MPGs (Manual Pulse Generators) should be connected directly to KFLOP for guaranteed real-time response (not USB based or connected to the PC).  MPGs are handled by a C Program that monitors the MPG and creates motion based on the MPG Encoder changes and switch selections for axis, speed, and so forth.  See the MPG C Program Examples.  Here is a Discussion with other links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/Jogging%20Pendant.html Jogging Pendant]&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/Connecting%20Keling%20MPG2%20pendant.html Connecting Keling MPG2 Pendant]&lt;br /&gt;
&lt;br /&gt;
[https://www.cnczone.com/forums/dynomotion-kflop-kanalog/349740-applying-acceleration-mpg-target-possible.html#post2119732 CNCZone Thread] on obtaining smooth filtered motion.&lt;br /&gt;
&lt;br /&gt;
[[File:MPG4_from_cnc4pc.jpg|none|link=|83x169px]]&lt;br /&gt;
&lt;br /&gt;
====Interfacing NPN Devices to KFLOP IO====&lt;br /&gt;
NPN devices (open collector)operate as a switch to GND and can be interfaced to KFLOP using a pull up resistor as shown below. When the transistor switches to 0V the KFLOP IO Pin is driven low. The transistor will need to sink ~3ma. When the transistor is off (open circuit) the resistor pulls the IO Pin to 3.3V. Note even though some KFLOP IO Pins can tolerate 5V pulling them above 3.8V should be avoided when possible so the 3.3V supply is used. This technique will only work with KFLOP IO Pins that do not have pull down resistors (JP7 and JP5). In some cases a 0.1uF Ceramic capacitor connected close to KFLOP might be added in parallel with the resistor to filter noise.  Cable shielding connected to KFLOP GND on the KFLOP end only is recommended.  Note that in noisy environments this technique may couple noise into KFLOP so opto isolation should be used instead.&lt;br /&gt;
&lt;br /&gt;
[[File:NPN_Interface_to_KFLOP.png|none|link=|544x544px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Multiplexing Encoder Inputs to KFLOP JP4 and JP6====&lt;br /&gt;
If KFLOP JP7 and JP5 are used for other purposes the encoder inputs can be multiplexed to KFLOP JP4 and JP6. There is an option to multiplex encoders 0-3 from JP7 to JP4 and another option to multiplex encoders 4-7 from JP5 to JP6. See the MuxEncoders.c for an example.&lt;br /&gt;
&lt;br /&gt;
Note the JP4 and JP6 IO are 3.3V inputs and shouldn't be driven hard (more than 10ma) above 3.8V. This is not usually an issue as most encoders or RS422 drivers don't do this. The inputs also have 150 ohm termination.&lt;br /&gt;
&lt;br /&gt;
The following line of code might be added to your Initialization C Program. It needs to be executed once to multiplex the encoders after any power cycle. Encoders 0-3 will then be input on JP4 and 4-7 will be on JP6. Both JP4 and Jp6 have 10 IO bits. The 4 encoders will appear on the first 8 IO bits. 2 bits for each encoder's A B channels in order. So for example Encoder #0 will appear on JP4 IO16 (Pin5) and IO17 (Pin6)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt; &lt;br /&gt;
// Mux encoder inputs from KFLOP JP7 &amp;amp; JP5 to JP4 and JP6&lt;br /&gt;
FPGAW(ENC_NOISE_FILTER_ADD) = ENC_0_3_JP4 + ENC_4_7_JP6 + ENC_NOISE_FILTER_DEFAULT_VAL; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JP4 and JP6 have +5V available on Pin1 and GND on Pins 8 and 9 that might be used to power 5V encoders.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span id=&amp;quot;Axes_Servo_Tuning_and_Trajectory_Planner&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axes Servo Tuning and Trajectory Planner&amp;lt;/span&amp;gt;==&lt;br /&gt;
===Basic Servo Tuning Overview===&lt;br /&gt;
Once an axis is configured and proved capable of holding a position it is ready to be tuned and optimized. Most often a small value of P Gain only is used to show the servo is functional and can hold position. The Servo may be very weak and inaccurate but will be functional.&lt;br /&gt;
&lt;br /&gt;
Every system is different and the tuning parameters are interactive in a manner that usually doesn't allow parameters to be determined one at a time. Rather after one parameter is changed it may be necessary to revisit the other parameters.&lt;br /&gt;
&lt;br /&gt;
In general higher gains will reduce errors and improve accuracy, but tend to make the system more unstable.  So the general idea is to increase gains to reduce errors as much as possible but still have a stable system.&lt;br /&gt;
&lt;br /&gt;
Often during tuning the system may go unstable. In fact, it is normally intentionally driven to instability to find its limits for a certain parameter. This can result in a violent oscillation or worse so one should be prepared to quickly disable the Servo. If an appropriate [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Max_Following_Error Max Following Error] is used the axis can be automatically disabled before the oscillation becomes too violent, yet not disable when performing a normal test.&lt;br /&gt;
&lt;br /&gt;
KMotion.exe allows you to change any axis parameter on the Step/Response, Config, or Filters Screens then simply push &amp;quot;Move&amp;quot; to see the effect of the change.  Note that as performance improves the errors will become small and difficult to see on the Position Plot without Zooming in (Left click drag) so changing the plot type to plot the error is useful.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The overall process normally goes something like this:&lt;br /&gt;
&lt;br /&gt;
# Select a Test [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Measurement Move Size] and [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Motion_Profile Motion Profile].  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Velocity.2C_Acceleration.2C_and_Jerk See Also]&lt;br /&gt;
# Select [http://dynomotion.com/Help/StepScreen/StepScreen.htm#max_limits Max Limits] to allow for the Test.  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Max_Limits_-_Error See Also]&lt;br /&gt;
# Determine maximum level of [http://dynomotion.com/Help/StepScreen/StepScreen.htm#PID P Gain]&lt;br /&gt;
# Determine maximum level of [http://dynomotion.com/Help/StepScreen/StepScreen.htm#PID D Gain] (with Low Pass Filtering)  See Also [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Torque_Servos_vs_Velocity_Servos here] and [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Lead_Compensator_vs_Derivative_Gain here].&lt;br /&gt;
# Determine new maximum level of P Gain now that D Gain increased stability&lt;br /&gt;
# Add I Gain to improve accuracy and remove steady state errors.  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#I_Gain.2FMax_Limit_Integrator See Also]&lt;br /&gt;
# Add [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Feed_Forward Feed Forward] to reduce errors&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Torque Servos vs Velocity Servos===&lt;br /&gt;
+/-10V Analog Amplifiers usually come in one of two varieties: '''Torque''' or '''Velocity'''. Torque mode amplifiers consider the input command as a Torque Command and work to generate the commanded Motor Torque. Velocity mode amplifiers consider the input command as a Velocity Command and work to generate the commanded Velocity.  Its important to understand what type of Amplifiers you have.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Velocity Mode Amplifiers''' need some form of feedback going to the Amplifier in order for the drive to know the current velocity. This might be a digital encoder or an analog tachometer.&lt;br /&gt;
&lt;br /&gt;
Its easy to tell if you have a Velocity Mode Amplifier by looking at a plot of a move on the Step Response Screen.  The Output (green plot with right scale) will be proportion to the motor velocity.  When moving at constant speed the output will be relatively constant.  See in the plot below the output (green) remains at a relatively constant ~1100 DAC counts while the position (red) ramps at a constant slope of the 90000 count/sec rate:&lt;br /&gt;
&lt;br /&gt;
[[File:VelocityAmp.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Velocity mode amplifiers can be relatively easy to tune using only P (Proportional) Gain.  Additional Gains and filters can be used for best performance but using only P Gain will often result in reasonable performance and a stable system (unlike Torque Mode Amplifiers). &lt;br /&gt;
&lt;br /&gt;
As an example consider controlling the speed of a car using only Proportional Gain as it approaches a target (Stop sign).  Consider a P Gain of 0.1 where at 1000ft from the stop sign we command 1000 x 0.1 = 100MPH.  Then at 100ft we command 10MPH.  Then at 10ft we command 1MPH.  This results in a nice, smooth, exponential approach, without overshoot.&lt;br /&gt;
&lt;br /&gt;
Contrast this with controlling the acceleration (torque) of a car using only Proportional Gain as it approaches a target (Stop sign).  At large distance we apply maximum acceleration.  Although as we approach the stop sign we reduce acceleration, we continue to accelerate and speed continues to increase until we pass the stop sign.  Torque mode servos are inherently unstable.  P only gain only works at all if there is some friction (the car is dragging a sled which slows us down with less torque).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Acceleration Mode Servos''' may or may not have any feedback.  If they have feedback it is usually used only to commutate a brushless motor.  In the plots the Output (green) will have large magnitude when the Position (red) is accelerating, where the plot has curvature (changing slope).&lt;br /&gt;
&lt;br /&gt;
Acceleration mode Servos are unlikely to work well or at all with only P Gain.  Some form of damping or lead compensation will usually be required to get a stable system.   D (derivative) Gain (or a lead compensator) should be included with the P Gain to help stabilize the system.  D Gain can be increased to make the system more stable up to a point.  After some point the additional D Gain will make the system more unstable. and should be reduced.&lt;br /&gt;
&lt;br /&gt;
When using D Gain (or lead compensation) the quantization noise (steps) in the encoder position can cause spikes in the output.  For example a D Gain of 100 will cause a spike of 100 counts in the output whenever the input changes suddenly by 1 count.  If the spikes are very high amplitude and short duration, the Amplifier may not handle them in the expected manner.  A low pass filter can be used to widen and reduce their amplitude allowing the amplifier to handle them more effectively.  Typically a 2nd order low pass filter of 500Hz Q=1.4 is used.  The last filter is normally used so it is applied to any Feed Forward. Such as:&lt;br /&gt;
&lt;br /&gt;
[[File:LowPass400Q1p4.png|none|link=|680x439px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;Velocity.2C_Acceleration.2C_and_Jerk&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Velocity, Acceleration, and Jerk&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;div id=&amp;quot;yui_3_16_0_1_1445622719616_3315&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;The Velocity, Acceleration, and Jerk in the Step Response Screen (KFLOP parameter settings) and the Acceleration and Velocity in the KMotionCNC | Tool Setup | Trajectory Planner | Axis Parameters are both used for different things.  The two sets of parameters are independent. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;yui_3_16_0_1_1445622719616_3313&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;The&amp;lt;/span&amp;gt; KFLOP parameters are used for 3rd order motions.   These include things like:  Jogging, Homing, and GCode Rapids (G0).  The units in KFLOP are in counts or steps.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span id=&amp;quot;yui_3_16_0_1_1445622719616_3320&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;The KMotionCNC parameters are used for 2nd order (&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;yui_3_16_0_1_1445622719616_3321&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;infinite &amp;lt;/span&amp;gt;Jerk) coordinated motion paths.  These are GCode G1,G2,G3 continuous paths.  The units are in Inches (or in some cases degrees).   Note there is an Option in KMotionCNC &amp;quot;Rapids as Feeds&amp;quot; where these parameters will also be used for Rapids.  But this option should only be used for highly non-linear Kinematic Systems which can not take advantage of faster/smoother 3rd order point to point straight line Rapids.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;Tests&amp;lt;/span&amp;gt; to find and verify optimal settings for both types of moves should be made using the Step Response Screen.  Optimal settings are usually determined by experimentation.  Although it might be possible to calculate the settings based on motor torque gains, back-emf, amplifier voltage/current, mass, moments of inertia, friction, encoder resolution, leadscrew pitch, required following accuracy, etc... It is often too complicated and with too many unknowns to be practical.  So experimental moves can be tested at ever increasing Velocities, Accelerations, and Jerks until the system is unable to follow the trajectory without having too much error or shock to the system.  After absolute limits of the system are determined then the settings should be backed off by some amount to provide operating margins (ie 20%).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;It is usually best to first determine max possible velocity using a relatively low acceleration. Maximum power is usually required at the point of the trajectory where velocity is high and still accelerating.  Supply Voltage limitations tend to limit velocity.  Current limitations tend to limit acceleration.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[File:MaxVelAccelPower.png|none|link=|485x361px]]&amp;lt;br /&amp;gt;The Step Response Screen always performs 3rd order motion but 2nd order motion can be simulated by temporarily setting the Jerk to a huge value (1000X the acceleration value).  In general reducing the Jerk value will result in longer times to perform motions, but often the improved smoothness will permit higher maximum accelerations and velocities to be used resulting in overall shorter motion times.  An analogy might be how you might stop more quickly in a car, without skidding or spilling your coffee, by applying the brakes harder in a more gradual manner rather than slamming on the brakes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;Make&amp;lt;/span&amp;gt; sure when testing the size of move is long enough for full acceleration and velocity are achieved.  A common mistake is to have Acceleration or Velocity Settings set to too high for your system but when testing a short move there is no indication of a problem.  The plot mode of Velocity Output  vs Time can be helpful to verify full Velocity is being achieved.&amp;lt;span id=&amp;quot;.C2.A0&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt; &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;The idea is that a motor axis has torque and speed limitations and you should determine and understand what they both are for your system. Available motor torque drops off with higher speed. At some speed the motor will not even be able to generate any torque at all. Motor torque is required to accelerate the axis. We need to make sure that no combination of velocity and acceleration will ever cause the axis to fault/stall/fail. So there is often a complex set of speeds and accelerations that will work ok that form an envelope of workable speed and acceleration. So one nice thing to know is top speed possible. It is like taking your car out on a long straight highway and gradually accelerating to find the max speed is 100MPH. You will then know that ever attempting a speed over 100MPH will always fail. Also speed should probably be limited to something like 80MPH to allow for margin and to allow reasonable acceleration up to that speed. The reason for performing the top speed test at low acceleration is to avoid a failure because of not being able to accelerate at the specified rate. So we want to set the acceleration to a low value so it will not be a limiting factor when determining top speed. However if we set the acceleration so low with a short trip distance we will never go very fast and the speed test will be meaningless. This should be avoided. Change the Plot type to Velocity, Output, vs Time to clearly see if this is the case.  You may want to turn off Measured Velocity if it obscures viewing the Commanded Velocity&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;For example to accelerate to 700,000 counts/sec at an acceleration rate of 700,000 counts/sec^2 would take 1 second. And then to slow back down would take 1 more second. So at least 2 seconds of motion would be required to get to full speed. A 100,000 count move (2 inches for a system with 50,000 counts/inch) takes much less time than that. Furthermore with a relatively low Jerk setting (1e6). This means the acceleration will be applied gradually over 0.7 seconds. This means an even much longer time and distance would be required to achieve top speed.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Here is the method to follow to find 2nd/3rd order motion profile limits:&amp;lt;br /&amp;gt;(note every system is different and will vary based on resolution, motor size/type, mass, etc...)&lt;br /&gt;
&lt;br /&gt;
'''1 - Find Max Velocity at low Acceleration and infinite Jerk'''&lt;br /&gt;
&lt;br /&gt;
Choose a Velocity to test (ie V=100000 counts/sec)&amp;lt;br /&amp;gt;Set a moderately low Acceleration Time of 1 second (A = V/1sec = 100000 counts/sec^2)&amp;lt;br /&amp;gt;Set very high Jerk so Acceleration is applied almost instantaneously in 0.001 sec (J = A/0.001sec = 1e8 counst/sec^3)&amp;lt;br /&amp;gt;Test a very long move 20 inches if possible (for resolution 50000 counts/inch, 1,000,000 counts)&amp;lt;br /&amp;gt;Plot Velocity, Output, vs time to see if V is actually obtained&amp;lt;br /&amp;gt;If the motion was successful repeat all above with higher V, if not try lower V&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Once Max V is found reduce by some margin (ie 20-50%)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Note you may decide on lower speed for other reasons (safety, vibration, noise, wobble, shock, etc....)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;'''2 - Find Max Acceleration for your system for the chosen Velocity'''&lt;br /&gt;
&lt;br /&gt;
Using the V found above increase A (keeping Jerk high in the same manner) until the system fails/faults/excessive shock, etc...&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Once Max A is found reduce by some margin (ie 20-50%)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;These V and A Values are now known good values for your system and can be used for 2nd order motions such as KMotionCNC Trajectory Planner or Mach3 Motor tuning. Note units will need to be converted (counts to inches or mm, time from seconds to minutes depending on the App)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3 - Find optimal 3rd order Jerk limited motions.'''&lt;br /&gt;
&lt;br /&gt;
The previous result from Step #1 and #2 used nearly infinite Jerk where Acceleration forces were applied nearly instantaneously. By reducing Jerk smoother motion should be possible. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Set Jerk so it is applied over 20ms (ie for A=200000 J = A/0.020 = 1e7&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Test to see if motions are smoother. With closed loop systems the Position Error Plot can be used to see if the motion has less error and is smoother. Open loop system will require you to hear the difference.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Increase/decrease Jerk to find the optimal value. Note reducing Jerk a lot will of course make the system very smooth, but will also be much slower using less acceleration and velocity which is undesirable. So the highest Jerk possible should be found that still provides some smoothness.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Reducing Jerk only will always make the system slower with less performance (but hopefully significantly smoother). It is usually then possible to increase Acceleration and Velocity somewhat to achieve even higher performance than what was possible with infinite Jerk while being as smooth or smoother.&lt;br /&gt;
&lt;br /&gt;
'''4 - Reduce Max Following Error Limit to small value'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;Now that the system is properly tuned and reasonable Acceleration, Velocity, and Jerk are set the motor Position should always follow the commanded Destinations accurately with only small errors.  By Plotting Position Errors under various conditions (Distances) you can get an idea of the worst case following errors under normal conditions.  The Max Following Error Parameter should be set to a value slightly larger than the worst case following error (ie 20~50% larger).  In this case if anything abnormal occurs: ie. The axis hits an obstacle, commanded at too high of a speed, servo goes unstable, hardware/electronics failure, a Following Error will be immediately detected and the axes disabled.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axis Resolution - counts/inch (or counts/mm)&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Its important to understand the resolution of your Axis which is the number of fundamental raw motor/driver encoder counts or motor steps per standard unit of distance (inch or mm).  Although tuning in KMotion.exe Step Response Screen and motions within KFLOP typically use units of raw counts or steps it is important to know how these translate to real-world distances, speeds, etc...  Later, applications such as KMotionCNC or Mach3 will need this information to scale motions properly.&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;There are usually a number of factors that combine together to determine the Axis Resolution.  These might include:&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;counts or steps per motor revolution&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;any gearing or belts and pulleys involved between motor and drive mechanisms&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;lead screw pitch, rack and pinion tooth pitch, drive belt radius, etc.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For example consider a Stepper Drive with:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;3200 steps per motor rev&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;2:1 gear reduction from motor to lead screw&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;0.2 inch lead screw pitch&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axis Resolution = 3200 step/motor rev x (2 motor rev/ screw rev)  / (0.2 inch / screw rev) = 32000 steps/inch&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;To determine whether your assumptions and calculations are correct perform a test.  Command as large of a move as convenient and measure the actual distance moved with a ruler.   For example in the axis described above you might command a move of 320000 steps.  This should result in a motion of:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;320000 steps / (32000 steps/inch) = 10 inches.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For KMotionCNC set the Axis Resolution in the [http://dynomotion.com/Help/KMotionCNC/ToolSetupScreenTP.htm#Axis_Motion_Parameters Tool Setup | Trajectory Planner Screen | Axis Parameters | cnts/inch].  Note units must be in units of inches.  If your resolution is in mm units multiply by 25.4.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For Mach3 enter the Axis Resolution in the Configuration | Motor Tuning Screen.  Make sure the setup units (not GCode units) match the mode of your values.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Servo Dither/Hunting - (oscillation around zero error)===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;Servos have high accuracy because they are always actively trying to make corrections and drive the error to zero.  Unfortunately this can sometimes cause annoying dither or position hunting around zero when not moving.  This is a very complex non-linear effect dependent on the dynamics of the mechanics.  Because of the highly non-linear quantization effects of single &amp;quot;steps&amp;quot; in the encoder position, stiction, backlash, etc. it follows different rules and is harder to analyze than normal servo tuning/stability in the larger magnitude more linear regime.  For example attempting to apply &amp;quot;Damping&amp;quot; is unlikely to work.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Lowering gains will usually help at the expense of performance.  However in many cases more than acceptable performance can be achieved with lower gains so one should consider if the higher gains are really needed.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;KFLOP has a Deadband Gain and Range feature that can basically be used to tell the servo to not attempt to correct small errors (treat the errors as zero), or to try to correct them less aggressively (with a Gain less than 1.0).  See [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Dead_Band here for more information]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Unfortunately adding Deadband doesn't always help the servo &amp;quot;sit still&amp;quot; and may actually increase the size of the dither depending on the dynamics.&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that when the servo is commanded to a non integer position ie 999999.7 encoder counts without deadband the servo will always be making corrections.  The best the servo can do is dither between encoder positions 999999.0 and 1000000.0.  With an error of either -0.7 or +0.3.  A servo with Integrator gain will guarantee the average is 999999.7&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;If dither is still a major problem a C Program might be used to monitor things and change settings under certain conditions to reduce dither.  See the example AntiServoDither__ALL.c which monitors for small errors for a period of time and if so reduces or turns off Integrator gain.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
===Noisy GCode - Trajectory Planner Smoothing===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;An analysis of Quantization Noise in GCode and Trajectory Planner Settings to generate smooth motion.&amp;lt;br /&amp;gt;[[File:GCode_Noisy_Path.png|none|link=|432x432px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[Trajectory Planner Smoothing Noisy GCode|See Analysis and Solution]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===Arc &amp;quot;faceting&amp;quot; - Trajectory Planner - Collinear Tolerance===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[File:ArcsTrajectoryZoomXTol.0005.png|none|link=|526x460px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[ArcFacetingColinearTol|See Analysis and Solution]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===I Gain/Max Limit Integrator===&lt;br /&gt;
I (Integrator) Gain can be used to eliminate persistent errors.  In fact any Integrator Gain at all guarantees the average error over infinite time is zero.  Without I Gain a system might have a small error that does not create enough output to overcome stiction to make a correction.  In such a case the error could persist forever.  Not so with any Integrator Gain.  Any error will be integrated and ramp the output higher and higher until eventually there will be a correction.  That assumes the Integrator or Output doesn't saturate or reach their programmed limits.  The rate the output ramps (or sums) is dependent on the size of the error and the I Gain value.  The Error x I Gain is summed every servo sample (90us).  This is why I Gain values are often small numbers (0.0001 - 0.01 typical range).  There is no guarantee that the position doesn't over shoot the target Destination.  In fact it is likely as as any error (area) under the trajectory will always be balanced by an equal area over the trajectory.  Too high of I Gain will make the system unstable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another case where I Gain is useful is when moving at high speed with a Velocity Amplifier.  To move at high speed a significant amount of output is required.  Without I Gain a significant amount of error could be required to provide this Output (ie Error x P Gain = Output).    With I Gain the Integrator will eventually ramp up to provide any Output necessary to move at the desired speed driving the error to zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Integrators have an issue often referred to as &amp;quot;Integrator Wind Up&amp;quot;.  This issue usually doesn't arise under normal conditions.  However if something is preventing the servo from making a correction such as forcing the position away from the target for a sustained amount of time, or disabling the amplifier, the Integrator will integrate to a huge unlimited value.  When the force is removed or amplifier re-enabled, the Integrator will likely cause a violent motion and overshoot.  Max Limit Integrator can help to minimize this issue by limiting the amount the Integrator can ramp up to.  So the Max Limit Integrator Value should be set at the minimum value that can still allow the Integrator to function in normal circumstances.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Typically there are two cases that should be considered when determining the Max Limit Integrator. &lt;br /&gt;
&lt;br /&gt;
# The amount of output expected to be required to overcome any stiction, friction, or other forces (cutting, gravity, etc...).  This is often not a large value and can be estimated or can be observed from the Step Response Screen (green plot right side scale is the output) when making a move.&lt;br /&gt;
# The amount of output required to provide the output needed to move at speed.  It is important to note that D Gain provides a damping or drag effect on the Output.  So the Integrator must be able to ramp up to a sufficient level to overcome the damping or drag effect and still provide enough output to move at the commanded speed.  For example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assume:&lt;br /&gt;
&lt;br /&gt;
# Commanded speed of 500,000 counts/sec&lt;br /&gt;
# D Gain of 35&lt;br /&gt;
# Output required to move at speed is 1800 DAC Counts&lt;br /&gt;
# Servo Sample Time of 90us&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Damping effect = Speed x D Gain x Sample Time = 500000 x 35 x 90e-6 = 1575 counts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Required Integrator Value = 1800 + 1575 = 3375&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So to provide some margin an Max Limit Integrator Value of 3500 might be used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Max Limits - Error===&lt;br /&gt;
Max limits error can be helpful to have your system respond less violently in the abnormal event where an excessively large error occurs.  Normally with a properly tuned system following errors should be small.   Setting a Max limits error can cause the servo to treat errors beyond a specified limit as if they were only the size of the limit and therefore respond less so than they would otherwise.  The max limits error is normally set to a value so it is not limiting under normal circumstances.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Plot below shows a situation where a small max limits error combined with a low P gain severely limits the Output.  In the plot below a large move (10000 counts) at a high speed (40000 counts/sec) is commanded.  Only P Gain (0.2) is used to provide the Output (green).  The max error limit of 200 combined with the low gain (0.2) limits the output to only 40 DAC counts.  Even as the true error increases to many thousands of counts, the servo is told to ignore the amount over 200.  So the output can never exceed 40 DAC counts.  The 40 DAC count limit means that the Axis is therefor not capable of providing the output necessary to keep up with the commanded motion.  The axis does the best it can with the limited output, and only does a fraction of the desired motion.&lt;br /&gt;
&lt;br /&gt;
[[File:Move10000.png|none|link=|665x431px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After increasing the max limits error the Output (green - right scale) now goes to a much higher value (900), and the Position (red) follows the Command (blue) to a much better degree.&lt;br /&gt;
&lt;br /&gt;
[[File:Move10000_nolimit.png|none|link=|667x430px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Increasing the P Gain to 1.6 also applies more Output sooner and the Position follows the command still better.&lt;br /&gt;
&lt;br /&gt;
[[File:Move1000_p1.6.png|none|link=|667x432px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Lead Compensator vs Derivative Gain===&lt;br /&gt;
Derivative (D) Gain is often used to help stabilize a system.&amp;amp;nbsp; It helps to think in the Frequency Domain to help understand how the two forms of compensation help.&amp;amp;nbsp; Please read below and [http://dynomotion.com/Help/BodeScreen/BodeScreen.htm this] for more information on the Frequency Domain.&amp;amp;nbsp; Both Compensation methods add positive phase to help stabilize the system.&amp;amp;nbsp; Unfortunately both methods increase gain at higher frequencies possibly causing the system to go unstable at higher frequency.&amp;amp;nbsp; A Lead Compensator provides the benefit of positive phase but without as much gain increase at higher frequencies.&amp;amp;nbsp; This figure shows a simplified Gain Plot comparison:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:DGainvsLead.png|none|link=|593x593px]]&lt;br /&gt;
&lt;br /&gt;
Here is a Bode Plot of a P=0.5 D=20 Compensator.   Note the KMotion.exe Bode Plot Screen has the capability of plotting the Frequency Domain Response of the PID+Filters Compensation.  Assume we desire positive phase to be added at 40Hz.  Notice the positive phase of 40 degrees at 40Hz which is good.  However the Gain increase in the 1KHz region of about 21db which is bad.&lt;br /&gt;
&lt;br /&gt;
[[File:P.5D20Annotate.png|none|link=|621x460px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a Bode Plot of a P=0.5 N1=N2=25Hz D1=D2=70Hz Compensator.   Assume we desire positive phase to be added at 40Hz.  We choose N1 N2 and D1 D2 to surround the frequency where the positive phase is desired.  Moving them further apart will increase the amount of positive phase but also increase the added Gain.  Notice the positive phase of 60 degrees at 40Hz which is good.  However the Gain increase in the 1KHz region of about 12db which is bad.  However both are improvements over the D Gain compensator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:PoleZeroFilter.png|none|link=|210x319px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:P.5D0N25D70Annotate.png|none|link=|644x478px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Tuning Master/Slave Configurations===&lt;br /&gt;
Master/Slave [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Master/Slave_Settings Configurations] allow two (or more) motors to drive the same axis.  Slaves are configured to follow a Master Axis.  For example two lead screws on both sides of a gantry.&lt;br /&gt;
&lt;br /&gt;
Tuning slaved axes is kind of a catch 22.  In order to tune one axis the other axis must be tuned well enough to follow and vice versa.  If possible, disconnect any mechanical linkage between the Master and Slave and test them separately without Slaving the Axes together to verify each axis Servos (can hold a position), moves at least somewhat properly, and moves in the same direction (assuming a positive [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Master/Slave_Settings Slave Gain] will be used).&lt;br /&gt;
&lt;br /&gt;
It is usually possible to incrementally tune each axis, at first moving slowly, then later at higher speeds, accelerations, and gains.  Only the Master Axis can be tested with the [http://dynomotion.com/Help/StepScreen/StepScreen.htm Step Response Screen].  This is because the Slave will follow any movement of the Master, but the Master will not follow movement of the Slave.  So if the Master Axis is moved all is well as both axes will move together, but if you try to move the Slave axis the two axes will fight.  The Master fighting to stay where it is, and the Slave fighting to move.&lt;br /&gt;
&lt;br /&gt;
To test/tune the Slave axis temporarily reverse the Master/Slave roles to make it the Master and then test it as the Master.&lt;br /&gt;
&lt;br /&gt;
Note: only the Master Axis should be included into the Coordinated Motion System.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Bode Plots===&lt;br /&gt;
A Bode Plot is a powerful tool for characterizing and providing insight into a dynamic system. It can help determine closed loop stability, bandwidth/performance, resonant frequencies, and more. It is entirely based on the system being linear. Linear in the sense that if the amplitude of some input signal is changed then the output signal will change proportionally as well. Unfortunately most systems are not entirely linear. Stiction, backlash, encoder quantization, amplifier saturation, and other effects are non-linear. For example driving a system with a signal too small to overcome stiction will result in no output at all whereas a larger signal will result in some output. This is clearly non-linear behavior. It would be nice to use a technique that handles non-linear systems but basically none are known.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;A Bode Plot is made injecting a stimulus to the system and observing how the system responds. For the reasons of non-linearity it is very important to perform a Bode Plot measurement using a representative level of stimulus similar to what the system will actually have during normal operation. If the Stimulus is not adjusted properly the result is likely to be completely invalid. Additionally the system should be reasonably tuned and stable so that it is responding in a reasonable way to the stimulus. If the system is unstable or very poorly tuned the result is likely to be completely invalid.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;You might think of it somewhat like shaking a box to determine what is in it. You should shake it with enough intensity and at frequencies to get some reaction, but not so high of intensity to break or distort the object inside.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;To create a Bode Plot use the KMotion.exe Bode Plot Screen. First select Plot: Time domain - Command, Position, Output vs Time and adjust the Amplitude and cutoff Freq until there is small but significant Position (red) changes (ie 50 encoder counts), at a frequency low enough that the Position at least somewhat attempts to follow the Command (blue), and where the Output (green) is not near saturation for the Drive being used.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;After the Stimulus/Noise Injection settings are set switch to Plot: Open Loop - Magnitude and Phase vs Frequency. Set the number of Samples to average (ie 20) and perform a Measurement.&amp;amp;nbsp; [http://dynomotion.com/Help/BodeScreen/BodeScreen.htm See here for more information].&lt;br /&gt;
&lt;br /&gt;
===Links to other Information on Tuning and Bode Plots===&lt;br /&gt;
[http://ctms.engin.umich.edu/CTMS/index.php?example=Introduction&amp;amp;section=ControlFrequency umich.edu Introduction section Control Frequency]&lt;br /&gt;
&lt;br /&gt;
[http://www.motiontech.com.au/assets/pdf/Kollmorgen%20Use%20Control%20Theory%20to%20Improve%20Servo%20Performance%20230712.pdf  Kollmorgen Use Control Theory to Improve Servo Performance 230712.pdf]&lt;br /&gt;
&lt;br /&gt;
==Problems and Resolutions==&lt;br /&gt;
====General====&lt;br /&gt;
:* [[Noise - Typical Problems and Resolutions|Dealing with noise on inputs]].  If you experience issues with inputs misreading, the issue may be noise.  This page provides examples on what might be causing noise issues and examples of how to possibly deal with noise.&lt;br /&gt;
:* Other&lt;br /&gt;
===Software-Specific Problems and Resolutions===&lt;br /&gt;
:* Place links to pages explaining resolutions to problems that are largely software-related here&lt;br /&gt;
[[KFLOP User C Programs Compiling/Launching Slowly because of Windows Defender]]&lt;br /&gt;
&lt;br /&gt;
===Hardware-Specific Problems and Resolutions===&lt;br /&gt;
:* Place links to pages explaining resolutions to problems that are largely hardware-related&lt;br /&gt;
====[[Step/Dir Drives lose 2 Steps for each pair of Direction Reversals]]====&lt;br /&gt;
==Applications and Projects==&lt;br /&gt;
:* Place links to pages that explain how you accomplished your particular project.  Write clear explanations that provide background on what you did and how you did it.&lt;br /&gt;
====[[Tool Changer - router linear 4 Tools - C Program]]====&lt;br /&gt;
[[File:LINEAT+ATC.jpg|none|link=|246x178px]]More linear milling tools: https://www.ichome.com/&lt;br /&gt;
&lt;br /&gt;
====[[Part Zero &amp;amp; Tool Height Touch Plate|Part Zero &amp;amp; Tool Height Touch Plate]]====&lt;br /&gt;
====[[Driving Hobby Servos]]====&lt;br /&gt;
[[File:HobbyServo.png|left|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
HiTec Type&lt;br /&gt;
&lt;br /&gt;
==Electrical Discharge Machining==&lt;br /&gt;
[https://en.wikipedia.org/wiki/Electrical_discharge_machining EDM (wikipedia)] is a method of cutting materials with high precision and detail.  Dynomotion Motion Controllers work well for EDM because of the ability for feedrate to be dynamically controlled including reversal along cutting path.&lt;br /&gt;
&lt;br /&gt;
[[Information on BAXEDM Arc Generators used with KFLOP]]&lt;br /&gt;
&lt;br /&gt;
Applied Science video that shows how to build an BAXEDM drilling machine using KFLOP and describes how it works:&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|https://youtu.be/rpHYBz7ToII|||||start=980}}&lt;br /&gt;
&lt;br /&gt;
==How to convert a milling machine to a 3D printer in 3 easy steps==&lt;br /&gt;
[[File:CNCto3DPrinter.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
More information [[How to convert a milling machine to a 3D printer in 3 easy steps|here]].&lt;br /&gt;
&lt;br /&gt;
==International and other Languages==&lt;br /&gt;
[[Russian]]&lt;br /&gt;
&lt;br /&gt;
[[Spanish]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/KMotion_Libraries_-_GCode_Interpreter_-_Trajectory_Planner_-_Coordinated_Motion_-_.NET</id>
		<title>KMotion Libraries - GCode Interpreter - Trajectory Planner - Coordinated Motion - .NET</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/KMotion_Libraries_-_GCode_Interpreter_-_Trajectory_Planner_-_Coordinated_Motion_-_.NET"/>
				<updated>2025-02-24T01:53:25Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Update that VS2022 is currently used&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Building the KMotion Libraries==&lt;br /&gt;
To build the KMotion Libraries:&lt;br /&gt;
&lt;br /&gt;
# Install [https://visualstudio.microsoft.com/downloads/ Microsoft Visual Studio Community 2022] (include MFC option)&lt;br /&gt;
# Open '''BuildAllLibs.sln''' Solution from root directory of KMotion Installation&lt;br /&gt;
# Select Release or Debug Configuration as desired&lt;br /&gt;
# Select Build | Build Solution&lt;br /&gt;
# new Library .DLLs and .EXEs will reside in the root\KMotion\Release or Debug folder&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==KMotionDLL.dll==&lt;br /&gt;
C++ Library that facilitates and coordinates all the communication to KFLOP.  It contains the CKMotionDLL class which provides the multi-process, multi-thread, multi-board access to KFLOP using a Client/Server approach.  It also creates and instance of the Coordinated Motion Class and GCode Interpreter Classes.&lt;br /&gt;
&lt;br /&gt;
==32/64-bit Libraries and Examples==&lt;br /&gt;
The Library and Example Solutions/Projects support 4 Configuration|Platforms to build Debug or Release binaries for 32/64-bit code Platforms.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 4 Configuration|Platforms are:&lt;br /&gt;
&lt;br /&gt;
Debug        |    x86&lt;br /&gt;
&lt;br /&gt;
Release      |    x86&lt;br /&gt;
&lt;br /&gt;
Debug64    |    x64&lt;br /&gt;
&lt;br /&gt;
Release64 |    x64&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:ConfigurationPlatform.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note due to Microsoft legacy issues the Win32 platform and x86 platform are basically equivalent.  x86 should be used where available.  To build a particular Configuration | Platform use the drop downs to select it then select build.  Make sure both are selected properly before building.  Some combinations such as Debug64 | x86 are inappropriate and should not be selected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Binary Output Files will be will be placed into separate folders with the name of the Configuration under the &amp;lt;&amp;gt;\KMotion\ folder:&lt;br /&gt;
&lt;br /&gt;
[[File:ConfigurationFolders.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Visual Studio Build | Batch Build can be used to build all 4 configurations with one click.  Configurations | Platforms that are appropriate to be built have been selected.  Note Microsoft Visual Studio Batch Build does not support building Visual Basic projects.  If a Visual Basic Project is included in a solution Batch Build will be disabled.  None of the Libraries are Visual Basic based so BuildAllLibs.sln allows Batch Build to be used.  BuildExamples contains several Visual Basic examples so Batch Build will be disabled.  BuildExampleNoVB.sln has Visual Basic Projects removed so Batch Build can be used for the Non-Visual basic examples.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:BatchBuild.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note various versions of Visual Studio have an issue where Batch Build settings were not being saved so all build settings would need to be re-selected each time after launching Visual Studio.   VS2022 Version 17.7 has this corrected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note in some Versions of Visual Studio Batch Build is available but is not displayed on the tool bar or menus.  It can be added using Visual Studio | Tools | Customize feature.  Shown below is the process to add it to the Build Menu.  It can be added to the Build Toolbar in a similar manner.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CustomizeBatchBuild.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Most of the differences between 32 vs 64-bit applications or libraries involve compiler and linker settings.  The appropriate libraries must be linked together.  32 and 64-bit libraries can not be mixed.  Certain .NET assemblies can be created to support both types (AnyCPU).  However KMotion's Projects are selected to specifically be either x86 or x64.&lt;br /&gt;
&lt;br /&gt;
Regarding Coding for 32 vs 64-bit environments is mostly transparent.  The main difference being that addresses in 64-bit code are 64 bits and in 32-bit code they are 32 bits.  So in C++ pointers use 8 bytes vs 4 bytes of memory.  This is normally automatically handled by compilers so is transparent to the coder.&lt;br /&gt;
&lt;br /&gt;
The C++ int data type is 32-bits in both environments.  A 64-bit integer can be defined as type __int64.&lt;br /&gt;
&lt;br /&gt;
In cases where an address is being saved or passed an an int, in will not fit in a 64-bit environment.  KMotion's C++ libraries include a macro define as HANDLE64 to be of the appropriate type for the environment.  HANDLE64 is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:csharp&amp;quot;&amp;gt;#if _WIN64&lt;br /&gt;
#define HANDLE64 __int64&lt;br /&gt;
#else&lt;br /&gt;
#define HANDLE64 int&lt;br /&gt;
#endif&amp;lt;/pre&amp;gt;&lt;br /&gt;
32-bit code has a program/data range of 2 GBytes. 64-bit systems can theoretically allow up to 16 exabytes (16 billion GB) of RAM. The SimpleFormsCS C# example has an #define option to allocate more than 2GB of data to show that this is possible with a 64-bit program. To enable this change line 1 of Form1.cs to define TEST_BIG_ARRAY&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:csharp&amp;quot;&amp;gt;#define TEST_BIG_ARRAY&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the test two Double Arrays of 1/2 billion elements each are allocated from Heap Memory.  For a total of 1 billion elements.  Since Doubles are 8-bytes each this allocates 8GBytes of memory.  Note that Arrays in C# are limited to a 32-bit value number of elements (~2 billion) even in 64-bit environments. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:csharp&amp;quot;&amp;gt;#if TEST_BIG_ARRAY&lt;br /&gt;
        static int ASize = 500000000;&lt;br /&gt;
        Double[] Big = new Double[ASize];&lt;br /&gt;
        Double[] Big2 = new Double[ASize];&lt;br /&gt;
        Double sum = 0;&lt;br /&gt;
#endif&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fills the arrays with their indexes squared.  Then sums all the elements&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:csharp&amp;quot;&amp;gt;#if TEST_BIG_ARRAY&lt;br /&gt;
            for (uint i = 0; i &amp;lt; ASize; i++) Big[i] = Big2[i] = (double)i * (double)i;&lt;br /&gt;
            for (uint i = 0; i &amp;lt; ASize; i++) sum += Big[i] + Big2[i];&lt;br /&gt;
#endif&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On an older Intel i7 Windows 10 PC with 16GB of RAM this code initially required 40 seconds to execute but reduced to nearly 5 seconds on subsequent runs possibly  because the first run required more memory to be swapped out to Disk to free RAM.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note for the run-time library to support objects larger than 2 GBytes an '''app.config''' file must have the '''gcAllowVeryLargeObjects''' enabled property set true.  As shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:AllowBigObjects.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Otherwise a System.OutOfMemoryException may occur when attempting to allocate the object.  Such as the one shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:BigArrayExceptionSmaller.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==GCodeInterpreter.dll==&lt;br /&gt;
C++ Library that facilitates Trajectory Planning, Coordinated Motion, Motion Buffering, and GCode.  It contains the CCoordMotion and CGCodeInterpreter classes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===GCode Actions===&lt;br /&gt;
The GCode Interpreter has a method of invoking generalized &amp;quot;Actions&amp;quot;.  Actions can be invoked from MCodes, S Words, User Defined Buttons, or Special Actions.  The Actions performed can be various operations such as changing the states of one or two I/O Bits, writing a Speed value to a DAC, Invoking a User C Program in KFLOP, Invoking a PC Program, Application Callback, or Executing GCode.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The  [https://dynomotion.com/KMotion_dotNet/Docs/Help/html/T_KMotion_dotNet_MCODE_TYPE.htm MCODE_TYPE] defines what type of Action to perform.  It is not related to an MCode Number.   An Action consists of an MCODE_TYPE and several parameters (numeric and a string).  The number and purpose of the parameters vary depending on the MCODE_TYPE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;The Interpreter allows you to configure about 30 MCodes to perform Actions.  Several MCodes such as M0 (stop) and M30 (stop/rewind) have Interpreter functionality, but can also perform an additional Action.  20 MCodes (100-119) are for User use.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;The Interpreter's 'S' word can also invoke an Action.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;The KMotionCNC Application also uses Actions assigned to custom User Buttons and to &amp;quot;Special Actions&amp;quot; that are executed on operations such as Application Startup.  All Actions are stored in an array and referenced by the index into the array (not necessarily the MCode number).  See the chart below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;KMotionCNC allows the MCode Actions to be configured in its Tool Setup.  See [https://dynomotion.com/Help/KMotionCNC/ToolSetupScreenM3.htm here] and [https://dynomotion.com/Help/KMotionCNC/ToolSetupScreenM100.htm here].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;From .NET you can configure the Action Array using the [https://dynomotion.com/KMotion_dotNet/Docs/Help/html/M_KMotion_dotNet_KM_Interpreter_SetMcodeAction.htm KM_Interpreter.SetMcodeAction Method].  Note the Array Index does not necessarily equal the MCode Number.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After the Action Array in the Interpreter is configured any executed MCode (or S) will perform the configured Action.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Note that MCodes can also set GCode Parameters (PQR words) into KFLOP persist variables.  This is described [http://dynomotion.com/Help/KMotionCNC/MCodesWithParams.htm here].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;This [https://www.dynomotion.com/forum/archive/SetMCodeAction.html Forum Thread] may also help.&lt;br /&gt;
&lt;br /&gt;
===GCode Action Table===&lt;br /&gt;
The GCode Interpreter contains a Table of Actions:&lt;br /&gt;
&lt;br /&gt;
: MCODE_ACTION McodeActions[MAX_MCODE_ACTIONS];&lt;br /&gt;
An Action is defined by an action code and several parameters (several numeric and a string parameter).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Actions are packed into a contiguous array of actions.  When configuring the Actions  from an Application the Array Index is used.  When Invoking the Action the Action # is used.  See the table below for the relationship.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;border-color: #000000;&amp;quot; border=&amp;quot;1&amp;quot; width=&amp;quot;219&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot; width=&amp;quot;64&amp;quot;|Index&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot; width=&amp;quot;83&amp;quot;|Description&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot; width=&amp;quot;72&amp;quot;|Action#&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|0&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M0&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|0&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|1&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M1&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|1&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|2&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M2&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|2&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|3&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M3&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|3&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|4&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M4&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|4&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|5&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M5&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|5&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|6&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M6&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|6&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|7&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M7&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|7&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|8&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M8&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|8&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|9&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M9&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|9&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|10&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|S&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|10&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|11&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|User But0&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|11&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|12&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|User But1&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|12&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|13&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|User But2&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|13&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|14&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|User But3&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|14&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|15&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|User But4&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|15&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|16&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|User But5&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|16&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|17&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|User But6&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|17&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|18&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|User But7&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|18&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|19&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|User But8&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|19&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|20&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|User But9&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|20&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|21&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M100&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|100&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|22&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M101&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|101&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|23&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M102&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|102&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|24&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M103&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|103&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|25&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M104&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|104&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|26&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M105&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|105&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|27&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M106&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|106&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|28&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M107&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|107&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|29&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M108&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|108&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|30&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M109&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|109&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|31&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M110&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|110&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|32&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M111&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|111&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|33&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M112&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|112&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|34&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M113&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|113&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|35&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M114&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|114&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|36&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M115&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|115&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|37&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M116&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|116&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|38&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M117&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|117&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|39&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M118&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|118&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|40&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M119&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|119&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|41&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|M30&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|24&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|42&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|Cycle Start&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|25&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|43&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|Halt&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|26&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|44&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|Stop&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|27&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|45&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|FeedHold&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|28&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|46&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|Resume&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|29&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|47&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|Prog Start&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|30&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|48&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|ProgExit&lt;br /&gt;
| style=&amp;quot;width: 64px; text-align: center;&amp;quot;|31&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==KMotion_dotNet.dll==&lt;br /&gt;
The KMotion Libraries are accessible from Programming environments that support .NET (ie C#, VB, Labview, etc.).  The .NET interface allows a single reference to KMotion dotNet.dll to pull in all the available functionality of the library and permit support for things like Auto Complete and type/parameter checking.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On-line html based .NET Library help files are available [https://dynomotion.com/KMotion_dotNet/Docs/Help/html/N_KMotion_dotNet.htm here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A Help File Based description of the KMotion dotNet functionality is available [http://www.dynomotion.com/KMotion_dotNet/Docs/Help/KMotion.Net.chm here]&lt;br /&gt;
&lt;br /&gt;
(note when downloading help files some Operating Systems may require the file to be unblocked in its properties to work fully).  See Below:&lt;br /&gt;
&lt;br /&gt;
[[File:Unblock_Help_File.png|none|link=|292x381px]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/PC_Example_Applications</id>
		<title>PC Example Applications</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/PC_Example_Applications"/>
				<updated>2025-02-24T01:47:57Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Update that PC Samples now built with VS2022&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__FORCETOC__&lt;br /&gt;
&lt;br /&gt;
A number of PC Applications using the KMotion Libraries are available in the Software download.  Visual Studio should be used to modify/compile the applications.  Currently the projects are compatible with VS 2022.   In some cases MFC (Microsoft Foundation Classes) capability needs to be added as a separate download.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://visualstudio.microsoft.com/downloads/ Link to the Microsoft Free Visual Studio Community Version]s&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;When installing make sure options for C++ and MFC are enabled.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Install Root directory contains a VS Solution BuildAllLibs.sln to build the KMotion Libraries.&lt;br /&gt;
&lt;br /&gt;
The VS Solution \PC VC Examples\BuildExamples.sln will build most all of the Examples &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
MFC C++ Examples - \PC VC Examples&lt;br /&gt;
&lt;br /&gt;
* KMotionCNC - CNC Application for controlling Mill/Router/Lathe etc&lt;br /&gt;
* Download Waveform - simple example to download some data to the gather buffer&lt;br /&gt;
* SimpleCoffload - simple example to compile/download a C Program to KFLOP&lt;br /&gt;
* SimpleConsole - simple example to send [http://dynomotion.com/Help/CmdsCategory.htm Console Script commands] to KFLOP&lt;br /&gt;
* SimpleCoordMotion - simple example of creating coordinated motion paths in KFLOP&lt;br /&gt;
* SimpleGCode - simple example to execute a GCode File&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;C# Examples - \PC VC Examples&lt;br /&gt;
&lt;br /&gt;
* KFlopWebNC - HTML CNC based App interfacing to KMotion Libraries&lt;br /&gt;
* KMotion_dotNet Console - Windows Console App using .NET Library Interface&lt;br /&gt;
* MeasureFiducials - Video Alignment Application to measure fiducial alignment marks and map coordinate space&lt;br /&gt;
* SimpleFormsCS - Simple Windows C# Forms App includes USB speed test&lt;br /&gt;
* TeachMotion - App for use with Lathe Spinners to teach Spinning motion and create GCode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Visual Basic Examples \PC VB Examples&lt;br /&gt;
&lt;br /&gt;
* DynoMotion VB.net - Demonstrates Coordinated motion, GCode Execution, Status, etc...&lt;br /&gt;
* Jogger - Simple VB6 App to Jog Axes&lt;br /&gt;
* Jogger.NET - simple VB .NET App to Jog Axes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
LabView Examples \PC LabView Examples&lt;br /&gt;
&lt;br /&gt;
* Kmotion DotNet DLL Sample.vi - Simple GUI to Jog, Display Readout, Execute C Programs, Console messages&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Iron Python Examples \PC Python Examples&lt;br /&gt;
&lt;br /&gt;
* OnOffWPF.sln - Demonstrates Bit Commands to KFLOP with WPF GUI&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Debugging From .NET into Unmanaged C++ Code of KMotion Libraries==&lt;br /&gt;
When debugging Managed code such as an App written in C# .NET it is sometimes helpful to step into or set breakpoints or view variables in the Unmanaged C++ KMotion Libraries to understand exactly what is happening.  Visual Studio allows you to do this but the Project Properties for the App must have the &amp;quot;Enable native code debugging&amp;quot; option enabled.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:EnableNativeCodeDebugging.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then for example when debugging on a line of Managed Code that makes a call to the KMotion Libraries such as this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:StepInto.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the debugger Debug | Step Into Menu button or tool bar button.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note in some cases Right-Click Step Into Specific can be used or may be necessary to specify exactly what to Step into as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:StepIntoSpecific.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stepping into functions should eventually get into the C++ Libraries as shown here:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:IntoCppCode.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If Visual Studio skips over Unmanaged code calls and refuses to step into the Unmanaged functions you may have some odd Visual Studio debug options set.  Exit debugging and within Visual Studio use the Debug | Options | Debugging | General and select options as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:DebugOptions2022.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note one disadvantage of having native code debugging enabled is that Visual Studio's powerful Edit and Continue option to make changes on-the-fly is not available.  So when not necessary to debug into Unmanaged code it is may be desirable to disable native code debugging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note the App being debugged should be using the Debug Versions of the KMotion Libraries from the Debug folder rather than the Release folder.  The BuildAllLibs.sln in configuration Debug may be used to create the Debug Versions.&lt;br /&gt;
&lt;br /&gt;
==Installing your PC Application on a Target System==&lt;br /&gt;
A number of KMotion DLLs EXEs and Data files in an expected structure are required for your application to run.  The Simplest solution is to install KMotion on the target system and place your executable in the \KMotion\Release Directory.  Otherwise you will need to include all the files referenced directly or indirectly by your application.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a relevant thread from our forum:&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/KFlop%20and%20dotnet%20dependencies.html KFlop and dotnet dependencies....]&lt;br /&gt;
&lt;br /&gt;
Quote:&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;span id=&amp;quot;yui_3_15_0_1_1456686023559_758&amp;quot; class=&amp;quot;qreply&amp;quot;&amp;gt;The cleanest way of sandboxing a KFlop DotNet application seems to be this:&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;1-Create a new DotNet Solution/Project and set the Project/Properties for the following&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Set the Debug Configuration's Build output path = bin\Debug1    (This can be anything except a folder named &amp;quot;Debug&amp;quot; or &amp;quot;Release&amp;quot;)&amp;lt;br /&amp;gt;Set the Release Configuration's Build output path = bin\Release1 (This can be anything except a folder named &amp;quot;Debug&amp;quot; or &amp;quot;Release&amp;quot;)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;2-Into your newly created Debug1 or Release1 folder(s), copy the appropriate debug or release versions of the following from the KMotion/Debug|Release folder:&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;KMotionDLL.dll&amp;lt;br /&amp;gt;KMotion_dotNet.dll&amp;lt;br /&amp;gt;KMotion_dotNet_Interop.dll&amp;lt;br /&amp;gt;GCodeInterpreter.dll&amp;lt;br /&amp;gt;KMotionServer.exe&amp;lt;br /&amp;gt;TCC67.exe&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;3-Copy the folder DSP_KFLOP and it's contents into both the Debug1 and Release1 folders.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Why it works: By using names other than &amp;quot;Debug&amp;quot; and &amp;quot;Release&amp;quot; for the application container folders we prevent the KMotionDLL from looking for a parent folder containing the KFLOP headers and compiles. This causes KMotionDLL to look in the current apppath (whichhappens to be where everything else is as well) for the DSP_KFLOP folder.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;At any point in the future, the Debug1 or Release1 container folders can be renamed with their app's name (or anything else other than the words Debug or Release) and moved, copied and the dotnet application within should continue to run without issue.&amp;lt;/span&amp;gt;''&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/KFLOP_C_Programs</id>
		<title>KFLOP C Programs</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/KFLOP_C_Programs"/>
				<updated>2025-01-13T17:31:43Z</updated>
		
		<summary type="html">&lt;p&gt;TK: C Program Size and Stack Limitations updated for Kogna&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;C Programs provide a powerful and flexible capability to perform almost any sequence of operations within KFLOP.   In most cases after you have tested and tuned all your hardware using the KMotion.exe setup program all the settings and initialization steps required for your system can be placed into an Initialization C Program so that your system can be fully initialized simply by executing the Initialization program.   Using a C Program offers full flexibility to initialize your system however and in whatever order you wish.  In most common cases an existing example can be used with simple modification of values specific to your system.  The KMotion.exe Setup program has some [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Utilities automatic capability] to translate the Axes Screen Values that were determined by you during configuration and testing into C Code.&lt;br /&gt;
&lt;br /&gt;
===Initialization C Program===&lt;br /&gt;
The Initialization C Program will normally perform operations of the following type:&lt;br /&gt;
&lt;br /&gt;
* Enable/define any Option boards present (ie.    KStepPresent=TRUE;      // enable KSTEP input multiplexing)&lt;br /&gt;
* The setting of Axes parameters (ie.    ch0-&amp;gt;Accel=200000; )&lt;br /&gt;
* Enable Axes (ie.EnableAxisDest(0,0); )&lt;br /&gt;
* Define the Coordinated Motion Axes (ie.    DefineCoordSystem(0,1,2,-1);  // define axes for XYZ&lt;br /&gt;
* Forever Loop to service any continuous requirements such as MPG, External Buttons, EStop, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;Adding_the_configuration_for_a_new_Axis_to_your_Initialization_C_Program:&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Adding the configuration for a new Axis to your Initialization C Program:&amp;lt;/span&amp;gt;===&lt;br /&gt;
# Configure the Channel in KMotion.exe and verify that after Pushing &amp;quot;Enable&amp;quot; (which downloads and enables) it all works properly&lt;br /&gt;
# On the Config/Flash Screen Push the &amp;quot;C Code To Clip Board&amp;quot; Button&lt;br /&gt;
# Open your Initialization Program in the C Programs Screen&lt;br /&gt;
# Position the cursor after the previous Axis settings&lt;br /&gt;
# Right Mouse Click &amp;quot;Paste&amp;quot;&lt;br /&gt;
# If desired also enable the axis by inserting EnableAxisDest(xx,0); where xx is the Axis number&lt;br /&gt;
# Save the file&lt;br /&gt;
# Test after a power cycle if the C Program initializes all Axes Properly&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;C_Programming_References&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Programming References&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For general C programming references/tutorials, s&amp;lt;/span&amp;gt;ee the links listed near the bottom of [http://dynomotion.com/Support.html this page].&lt;br /&gt;
&lt;br /&gt;
For KFlop specific references, all available variables and functions are listed in the KMotionDef.h file, located within the DSP_FLOP directory at \DSP_KFLOP. An index of the available variables and functions can be found in the [[KMotionDef]] page.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;Simplest_C_Program&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Simplest C Program&amp;lt;/span&amp;gt;===&lt;br /&gt;
It is important to understand that any KFLOP C Program consists of a minimum number of parts as shown below. &lt;br /&gt;
&lt;br /&gt;
The first part is an #include statement which includes a&lt;br /&gt;
&lt;br /&gt;
definition file that defines all the functionality available in KFLOP.  The KMotionDef.h file is included with every installation to define all the functions, variables, structures, and defines available in that Version.  It is located in the DSP_KFLOP subdirectory of the installation.  Open it with the KMotion.exe C Programs Screen to see what's available.&lt;br /&gt;
&lt;br /&gt;
The next part is the &amp;quot;main&amp;quot; function. This is where execution of the program will actually begin. &lt;br /&gt;
&lt;br /&gt;
The last part is the code that is to be executed and belongs to the main function.  Curly brackets { } define the beginning and end of the function.  This example contains only one print statement to be executed. Note how the code within the curly brackets is indented (using a tab or spaces) to show that it belongs to the main function block.  This indentation is not required but helps readers see the program structure.  Instructions must end with a semicolon ';'.   Double forward slashes allow comments to be added at the end of an instruction.  The include statement has a # symbol in front of it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;KMotionDef.h&amp;quot;&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
    printf(&amp;quot;Hello World!\n&amp;quot;);  // send message to console&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;C Curly Brackets&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;C Curly Brackets {  }&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Often is is necessary to group a number of individual C instructions into a group of instructions that can then be treated as a single instruction.  The name given to this is a &amp;quot;Block&amp;quot; of instructions.  The beginning and end of the block are marked with Curly Brackets.  Some other programming languages use the words &amp;quot;begin&amp;quot; and &amp;quot;end&amp;quot; for this purpose.  C Language uses { } brackets.  Here is an example of 3 instructions (2 arithmetic assignment instructions and a function call instruction) grouped into a Block:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;{&lt;br /&gt;
    X = 1 + 1;&lt;br /&gt;
    Y = X + 1;&lt;br /&gt;
    Move(1,100);&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The begin curly bracket and end curly bracket mark the beginning and end of the block. Notice the curly brackets are on separate lines and we indent the instructions in the block by 4 spaces (or a tab) to make it easy to read, to be able to easily see where the blocks begin and end, and to easily see which end bracket matches with which beginning bracket.&lt;br /&gt;
&lt;br /&gt;
This style doesn't matter to the compiler. The code written below would produce exactly the same result:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;              {X = 1 + 1; Y = X + 1;&lt;br /&gt;
    Move(1,100);&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But please take the time to format your code properly to make it easier to read and help yourself avoid bugs. The Microsoft Visual Studio Editor has a nice feature to automatically format C Code. See the Edit | Advanced | Format Document option.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt; By default most C operations (like if/else, for loops, while loops, functions, etc ) target a single instruction.  Take for example an &amp;quot;if&amp;quot; statement.  If the condition is true the next single instruction only will be executed and if the condition is not true then the next single instruction will be skipped.  Here is an example:&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;if (condition)&lt;br /&gt;
    X = 2;&lt;br /&gt;
Y = X + 1;&amp;lt;/pre&amp;gt;&lt;br /&gt;
In this case only the X = 2 is the only instruction that is part of the &amp;quot;if&amp;quot;.  The Y = X + 1 instruction will always be executed.  This is true regardless of how the lines are indented or formatted.&lt;br /&gt;
&lt;br /&gt;
If our desire is to have both instructions to be part of the if condition then it is necessary to put the two instructions in a block like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;if (condition)&lt;br /&gt;
{&lt;br /&gt;
    X = 2;&lt;br /&gt;
    Y = X + 1;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: You can use our Code Indent and Beautifier in our latest Test Version 4.35a. See detailed [http://www.dynomotion.com/Help/ProgramScreen/ShowContextMenu.htm help] or our [https://www.youtube.com/watch?v=CsIijoLMq8U C Code Indent and Code Beautifier video].&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;C Variables&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;C Variables&amp;lt;/span&amp;gt;===&lt;br /&gt;
C Programs can declare and use various types of variables.  Variables are used to store information.  A variable '''must be declared''' to tell the compiler what type it is '''before''' it can be used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3 common types of variables are:&lt;br /&gt;
&lt;br /&gt;
'''int''' - 32 bit signed integer (whole numbers only)&lt;br /&gt;
&lt;br /&gt;
'''float''' - 32 bit floating point number (~7 digits of precision)&lt;br /&gt;
&lt;br /&gt;
'''double''' - 64 bit floating point number (~16 digits of precision)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Variables can be declared to be '''local''' or '''global'''. &amp;quot;Local&amp;quot; variables are declared inside of any function (including main).  Their &amp;quot;scope&amp;quot; is limited to the function they are declared within.  They are allocated into stack memory and are created when the function is entered and discarded when the function exits.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Add function below declares a local variable c as an integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;// Example to add 2 integer numbers&lt;br /&gt;
void Add(int a, int b)&lt;br /&gt;
{&lt;br /&gt;
    int c;  // declare a local integer variable&lt;br /&gt;
&lt;br /&gt;
    c = a + b;  // add the integer numbers&lt;br /&gt;
    printf(&amp;quot;sum = %d\n&amp;quot;, c);  // print the sum&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Global&amp;quot; variables are declared outside of any function usually toward the beginning of the program after any included files. Their &amp;quot;scope&amp;quot; is the entire C Program. They are allocated into static memory and are created when the Program begins and discarded when the Program exits.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code below declares a global integer variable c outside the Add Function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;int c;  // declare a global integer variable&lt;br /&gt;
&lt;br /&gt;
// Example to add 2 integer numbers&lt;br /&gt;
void Add(int a, int b)&lt;br /&gt;
{&lt;br /&gt;
    c = a + b;  // add the integer numbers&lt;br /&gt;
    printf(&amp;quot;sum = %d\n&amp;quot;, c);  // print the sum&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantage of Local variables is that the same name can be used in different functions for different purposes without conflict.&lt;br /&gt;
&lt;br /&gt;
The advantage of Global variables is that the value persists for the life of the program and the scope of the entire program and so its value can be read/written from multiple functions or multiple executions of the same function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;C Functions&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;C Functions (Subroutines)&amp;lt;/span&amp;gt;===&lt;br /&gt;
A C Function is a list of C instructions than can be called to execute from other places in a C Program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;// define function to Enable, Move, and wait with two parameters&lt;br /&gt;
void EnableMoveWait(int Axis, double dist)&lt;br /&gt;
{&lt;br /&gt;
    EnableAxis(Axis);  // enable the Axis&lt;br /&gt;
    Move(Axis,dist);  // move the Axis&lt;br /&gt;
    while (!CheckDone(Axis))  ;  // wait until done moving&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be useful to simply group the instructions together as a single operation to make a program more understandable. Furthermore it can be useful if the same operations need to be performed multiple places in a program to avoid repeating all the instructions multiple times. Instead of repeating the same block of instructions multiple places the block of instructions is formed into a function with a name and then the function can be &amp;quot;called&amp;quot; from multiple places in the program.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A Function can also have &amp;quot;parameters&amp;quot;. This is useful when the group of instructions that might occur at different places in the program are not exactly the same but only very similar. The parameters can be used to allow the caller to substitute values in the function so the same function can be used in different circumstances. The number of parameters and type of each parameter must be defined in the function. Although parameter types can be anything they are most commonly: Integers (int), Single precision floating point numbers (float), double precision floating point numbers (double), or character strings (char *).&lt;br /&gt;
&lt;br /&gt;
void EnableMoveWait(&amp;lt;span style=&amp;quot;color: #ff0000;&amp;quot;&amp;gt;'''int Axis, double dist'''&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A Function may have a return value. Some other programming languages (ie Basic) have Subroutines and Sub Functions that are declared in different ways. A Subroutine is a list of instructions. A Sub Function is a list of instructions that also returns a value. The C language treats both the same as Functions. If nothing needs to be returned by the function then the return type can be specified as &amp;quot;void&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: #ff0000;&amp;quot;&amp;gt;'''void'''&amp;lt;/span&amp;gt; EnableMoveWait(int Axis, double dist)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If a function doesn't require any parameters the parameter list should be specified as &amp;quot;void&amp;quot;.  A common mistake is specify nothing for the parameter list.  This is telling the compiler to accept any parameters and is usually not desirable.  A function with no parameters and no return value should be specified as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: #ff0000;&amp;quot;&amp;gt;'''void'''&amp;lt;/span&amp;gt; SomeFunction(&amp;lt;span style=&amp;quot;color: #ff0000;&amp;quot;&amp;gt;'''void'''&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is a special function called &amp;quot;main&amp;quot;. This is the most top level of the C Program and is the function that is first called when the C Program begins.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a program with duplicated code. It performs the same 3 similar operations on 3 different axes to Enable, Move, and Wait an Axis. Notice the same operations are performed each time with only two differences: the Axis and the distance moved. So by using a function with two parameters we can replace the 3 instructions with a single function call. The first parameter is which Axis which is an integer value. The second parameter is the distance to move which is a double precision value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;KMotionDef.h&amp;quot;&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
    EnableAxis(0);  // enable the Axis&lt;br /&gt;
    Move(0,1000.0);  // move the Axis&lt;br /&gt;
    while (!CheckDone(0))  ;  // wait until done moving&lt;br /&gt;
    &lt;br /&gt;
    EnableAxis(1);  // enable the Axis&lt;br /&gt;
    Move(1,2000.0);  // move the Axis&lt;br /&gt;
    while (!CheckDone(1))  ;  // wait until done moving&lt;br /&gt;
    &lt;br /&gt;
    EnableAxis(2);  // enable the Axis&lt;br /&gt;
    Move(1,-3000.0);  // move the Axis&lt;br /&gt;
    while (!CheckDone(2))  ;  // wait until done moving&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now declaring a function named EnableMoveWait with 2 parameters (and void return value) we can simplify the C Program, lessen the number of total instructions in the program, and most importantly guarantee that the exact same operations are performed for each axis.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;KMotionDef.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// define function to Enable, Move, and wait with two parameters&lt;br /&gt;
void EnableMoveWait(int Axis, double dist)&lt;br /&gt;
{&lt;br /&gt;
    EnableAxis(Axis);  // enable the Axis&lt;br /&gt;
    Move(Axis,dist);  // move the Axis&lt;br /&gt;
    while (!CheckDone(Axis))  ;  // wait until done moving&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
    EnableMoveWait(0, 1000.0);  // call function for Axis 0&lt;br /&gt;
    EnableMoveWait(1, 2000.0);  // call function for Axis 1&lt;br /&gt;
    EnableMoveWait(2,-3000.0);  // call function for Axis 2&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is often desirable to place the functions toward the end of file with the main starting point of the program toward the beginning. This tends to make the program more readable and logical. This is not necessary but more a personal preference. Because the C Compiler only reads the program one time from beginning to end it is good to place at the beginning a description of any Functions that exist in the program. The allows the compiler to know the names of any functions and what parameter and return value types they have before they are used in the program. It is critical that the parameters passed in the call to the function are the exact correct number and type that are defined to be used by the function itself. So to inform the compiler of what function to expect a &amp;quot;function prototype&amp;quot; is specified. This is exactly the same as the function declaration itself except with no body of instructions. It consists of only one line followed by a semicolon to indicate it is only a prototype and not the entire function. See the Program below that has the function moved below the main function and with a function prototype at the beginning:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;KMotionDef.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// define function prototype of function to expect later&lt;br /&gt;
void EnableMoveWait(int Axis, double dist);&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
    EnableMoveWait(0, 1000.0);  // call function for Axis 0&lt;br /&gt;
    EnableMoveWait(1, 2000.0);  // call function for Axis 1&lt;br /&gt;
    EnableMoveWait(2,-3000.0);  // call function for Axis 2&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// define function to Enable, Move, and wait with two parameters&lt;br /&gt;
void EnableMoveWait(int Axis, double dist)&lt;br /&gt;
{&lt;br /&gt;
    EnableAxis(Axis);  // enable the Axis&lt;br /&gt;
    Move(Axis,dist);  // move the Axis&lt;br /&gt;
    while (!CheckDone(Axis))  ;  // wait until done moving&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final C Program shown below with annotations&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleFunction.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;Basic_Disk_Read.2FWrite&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Basic Disk Read/Write&amp;lt;/span&amp;gt;===&lt;br /&gt;
KFLOP has no file system on its own, but when connected to a PC with a PC App running it can do basic Disk Read or Write Operation.  Read capability was recently added in Version 4.33q.  There isn't any PC Keyboard access (getchar()).  See the KmotionDef.h file for supported functions:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Note: standard C language printf &amp;lt;br /&amp;gt;int printf(const char *format, ...);             // Print formatted string to console&amp;lt;br /&amp;gt;int sprintf(char *s, const char *format, ...);     // Print formatted string to string&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;typedef int FILE;&amp;lt;br /&amp;gt;FILE *fopen(const char*, const char*);           // Open a text file for writing on the PC (2nd param = &amp;quot;rt&amp;quot; or &amp;quot;wt&amp;quot;) &amp;lt;br /&amp;gt;int fprintf(FILE *f, const char * format, ...);           // Print formatted string to the PC's Disk File&amp;lt;br /&amp;gt;int fclose(FILE *f);                           // Close the disk file on the PC&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;int Print(char *s);                              // Print a string to the console window&amp;lt;br /&amp;gt;int PrintFloat(char *Format, double v);          // Print a double using printf format, ex &amp;quot;%8.3f\n&amp;quot;&amp;lt;br /&amp;gt;int PrintInt(char *Format, int v);               // Print an integer using printf format, ex &amp;quot;result=%4d\n&amp;quot;&amp;lt;br /&amp;gt;                                &amp;lt;br /&amp;gt;int sscanf(const char *_str, const char *_fmt, ...); //scan string and convert to values &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;#define MAX_READ_DISK_LENGTH 1024 // max allowed length of disk file line length&amp;lt;br /&amp;gt;extern volatile int read_disk_buffer_status; //status of read disk buffer 1=line available, 2=error, 3=eof &amp;lt;br /&amp;gt;extern char read_disk_buffer[MAX_READ_DISK_LENGTH+1];&amp;lt;br /&amp;gt;char *fgets(char *str, int n, FILE *file); //read string from PC disk file, str=buffer, n=buffer length, f=FILE pointer, returns NULL on error&amp;lt;br /&amp;gt;int fscanf(FILE *f, const char *format, ...); //read sting from PC Disk file, convert values, returns number of items converted&amp;lt;br /&amp;gt;int feof(FILE *f);   // End of file status for disk reading&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;Simple_DiskReadWrite.c_example&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Simple DiskReadWrite.c example&amp;lt;/span&amp;gt;===&lt;br /&gt;
include &amp;quot;KMotionDef.h&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;main()&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;    FILE *f;&amp;lt;br /&amp;gt;    char s[256];&amp;lt;br /&amp;gt;    double a=123.456,b=999.999,c=0.001;&amp;lt;br /&amp;gt;    double x=0,y=0,z=0;&amp;lt;br /&amp;gt;    int result;&amp;lt;br /&amp;gt;    &amp;lt;br /&amp;gt;    // write 3 comma separated values to a disk file&amp;lt;br /&amp;gt;    f=fopen(&amp;quot;c:\\Temp\\KFlopData.txt&amp;quot;,&amp;quot;wt&amp;quot;);&amp;lt;br /&amp;gt;    fprintf(s,&amp;quot;%f,%f,%f\n&amp;quot;,a,b,c);&amp;lt;br /&amp;gt;    fclose(f);&amp;lt;br /&amp;gt;    &amp;lt;br /&amp;gt;    // read them back in&amp;lt;br /&amp;gt;    f=fopen(&amp;quot;c:\\Temp\\KFlopData.txt&amp;quot;,&amp;quot;rt&amp;quot;);&amp;lt;br /&amp;gt;    if (!f)&amp;lt;br /&amp;gt;    {&amp;lt;br /&amp;gt;        printf(&amp;quot;Unable to open file\n&amp;quot;);&amp;lt;br /&amp;gt;        return;&amp;lt;br /&amp;gt;    }&amp;lt;br /&amp;gt;    &amp;lt;br /&amp;gt;    // read a line and convert 3 doubles&amp;lt;br /&amp;gt;    result=fscanf(f,&amp;quot;%lf,%lf,%lf&amp;quot;,&amp;amp;x,&amp;amp;y,&amp;amp;z);&amp;lt;br /&amp;gt;    fclose(f);&amp;lt;br /&amp;gt;    &amp;lt;br /&amp;gt;    printf(&amp;quot;# values converted = %d, x=%f, y=%f, z=%f\n&amp;quot;,result,x,y,z);&amp;lt;br /&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Data/Motion Capture with a C Program==&lt;br /&gt;
A C Program can be used to capture real-time data to KFLOP's gather buffer, then upload the data to a PC Disk File, and then be analyzed using a PC App such as Microsoft Excel. This can be a very powerful method used to troubleshoot problems such as those involving complex GCode trajectories. See the many Capture examples (Whose names begin with &amp;quot;Capture&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Here is a [https://www.dynomotion.com/wiki/index.php?action=ajax&amp;amp;title=-&amp;amp;rs=SecureFileStore::getFile&amp;amp;f=/4/44/CaptureXYZMotionToFileWithHeader.c CaptureXYZMotionToFileWithHeader.c] example which captures the xyz trajectory:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;KMotionDef.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#define N 5000&lt;br /&gt;
&lt;br /&gt;
extern double CS0_TimeExecuted;&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
    int i,k;&lt;br /&gt;
    double X0,Y0,Z0,T0,*p=gather_buffer;&lt;br /&gt;
&lt;br /&gt;
    CS0_TimeExecuted=0.0;	&lt;br /&gt;
    while (CS0_TimeExecuted==0.0) ;	// wait till we Start&lt;br /&gt;
&lt;br /&gt;
    *p++ = 0.0;&lt;br /&gt;
    X0 = *p++ = ch0-&amp;gt;Dest;&lt;br /&gt;
    Y0 = *p++ = ch1-&amp;gt;Dest;&lt;br /&gt;
    Z0 = *p++ = ch2-&amp;gt;Dest;&lt;br /&gt;
    &lt;br /&gt;
    T0 = Time_sec();&lt;br /&gt;
&lt;br /&gt;
    // Capture Data&lt;br /&gt;
    &lt;br /&gt;
    for (i=0; i&amp;lt;N-1; i++)&lt;br /&gt;
    {&lt;br /&gt;
        for (k=0; k&amp;lt;2; k++)	WaitNextTimeSlice();                *p++ = Time_sec() - T0;        *p++ = ch0-&amp;gt;Dest;&lt;br /&gt;
        *p++ = ch1-&amp;gt;Dest;&lt;br /&gt;
        *p++ = ch2-&amp;gt;Dest;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    p=gather_buffer;&lt;br /&gt;
&lt;br /&gt;
    FILE *f=fopen(&amp;quot;C:\\temp\\kflopdata.txt&amp;quot;,&amp;quot;wt&amp;quot;);&lt;br /&gt;
    fprintf(f,&amp;quot;T,X,Y,Z\n&amp;quot;);  // Header&lt;br /&gt;
    for (i=0; i&amp;lt;N; i++)&lt;br /&gt;
    {&lt;br /&gt;
        // round times to nearest servo tick&lt;br /&gt;
        &lt;br /&gt;
        p[0] = ((int)(p[0]/TIMEBASE + 0.5))*TIMEBASE;&lt;br /&gt;
        fprintf(f,&amp;quot;%16.9f,%16.6f,%16.6f,%16.6f\n&amp;quot;,p[0],p[1],p[2],p[3]);&lt;br /&gt;
        p += 4;&lt;br /&gt;
    }&lt;br /&gt;
    fclose(f);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the data is written to the file C:\temp\kflopdata.txt.  So the folder C:\temp must exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note double backslashes are used in C Programs to insert a single slash as a slash operates as a means of inserting special characters such as the newline character \n.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
N determines how many samples are saved.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The gather_buffer is 8MBytes so is limited to 1 million doubles.  This program captures 4 doubles per sample x 5000 samples = 20000 doubles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 2 in this line sets the number of Time Slices occur between samples.  The number must be 1 or more.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;        for (k=0; k&amp;lt;2; k++)	WaitNextTimeSlice();   &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The C Program can be assigned to an MCode so it can be executed from GCode&lt;br /&gt;
&lt;br /&gt;
[[File:M100_Capture.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This GCode Executes the C Program then moves in a square&lt;br /&gt;
&lt;br /&gt;
'''M100 (Trigger Capture)'''&amp;lt;br /&amp;gt;'''G4 P0.1 (Wait till loaded)'''&amp;lt;br /&amp;gt;'''G0 G20 X0 Y0 Z0'''&amp;lt;br /&amp;gt;'''F100'''&amp;lt;br /&amp;gt;'''G1 X0 Y1'''&amp;lt;br /&amp;gt;'''G1 X1 Y1'''&amp;lt;br /&amp;gt;'''G1 X1 Y0'''&amp;lt;br /&amp;gt;'''G1 X0 Y0'''&amp;lt;br /&amp;gt;'''M2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an example Microsoft Excel spreadsheet to Import (refresh) the data from a file, compute velocities and acceleration from the time/posistions, and chart the data.&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/wiki/index.php?action=ajax&amp;amp;title=-&amp;amp;rs=SecureFileStore::getFile&amp;amp;f=/b/b6/PlotCaptureXYZwithHeader.xlsx PlotCaptureXYZwithHeader.xlsx]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of charted data&lt;br /&gt;
&lt;br /&gt;
[[File:XY_Vel_plot_example_from_Excel.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Global Persist Variables==&lt;br /&gt;
KFLOP contains a global array of 200 32-bit integer variables that can be used to save values from one program execution to the next or to share values between Threads or Programs.  The values default to zero on KFLOP Power up but if the variables are changed and Flash User Data is performed to KFLOP the values will persist after the next power cycle.  From C the values can be accessed as (where xxx is a number 0-199):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
persist.UserData[xxx]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
32-bit Floating point variables can be read or written to the variables using casting.  The technique to avoid a compiler conversion to integer is to take the address of the variable, cast it to a pointer to an integer, then de-reference the pointer.  The C syntax is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
persist.UserData[xxx] = *(int *) &amp;amp; my_float;&lt;br /&gt;
&lt;br /&gt;
my_float = *(float *) &amp;amp;persist.UserData[xxx];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
64-bit Floating point variables can be read or written to a pair of UserData Variables.  Using these functions (KflopToKMotionCNCFunctions.c)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
double GetUserDataDouble(int i)&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;    double d;&amp;lt;br /&amp;gt;    ((int*)(&amp;amp;d))[0] = persist.UserData[i*2];&amp;lt;br /&amp;gt;    ((int*)(&amp;amp;d))[1] = persist.UserData[i*2+1];&amp;lt;br /&amp;gt;    return d;&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;void SetUserDataDouble(int i, double v)&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;    double d=v;&amp;lt;br /&amp;gt;    persist.UserData[i*2]   = ((int*)(&amp;amp;d))[0];&amp;lt;br /&amp;gt;    persist.UserData[i*2+1] = ((int*)(&amp;amp;d))[1] ;&amp;lt;br /&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The PC can also access these variables with Console Script Commands:  [http://www.dynomotion.com/Help/Cmd.htm#SetPersistDec SetPersistDec],  [http://www.dynomotion.com/Help/Cmd.htm#GetPersistDec GetPersistDec],  [http://www.dynomotion.com/Help/Cmd.htm#SetPersistHex SetPersistHex],  [http://www.dynomotion.com/Help/Cmd.htm#GetPersistHex GetPersistHex].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For easy and fast access several persist variables are uploaded in the KFLOP Main Status Record as defined below in PC-DSP.h.  Certain PC Applications like KMotionCNC make use of these to receive commands from KFLOP to perform various actions.  The supported command codes are defined in PC-DSP.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
define PC_COMM_PERSIST 100  // First Persist Variable that is uploaded in status&amp;lt;br /&amp;gt;#define N_PC_COMM_PERSIST 8  // Number of Persist Variables that are uploaded in status&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The member variable of Main Status:&lt;br /&gt;
&lt;br /&gt;
int    PC_comm[N_PC_COMM_PERSIST];// 8 persist Variables constantly uploaded to send misc commands/data to PC&lt;br /&gt;
&lt;br /&gt;
==Threads and KMotion.exec C Programs Screen==&lt;br /&gt;
KFLOP can have multiple (1 System Program and up to 7 User ) programs loaded into memory and executing concurrently.  Each program gets a time slice of execution time on a deterministic periodic basis.  For more information see [http://dynomotion.com/Help/Multitasking.htm here]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The KMotion.exe C Programs Screen contains C Source Code Edit Windows that facilitate editing, developing, compiling, executing, and debugging C Programs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A common misconception is that the KMotion.exe Source Code Edit Windows is the same as what is currently in the KFLOP Thread Memory Spaces.  This is not necessarily the case.  If the Source Code has not been Compiled and Downloaded to the KFLOP Thread then something else may be in the KFLOP Thread Space.  KMotion.exe remembers what Programs were last loaded into the edit windows but again this is not what might be what is in KFLOP.  After all the C Programs have been developed the KMotion.exe C Programs Screen is no longer used or needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
C Source code is not downloaded to KFLOP.  Only the compiled binary executable code is downloaded to KFLOP memory.  There is no means of recovering the C Source Code from only the binary executable code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Although C Programs can be Flashed to KFLOP memory so they will be present in KFLOP Memory on Power up this is not normally recommended and not usually required.  KFLOP normally powers up with no C Programs in Memory.  Programs can be compiled, downloaded, and executed dynamically in Threads by Applications at run time. They do not need to be pre-loaded (or Flashed) into KFLOP Memory.  For example when KMotionCNC executes GCode and encounters an M3 it may download the configured C Program to the Configured Thread and execute it.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that different programs can be executed in the same Thread Space as long as they are used at different times.  If a new program is downloaded to a Thread that has a previously loaded program executing, the previous program execution is halted and then the new program is loaded into the Thread's memory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==C Program Size and Stack Limitations==&lt;br /&gt;
Each of the first 6 User Thread Memory Spaces in KFLOP are limited to 64KBytes (65536 bytes).  Kogna's Thread Spaces are 256KBytes (262,144Bytes).  Thread 7 in KFLOP is larger and limited to 5x64KBytes (327680 bytes).  Kogna's Thread 7 is 1MByte (1,048,576 bytes).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If subsequent Threads are unused it is permitted to overflow into their Thread Spaces.  For example, in KFLOP if Threads #2 and #3 are not used it is permissible to load a program of size 3 x 64KBytes (196608 bytes) into Thread #1.  If you later want to use Threads #2 or #3 then Thread #1 should be halted before using them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When compiling a message is displayed showing the Memory Usage.  The total value indicates the total amount of memory used and must fit into the allowed memory space.&lt;br /&gt;
&lt;br /&gt;
No Errors, No Warnings, text=100, bss=0, data=14, total=160&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Each User Thread Stack is located in precious single cycle (5ns) internal memory and is 2 KBytes in length.  Care should be used to limit stack usage.  Overflowing the stack will likely cause KFLOP to crash.  Local variables (defined within functions) and passed function parameters reside on the stack.  Large variables should be defined as Global Variables or in the 8 MByte [http://www.dynomotion.com/wiki/index.php?title=KFLOP_C_Programs#Gather_Buffer Gather Buffer]&lt;br /&gt;
&lt;br /&gt;
==Axis Homing and Indexing==&lt;br /&gt;
KFLOP doesn't provide any built in mechanism for homing. Instead a homing sequence can be performed in any manner desired using a KFLOP C Program. A number of examples are included. A typical sequence might be to:&lt;br /&gt;
&lt;br /&gt;
# Jog in some direction&lt;br /&gt;
# wait for an input to change&lt;br /&gt;
# stop&lt;br /&gt;
# wait until fully stopped&lt;br /&gt;
# Zero&lt;br /&gt;
&lt;br /&gt;
For standard homing the example function '''SimpleHomeIndexFunction.c''' can be used.  The example moves to a proximity sensor, optionally reverses to an Index Pulse, moves a fixed distance, then zeros the Axis.  Specify -1 for the Index Bit number if no Index pulse exists or is not desired to be used.  Below is an example call to the Function showing the parameters to be specified:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;	    result = SimpleHomeIndexFunction(2,  // axis number to home&lt;br /&gt;
        1000.0,  // speed to move toward home&lt;br /&gt;
        -1,      // direction to move toward home (+1 or -1)&lt;br /&gt;
        138, 	// limit bit number to watch for&lt;br /&gt;
        0,		// limit polarity to wait for (1 or 0)&lt;br /&gt;
        100.0,	// speed to move while searching for index&lt;br /&gt;
        -1,		// index bit number to watch for (use -1 for none)&lt;br /&gt;
        1, 		// index polarity to wait for (1 or 0)&lt;br /&gt;
        5000);	// amount to move inside limits&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example '''SimpleHomeIndexFunctionTest.c''' shows an example of homing 3 axes sequentially.&lt;br /&gt;
&lt;br /&gt;
Note that because homing is all performed in software any IO bits can be used.  Some of the documentation lists IO bits to be used but these are only suggestions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Index pulses from encoders are typically differential signals.  The differential index pulse signal can be connected to any unused A or B differential input.  Or one of the + or - differential signals can be connected to a single ended digital input.  Note that KFLOP's 3.3V inputs should not be driven hard (&amp;gt; 10ma) above 3.8V.  Most 5V differential drivers do not do this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
KFLOP User C Programs are given [http://dynomotion.com/Help/Multitasking.htm CPU Time Slices] to execute so they are guaranteed to execute on a periodic basis.  With only 1 User Thread running they are guaranteed to execute every 180us.  So any index pulse longer that this time period will never be missed.  Also with a proximity sensor the change in state will be guaranteed to be detected within this time period.&lt;br /&gt;
&lt;br /&gt;
==Gather Buffer==&lt;br /&gt;
KFLOP contains a relatively large global array (8MBytes) of 1 million double precision floating point values that can be used by C Programs.   It is often used for capturing/gathering data so it is named the gather_buffer.  KMotionCNC Step Response Screen uses this memory.  But the memory can be used for any purpose.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Gather Buffer is defined in KMotionDef.h as:&lt;br /&gt;
&lt;br /&gt;
define MAX_GATHER_DATA 1000000 // Size of gather buffer (number of doubles, 8 bytes each).                   &amp;lt;br /&amp;gt;extern double *gather_buffer;   // Large buffer for data gathering, Bode plots, or User use&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
C access syntax is '''gather_buffer[xxx]''' where xxx is in the range 0 ... 999999.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The gather_buffer pointer can be cast as other types to make use of the memory.  ie:&lt;br /&gt;
&lt;br /&gt;
int *gather_buffer_int = (int *)gather_buffer;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The PC can also access the gather buffer with Console Script Commands: &lt;br /&gt;
&lt;br /&gt;
[http://www.dynomotion.com/Help/Cmd.htm#GetGatherDec GetGatherDec]  [http://www.dynomotion.com/Help/Cmd.htm#SetGatherDec SetGatherDec]  [http://www.dynomotion.com/Help/Cmd.htm#GetGatherHex GetGatherHex]  [http://www.dynomotion.com/Help/Cmd.htm#SetGatherHex SetGatherHex]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Performing multiple Operations continually in a forever Loop==&lt;br /&gt;
It doesn't make logical sense to have more than one forever loop in a program.  That would be like saying to someone go and check if any mail arrived over and over forever and then when you are done with that go and check if someone is at the back door over and over forever.  Obviously the back door will never get around to being checked.  &amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; The solution is to create a single loop that checks two things each time through the loop.   #1 go check the mail, #2 go check the back door, # 3 repeat.   Using this technique any number of things can be continuously performed in a single loop.  &amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; There is one catch with this technique. None of the operations should &amp;quot;block&amp;quot; or take a significant amount of time to perform.  If you were to perform an operation that took a long time to complete all the other continuous operations would be blocked and go unserviced for that period of time.  If it is required to do something that takes a significant amount of time then the solution is to break it down into pieces (states) that can be each performed in an insignificant amount of time.  For example say you wish to activate a lubrication relay for 2 seconds each time a button is pushed.  Instead of delaying 2 seconds you would instead record the time the relay was turned on, then go off and do other things while frequently returning to see if it is time to turn the relay off.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is an example to cycle an IO bit continuously based on time.  Note that although this is a complete example for testing you would normally already have a forever loop in your Initialization program.  In that case only add the ServiceTimerSequence Function to your Initialization Program and add the Function call to your existing forever loop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;KMotionDef.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
void ServiceTimerSequence(void);&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
	for (;;) // loop forever&lt;br /&gt;
	{&lt;br /&gt;
		WaitNextTimeSlice(); // execute loop once every time slice&lt;br /&gt;
		ServiceTimerSequence();  // service the timer sequencing&lt;br /&gt;
	}   // end of forever loop&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// sequence an IO Bit Based on Time in a non-blocking manner&lt;br /&gt;
&lt;br /&gt;
#define TIME_ON 5.0 //seconds&lt;br /&gt;
#define CYCLE_TIME 15.0 //seconds&lt;br /&gt;
#define OUTPUT_BIT 46 // which IO bit to drive&lt;br /&gt;
void ServiceTimerSequence(void)&lt;br /&gt;
{&lt;br /&gt;
	static double T0=0.0;  // remember the last time we turned on&lt;br /&gt;
	double T=Time_sec(); // get current Time_sec&lt;br /&gt;
	&lt;br /&gt;
	if (T0==0.0 || T &amp;gt; T0 + CYCLE_TIME) T0=T;  // set start time of cycle&lt;br /&gt;
	&lt;br /&gt;
	if (T &amp;lt; T0 + TIME_ON)  // are we within the TIME_ON section of the cycle?&lt;br /&gt;
		SetBit(OUTPUT_BIT);  //yes&lt;br /&gt;
	else&lt;br /&gt;
		ClearBit(OUTPUT_BIT);  //no&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Common C Programming Mistakes==&lt;br /&gt;
A common programming mistake is to forget to add the '()' for a function call.  It might not be obvious why this isn't flagged as an error.  In some programming languages such as Basic a subroutine with no parameters can be called by coding the name with no parenthesis.  In C the name of a function represents the address of the function. Adding the () is required to make a function call to that address.&lt;br /&gt;
&lt;br /&gt;
Furthermore in C any valid expression is allowed. For example:&lt;br /&gt;
&lt;br /&gt;
2+2;&lt;br /&gt;
&lt;br /&gt;
is a valid C expression. The compiler computes 4 and does nothing with it (sometimes computing things have side effects and therefore have purpose).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2;&lt;br /&gt;
&lt;br /&gt;
is a valid C expression. The compiler computes 2 and does nothing with it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ClearStopImmediately;&lt;br /&gt;
&lt;br /&gt;
is a valid expression. The compiler computes the address of the function ClearStopImmediately and does nothing with it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' You can use our Code Validator in our latest Test Version 4.35a. See detailed [http://www.dynomotion.com/Help/ProgramScreen/ShowContextMenu.htm help] or our [https://www.youtube.com/watch?v=N2KSdYuag1U Validate C Programs video].&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/KFLOP_C_Programs</id>
		<title>KFLOP C Programs</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/KFLOP_C_Programs"/>
				<updated>2024-11-09T17:17:42Z</updated>
		
		<summary type="html">&lt;p&gt;TK: /* Axis Homing and Indexing */  fix typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;C Programs provide a powerful and flexible capability to perform almost any sequence of operations within KFLOP.   In most cases after you have tested and tuned all your hardware using the KMotion.exe setup program all the settings and initialization steps required for your system can be placed into an Initialization C Program so that your system can be fully initialized simply by executing the Initialization program.   Using a C Program offers full flexibility to initialize your system however and in whatever order you wish.  In most common cases an existing example can be used with simple modification of values specific to your system.  The KMotion.exe Setup program has some [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Utilities automatic capability] to translate the Axes Screen Values that were determined by you during configuration and testing into C Code.&lt;br /&gt;
&lt;br /&gt;
===Initialization C Program===&lt;br /&gt;
The Initialization C Program will normally perform operations of the following type:&lt;br /&gt;
&lt;br /&gt;
* Enable/define any Option boards present (ie.    KStepPresent=TRUE;      // enable KSTEP input multiplexing)&lt;br /&gt;
* The setting of Axes parameters (ie.    ch0-&amp;gt;Accel=200000; )&lt;br /&gt;
* Enable Axes (ie.EnableAxisDest(0,0); )&lt;br /&gt;
* Define the Coordinated Motion Axes (ie.    DefineCoordSystem(0,1,2,-1);  // define axes for XYZ&lt;br /&gt;
* Forever Loop to service any continuous requirements such as MPG, External Buttons, EStop, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;Adding_the_configuration_for_a_new_Axis_to_your_Initialization_C_Program:&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Adding the configuration for a new Axis to your Initialization C Program:&amp;lt;/span&amp;gt;===&lt;br /&gt;
# Configure the Channel in KMotion.exe and verify that after Pushing &amp;quot;Enable&amp;quot; (which downloads and enables) it all works properly&lt;br /&gt;
# On the Config/Flash Screen Push the &amp;quot;C Code To Clip Board&amp;quot; Button&lt;br /&gt;
# Open your Initialization Program in the C Programs Screen&lt;br /&gt;
# Position the cursor after the previous Axis settings&lt;br /&gt;
# Right Mouse Click &amp;quot;Paste&amp;quot;&lt;br /&gt;
# If desired also enable the axis by inserting EnableAxisDest(xx,0); where xx is the Axis number&lt;br /&gt;
# Save the file&lt;br /&gt;
# Test after a power cycle if the C Program initializes all Axes Properly&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;C_Programming_References&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Programming References&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For general C programming references/tutorials, s&amp;lt;/span&amp;gt;ee the links listed near the bottom of [http://dynomotion.com/Support.html this page].&lt;br /&gt;
&lt;br /&gt;
For KFlop specific references, all available variables and functions are listed in the KMotionDef.h file, located within the DSP_FLOP directory at \DSP_KFLOP. An index of the available variables and functions can be found in the [[KMotionDef]] page.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;Simplest_C_Program&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Simplest C Program&amp;lt;/span&amp;gt;===&lt;br /&gt;
It is important to understand that any KFLOP C Program consists of a minimum number of parts as shown below. &lt;br /&gt;
&lt;br /&gt;
The first part is an #include statement which includes a&lt;br /&gt;
&lt;br /&gt;
definition file that defines all the functionality available in KFLOP.  The KMotionDef.h file is included with every installation to define all the functions, variables, structures, and defines available in that Version.  It is located in the DSP_KFLOP subdirectory of the installation.  Open it with the KMotion.exe C Programs Screen to see what's available.&lt;br /&gt;
&lt;br /&gt;
The next part is the &amp;quot;main&amp;quot; function. This is where execution of the program will actually begin. &lt;br /&gt;
&lt;br /&gt;
The last part is the code that is to be executed and belongs to the main function.  Curly brackets { } define the beginning and end of the function.  This example contains only one print statement to be executed. Note how the code within the curly brackets is indented (using a tab or spaces) to show that it belongs to the main function block.  This indentation is not required but helps readers see the program structure.  Instructions must end with a semicolon ';'.   Double forward slashes allow comments to be added at the end of an instruction.  The include statement has a # symbol in front of it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;KMotionDef.h&amp;quot;&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
    printf(&amp;quot;Hello World!\n&amp;quot;);  // send message to console&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;C Curly Brackets&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;C Curly Brackets {  }&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Often is is necessary to group a number of individual C instructions into a group of instructions that can then be treated as a single instruction.  The name given to this is a &amp;quot;Block&amp;quot; of instructions.  The beginning and end of the block are marked with Curly Brackets.  Some other programming languages use the words &amp;quot;begin&amp;quot; and &amp;quot;end&amp;quot; for this purpose.  C Language uses { } brackets.  Here is an example of 3 instructions (2 arithmetic assignment instructions and a function call instruction) grouped into a Block:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;{&lt;br /&gt;
    X = 1 + 1;&lt;br /&gt;
    Y = X + 1;&lt;br /&gt;
    Move(1,100);&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The begin curly bracket and end curly bracket mark the beginning and end of the block. Notice the curly brackets are on separate lines and we indent the instructions in the block by 4 spaces (or a tab) to make it easy to read, to be able to easily see where the blocks begin and end, and to easily see which end bracket matches with which beginning bracket.&lt;br /&gt;
&lt;br /&gt;
This style doesn't matter to the compiler. The code written below would produce exactly the same result:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;              {X = 1 + 1; Y = X + 1;&lt;br /&gt;
    Move(1,100);&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But please take the time to format your code properly to make it easier to read and help yourself avoid bugs. The Microsoft Visual Studio Editor has a nice feature to automatically format C Code. See the Edit | Advanced | Format Document option.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt; By default most C operations (like if/else, for loops, while loops, functions, etc ) target a single instruction.  Take for example an &amp;quot;if&amp;quot; statement.  If the condition is true the next single instruction only will be executed and if the condition is not true then the next single instruction will be skipped.  Here is an example:&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;if (condition)&lt;br /&gt;
    X = 2;&lt;br /&gt;
Y = X + 1;&amp;lt;/pre&amp;gt;&lt;br /&gt;
In this case only the X = 2 is the only instruction that is part of the &amp;quot;if&amp;quot;.  The Y = X + 1 instruction will always be executed.  This is true regardless of how the lines are indented or formatted.&lt;br /&gt;
&lt;br /&gt;
If our desire is to have both instructions to be part of the if condition then it is necessary to put the two instructions in a block like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;if (condition)&lt;br /&gt;
{&lt;br /&gt;
    X = 2;&lt;br /&gt;
    Y = X + 1;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: You can use our Code Indent and Beautifier in our latest Test Version 4.35a. See detailed [http://www.dynomotion.com/Help/ProgramScreen/ShowContextMenu.htm help] or our [https://www.youtube.com/watch?v=CsIijoLMq8U C Code Indent and Code Beautifier video].&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;C Variables&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;C Variables&amp;lt;/span&amp;gt;===&lt;br /&gt;
C Programs can declare and use various types of variables.  Variables are used to store information.  A variable '''must be declared''' to tell the compiler what type it is '''before''' it can be used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3 common types of variables are:&lt;br /&gt;
&lt;br /&gt;
'''int''' - 32 bit signed integer (whole numbers only)&lt;br /&gt;
&lt;br /&gt;
'''float''' - 32 bit floating point number (~7 digits of precision)&lt;br /&gt;
&lt;br /&gt;
'''double''' - 64 bit floating point number (~16 digits of precision)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Variables can be declared to be '''local''' or '''global'''. &amp;quot;Local&amp;quot; variables are declared inside of any function (including main).  Their &amp;quot;scope&amp;quot; is limited to the function they are declared within.  They are allocated into stack memory and are created when the function is entered and discarded when the function exits.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Add function below declares a local variable c as an integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;// Example to add 2 integer numbers&lt;br /&gt;
void Add(int a, int b)&lt;br /&gt;
{&lt;br /&gt;
    int c;  // declare a local integer variable&lt;br /&gt;
&lt;br /&gt;
    c = a + b;  // add the integer numbers&lt;br /&gt;
    printf(&amp;quot;sum = %d\n&amp;quot;, c);  // print the sum&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Global&amp;quot; variables are declared outside of any function usually toward the beginning of the program after any included files. Their &amp;quot;scope&amp;quot; is the entire C Program. They are allocated into static memory and are created when the Program begins and discarded when the Program exits.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code below declares a global integer variable c outside the Add Function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;int c;  // declare a global integer variable&lt;br /&gt;
&lt;br /&gt;
// Example to add 2 integer numbers&lt;br /&gt;
void Add(int a, int b)&lt;br /&gt;
{&lt;br /&gt;
    c = a + b;  // add the integer numbers&lt;br /&gt;
    printf(&amp;quot;sum = %d\n&amp;quot;, c);  // print the sum&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantage of Local variables is that the same name can be used in different functions for different purposes without conflict.&lt;br /&gt;
&lt;br /&gt;
The advantage of Global variables is that the value persists for the life of the program and the scope of the entire program and so its value can be read/written from multiple functions or multiple executions of the same function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;C Functions&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;C Functions (Subroutines)&amp;lt;/span&amp;gt;===&lt;br /&gt;
A C Function is a list of C instructions than can be called to execute from other places in a C Program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;// define function to Enable, Move, and wait with two parameters&lt;br /&gt;
void EnableMoveWait(int Axis, double dist)&lt;br /&gt;
{&lt;br /&gt;
    EnableAxis(Axis);  // enable the Axis&lt;br /&gt;
    Move(Axis,dist);  // move the Axis&lt;br /&gt;
    while (!CheckDone(Axis))  ;  // wait until done moving&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be useful to simply group the instructions together as a single operation to make a program more understandable. Furthermore it can be useful if the same operations need to be performed multiple places in a program to avoid repeating all the instructions multiple times. Instead of repeating the same block of instructions multiple places the block of instructions is formed into a function with a name and then the function can be &amp;quot;called&amp;quot; from multiple places in the program.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A Function can also have &amp;quot;parameters&amp;quot;. This is useful when the group of instructions that might occur at different places in the program are not exactly the same but only very similar. The parameters can be used to allow the caller to substitute values in the function so the same function can be used in different circumstances. The number of parameters and type of each parameter must be defined in the function. Although parameter types can be anything they are most commonly: Integers (int), Single precision floating point numbers (float), double precision floating point numbers (double), or character strings (char *).&lt;br /&gt;
&lt;br /&gt;
void EnableMoveWait(&amp;lt;span style=&amp;quot;color: #ff0000;&amp;quot;&amp;gt;'''int Axis, double dist'''&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A Function may have a return value. Some other programming languages (ie Basic) have Subroutines and Sub Functions that are declared in different ways. A Subroutine is a list of instructions. A Sub Function is a list of instructions that also returns a value. The C language treats both the same as Functions. If nothing needs to be returned by the function then the return type can be specified as &amp;quot;void&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: #ff0000;&amp;quot;&amp;gt;'''void'''&amp;lt;/span&amp;gt; EnableMoveWait(int Axis, double dist)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If a function doesn't require any parameters the parameter list should be specified as &amp;quot;void&amp;quot;.  A common mistake is specify nothing for the parameter list.  This is telling the compiler to accept any parameters and is usually not desirable.  A function with no parameters and no return value should be specified as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: #ff0000;&amp;quot;&amp;gt;'''void'''&amp;lt;/span&amp;gt; SomeFunction(&amp;lt;span style=&amp;quot;color: #ff0000;&amp;quot;&amp;gt;'''void'''&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is a special function called &amp;quot;main&amp;quot;. This is the most top level of the C Program and is the function that is first called when the C Program begins.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a program with duplicated code. It performs the same 3 similar operations on 3 different axes to Enable, Move, and Wait an Axis. Notice the same operations are performed each time with only two differences: the Axis and the distance moved. So by using a function with two parameters we can replace the 3 instructions with a single function call. The first parameter is which Axis which is an integer value. The second parameter is the distance to move which is a double precision value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;KMotionDef.h&amp;quot;&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
    EnableAxis(0);  // enable the Axis&lt;br /&gt;
    Move(0,1000.0);  // move the Axis&lt;br /&gt;
    while (!CheckDone(0))  ;  // wait until done moving&lt;br /&gt;
    &lt;br /&gt;
    EnableAxis(1);  // enable the Axis&lt;br /&gt;
    Move(1,2000.0);  // move the Axis&lt;br /&gt;
    while (!CheckDone(1))  ;  // wait until done moving&lt;br /&gt;
    &lt;br /&gt;
    EnableAxis(2);  // enable the Axis&lt;br /&gt;
    Move(1,-3000.0);  // move the Axis&lt;br /&gt;
    while (!CheckDone(2))  ;  // wait until done moving&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now declaring a function named EnableMoveWait with 2 parameters (and void return value) we can simplify the C Program, lessen the number of total instructions in the program, and most importantly guarantee that the exact same operations are performed for each axis.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;KMotionDef.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// define function to Enable, Move, and wait with two parameters&lt;br /&gt;
void EnableMoveWait(int Axis, double dist)&lt;br /&gt;
{&lt;br /&gt;
    EnableAxis(Axis);  // enable the Axis&lt;br /&gt;
    Move(Axis,dist);  // move the Axis&lt;br /&gt;
    while (!CheckDone(Axis))  ;  // wait until done moving&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
    EnableMoveWait(0, 1000.0);  // call function for Axis 0&lt;br /&gt;
    EnableMoveWait(1, 2000.0);  // call function for Axis 1&lt;br /&gt;
    EnableMoveWait(2,-3000.0);  // call function for Axis 2&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is often desirable to place the functions toward the end of file with the main starting point of the program toward the beginning. This tends to make the program more readable and logical. This is not necessary but more a personal preference. Because the C Compiler only reads the program one time from beginning to end it is good to place at the beginning a description of any Functions that exist in the program. The allows the compiler to know the names of any functions and what parameter and return value types they have before they are used in the program. It is critical that the parameters passed in the call to the function are the exact correct number and type that are defined to be used by the function itself. So to inform the compiler of what function to expect a &amp;quot;function prototype&amp;quot; is specified. This is exactly the same as the function declaration itself except with no body of instructions. It consists of only one line followed by a semicolon to indicate it is only a prototype and not the entire function. See the Program below that has the function moved below the main function and with a function prototype at the beginning:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;KMotionDef.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// define function prototype of function to expect later&lt;br /&gt;
void EnableMoveWait(int Axis, double dist);&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
    EnableMoveWait(0, 1000.0);  // call function for Axis 0&lt;br /&gt;
    EnableMoveWait(1, 2000.0);  // call function for Axis 1&lt;br /&gt;
    EnableMoveWait(2,-3000.0);  // call function for Axis 2&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// define function to Enable, Move, and wait with two parameters&lt;br /&gt;
void EnableMoveWait(int Axis, double dist)&lt;br /&gt;
{&lt;br /&gt;
    EnableAxis(Axis);  // enable the Axis&lt;br /&gt;
    Move(Axis,dist);  // move the Axis&lt;br /&gt;
    while (!CheckDone(Axis))  ;  // wait until done moving&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final C Program shown below with annotations&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleFunction.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;Basic_Disk_Read.2FWrite&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Basic Disk Read/Write&amp;lt;/span&amp;gt;===&lt;br /&gt;
KFLOP has no file system on its own, but when connected to a PC with a PC App running it can do basic Disk Read or Write Operation.  Read capability was recently added in Version 4.33q.  There isn't any PC Keyboard access (getchar()).  See the KmotionDef.h file for supported functions:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Note: standard C language printf &amp;lt;br /&amp;gt;int printf(const char *format, ...);             // Print formatted string to console&amp;lt;br /&amp;gt;int sprintf(char *s, const char *format, ...);     // Print formatted string to string&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;typedef int FILE;&amp;lt;br /&amp;gt;FILE *fopen(const char*, const char*);           // Open a text file for writing on the PC (2nd param = &amp;quot;rt&amp;quot; or &amp;quot;wt&amp;quot;) &amp;lt;br /&amp;gt;int fprintf(FILE *f, const char * format, ...);           // Print formatted string to the PC's Disk File&amp;lt;br /&amp;gt;int fclose(FILE *f);                           // Close the disk file on the PC&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;int Print(char *s);                              // Print a string to the console window&amp;lt;br /&amp;gt;int PrintFloat(char *Format, double v);          // Print a double using printf format, ex &amp;quot;%8.3f\n&amp;quot;&amp;lt;br /&amp;gt;int PrintInt(char *Format, int v);               // Print an integer using printf format, ex &amp;quot;result=%4d\n&amp;quot;&amp;lt;br /&amp;gt;                                &amp;lt;br /&amp;gt;int sscanf(const char *_str, const char *_fmt, ...); //scan string and convert to values &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;#define MAX_READ_DISK_LENGTH 1024 // max allowed length of disk file line length&amp;lt;br /&amp;gt;extern volatile int read_disk_buffer_status; //status of read disk buffer 1=line available, 2=error, 3=eof &amp;lt;br /&amp;gt;extern char read_disk_buffer[MAX_READ_DISK_LENGTH+1];&amp;lt;br /&amp;gt;char *fgets(char *str, int n, FILE *file); //read string from PC disk file, str=buffer, n=buffer length, f=FILE pointer, returns NULL on error&amp;lt;br /&amp;gt;int fscanf(FILE *f, const char *format, ...); //read sting from PC Disk file, convert values, returns number of items converted&amp;lt;br /&amp;gt;int feof(FILE *f);   // End of file status for disk reading&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;Simple_DiskReadWrite.c_example&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Simple DiskReadWrite.c example&amp;lt;/span&amp;gt;===&lt;br /&gt;
include &amp;quot;KMotionDef.h&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;main()&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;    FILE *f;&amp;lt;br /&amp;gt;    char s[256];&amp;lt;br /&amp;gt;    double a=123.456,b=999.999,c=0.001;&amp;lt;br /&amp;gt;    double x=0,y=0,z=0;&amp;lt;br /&amp;gt;    int result;&amp;lt;br /&amp;gt;    &amp;lt;br /&amp;gt;    // write 3 comma separated values to a disk file&amp;lt;br /&amp;gt;    f=fopen(&amp;quot;c:\\Temp\\KFlopData.txt&amp;quot;,&amp;quot;wt&amp;quot;);&amp;lt;br /&amp;gt;    fprintf(s,&amp;quot;%f,%f,%f\n&amp;quot;,a,b,c);&amp;lt;br /&amp;gt;    fclose(f);&amp;lt;br /&amp;gt;    &amp;lt;br /&amp;gt;    // read them back in&amp;lt;br /&amp;gt;    f=fopen(&amp;quot;c:\\Temp\\KFlopData.txt&amp;quot;,&amp;quot;rt&amp;quot;);&amp;lt;br /&amp;gt;    if (!f)&amp;lt;br /&amp;gt;    {&amp;lt;br /&amp;gt;        printf(&amp;quot;Unable to open file\n&amp;quot;);&amp;lt;br /&amp;gt;        return;&amp;lt;br /&amp;gt;    }&amp;lt;br /&amp;gt;    &amp;lt;br /&amp;gt;    // read a line and convert 3 doubles&amp;lt;br /&amp;gt;    result=fscanf(f,&amp;quot;%lf,%lf,%lf&amp;quot;,&amp;amp;x,&amp;amp;y,&amp;amp;z);&amp;lt;br /&amp;gt;    fclose(f);&amp;lt;br /&amp;gt;    &amp;lt;br /&amp;gt;    printf(&amp;quot;# values converted = %d, x=%f, y=%f, z=%f\n&amp;quot;,result,x,y,z);&amp;lt;br /&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Data/Motion Capture with a C Program==&lt;br /&gt;
A C Program can be used to capture real-time data to KFLOP's gather buffer, then upload the data to a PC Disk File, and then be analyzed using a PC App such as Microsoft Excel. This can be a very powerful method used to troubleshoot problems such as those involving complex GCode trajectories. See the many Capture examples (Whose names begin with &amp;quot;Capture&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Here is a [https://www.dynomotion.com/wiki/index.php?action=ajax&amp;amp;title=-&amp;amp;rs=SecureFileStore::getFile&amp;amp;f=/4/44/CaptureXYZMotionToFileWithHeader.c CaptureXYZMotionToFileWithHeader.c] example which captures the xyz trajectory:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;KMotionDef.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#define N 5000&lt;br /&gt;
&lt;br /&gt;
extern double CS0_TimeExecuted;&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
    int i,k;&lt;br /&gt;
    double X0,Y0,Z0,T0,*p=gather_buffer;&lt;br /&gt;
&lt;br /&gt;
    CS0_TimeExecuted=0.0;	&lt;br /&gt;
    while (CS0_TimeExecuted==0.0) ;	// wait till we Start&lt;br /&gt;
&lt;br /&gt;
    *p++ = 0.0;&lt;br /&gt;
    X0 = *p++ = ch0-&amp;gt;Dest;&lt;br /&gt;
    Y0 = *p++ = ch1-&amp;gt;Dest;&lt;br /&gt;
    Z0 = *p++ = ch2-&amp;gt;Dest;&lt;br /&gt;
    &lt;br /&gt;
    T0 = Time_sec();&lt;br /&gt;
&lt;br /&gt;
    // Capture Data&lt;br /&gt;
    &lt;br /&gt;
    for (i=0; i&amp;lt;N-1; i++)&lt;br /&gt;
    {&lt;br /&gt;
        for (k=0; k&amp;lt;2; k++)	WaitNextTimeSlice();                *p++ = Time_sec() - T0;        *p++ = ch0-&amp;gt;Dest;&lt;br /&gt;
        *p++ = ch1-&amp;gt;Dest;&lt;br /&gt;
        *p++ = ch2-&amp;gt;Dest;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    p=gather_buffer;&lt;br /&gt;
&lt;br /&gt;
    FILE *f=fopen(&amp;quot;C:\\temp\\kflopdata.txt&amp;quot;,&amp;quot;wt&amp;quot;);&lt;br /&gt;
    fprintf(f,&amp;quot;T,X,Y,Z\n&amp;quot;);  // Header&lt;br /&gt;
    for (i=0; i&amp;lt;N; i++)&lt;br /&gt;
    {&lt;br /&gt;
        // round times to nearest servo tick&lt;br /&gt;
        &lt;br /&gt;
        p[0] = ((int)(p[0]/TIMEBASE + 0.5))*TIMEBASE;&lt;br /&gt;
        fprintf(f,&amp;quot;%16.9f,%16.6f,%16.6f,%16.6f\n&amp;quot;,p[0],p[1],p[2],p[3]);&lt;br /&gt;
        p += 4;&lt;br /&gt;
    }&lt;br /&gt;
    fclose(f);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the data is written to the file C:\temp\kflopdata.txt.  So the folder C:\temp must exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note double backslashes are used in C Programs to insert a single slash as a slash operates as a means of inserting special characters such as the newline character \n.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
N determines how many samples are saved.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The gather_buffer is 8MBytes so is limited to 1 million doubles.  This program captures 4 doubles per sample x 5000 samples = 20000 doubles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 2 in this line sets the number of Time Slices occur between samples.  The number must be 1 or more.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;        for (k=0; k&amp;lt;2; k++)	WaitNextTimeSlice();   &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The C Program can be assigned to an MCode so it can be executed from GCode&lt;br /&gt;
&lt;br /&gt;
[[File:M100_Capture.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This GCode Executes the C Program then moves in a square&lt;br /&gt;
&lt;br /&gt;
'''M100 (Trigger Capture)'''&amp;lt;br /&amp;gt;'''G4 P0.1 (Wait till loaded)'''&amp;lt;br /&amp;gt;'''G0 G20 X0 Y0 Z0'''&amp;lt;br /&amp;gt;'''F100'''&amp;lt;br /&amp;gt;'''G1 X0 Y1'''&amp;lt;br /&amp;gt;'''G1 X1 Y1'''&amp;lt;br /&amp;gt;'''G1 X1 Y0'''&amp;lt;br /&amp;gt;'''G1 X0 Y0'''&amp;lt;br /&amp;gt;'''M2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an example Microsoft Excel spreadsheet to Import (refresh) the data from a file, compute velocities and acceleration from the time/posistions, and chart the data.&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/wiki/index.php?action=ajax&amp;amp;title=-&amp;amp;rs=SecureFileStore::getFile&amp;amp;f=/b/b6/PlotCaptureXYZwithHeader.xlsx PlotCaptureXYZwithHeader.xlsx]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of charted data&lt;br /&gt;
&lt;br /&gt;
[[File:XY_Vel_plot_example_from_Excel.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Global Persist Variables==&lt;br /&gt;
KFLOP contains a global array of 200 32-bit integer variables that can be used to save values from one program execution to the next or to share values between Threads or Programs.  The values default to zero on KFLOP Power up but if the variables are changed and Flash User Data is performed to KFLOP the values will persist after the next power cycle.  From C the values can be accessed as (where xxx is a number 0-199):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
persist.UserData[xxx]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
32-bit Floating point variables can be read or written to the variables using casting.  The technique to avoid a compiler conversion to integer is to take the address of the variable, cast it to a pointer to an integer, then de-reference the pointer.  The C syntax is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
persist.UserData[xxx] = *(int *) &amp;amp; my_float;&lt;br /&gt;
&lt;br /&gt;
my_float = *(float *) &amp;amp;persist.UserData[xxx];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
64-bit Floating point variables can be read or written to a pair of UserData Variables.  Using these functions (KflopToKMotionCNCFunctions.c)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
double GetUserDataDouble(int i)&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;    double d;&amp;lt;br /&amp;gt;    ((int*)(&amp;amp;d))[0] = persist.UserData[i*2];&amp;lt;br /&amp;gt;    ((int*)(&amp;amp;d))[1] = persist.UserData[i*2+1];&amp;lt;br /&amp;gt;    return d;&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;void SetUserDataDouble(int i, double v)&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;    double d=v;&amp;lt;br /&amp;gt;    persist.UserData[i*2]   = ((int*)(&amp;amp;d))[0];&amp;lt;br /&amp;gt;    persist.UserData[i*2+1] = ((int*)(&amp;amp;d))[1] ;&amp;lt;br /&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The PC can also access these variables with Console Script Commands:  [http://www.dynomotion.com/Help/Cmd.htm#SetPersistDec SetPersistDec],  [http://www.dynomotion.com/Help/Cmd.htm#GetPersistDec GetPersistDec],  [http://www.dynomotion.com/Help/Cmd.htm#SetPersistHex SetPersistHex],  [http://www.dynomotion.com/Help/Cmd.htm#GetPersistHex GetPersistHex].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For easy and fast access several persist variables are uploaded in the KFLOP Main Status Record as defined below in PC-DSP.h.  Certain PC Applications like KMotionCNC make use of these to receive commands from KFLOP to perform various actions.  The supported command codes are defined in PC-DSP.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
define PC_COMM_PERSIST 100  // First Persist Variable that is uploaded in status&amp;lt;br /&amp;gt;#define N_PC_COMM_PERSIST 8  // Number of Persist Variables that are uploaded in status&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The member variable of Main Status:&lt;br /&gt;
&lt;br /&gt;
int    PC_comm[N_PC_COMM_PERSIST];// 8 persist Variables constantly uploaded to send misc commands/data to PC&lt;br /&gt;
&lt;br /&gt;
==Threads and KMotion.exec C Programs Screen==&lt;br /&gt;
KFLOP can have multiple (1 System Program and up to 7 User ) programs loaded into memory and executing concurrently.  Each program gets a time slice of execution time on a deterministic periodic basis.  For more information see [http://dynomotion.com/Help/Multitasking.htm here]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The KMotion.exe C Programs Screen contains C Source Code Edit Windows that facilitate editing, developing, compiling, executing, and debugging C Programs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A common misconception is that the KMotion.exe Source Code Edit Windows is the same as what is currently in the KFLOP Thread Memory Spaces.  This is not necessarily the case.  If the Source Code has not been Compiled and Downloaded to the KFLOP Thread then something else may be in the KFLOP Thread Space.  KMotion.exe remembers what Programs were last loaded into the edit windows but again this is not what might be what is in KFLOP.  After all the C Programs have been developed the KMotion.exe C Programs Screen is no longer used or needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
C Source code is not downloaded to KFLOP.  Only the compiled binary executable code is downloaded to KFLOP memory.  There is no means of recovering the C Source Code from only the binary executable code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Although C Programs can be Flashed to KFLOP memory so they will be present in KFLOP Memory on Power up this is not normally recommended and not usually required.  KFLOP normally powers up with no C Programs in Memory.  Programs can be compiled, downloaded, and executed dynamically in Threads by Applications at run time. They do not need to be pre-loaded (or Flashed) into KFLOP Memory.  For example when KMotionCNC executes GCode and encounters an M3 it may download the configured C Program to the Configured Thread and execute it.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that different programs can be executed in the same Thread Space as long as they are used at different times.  If a new program is downloaded to a Thread that has a previously loaded program executing, the previous program execution is halted and then the new program is loaded into the Thread's memory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==C Program Size and Stack Limitations==&lt;br /&gt;
Each of the first 6 User Thread Memory Spaces are limited to 64KBytes (65536 Bytes).  Thread 7 is larger and limited to 5x64KBytes (327680Bytes).&lt;br /&gt;
&lt;br /&gt;
If subsequent Threads are unused it is permitted to overflow into their Thread Spaces.  For example, if Threads #2 and #3 are not used is permissible to load a program of size 3 x 64KBytes (196608 bytes) into Thread #1.  If you later want to use Threads #2 or #3 then Thread #1 should be halted before using them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When compiling a message is displayed showing the Memory Usage.  The total value indicates the total amount of memory used and must fit into the allowed memory space.&lt;br /&gt;
&lt;br /&gt;
No Errors, No Warnings, text=100, bss=0, data=14, total=160&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Each User Thread Stack is located in precious single cycle (5ns) internal memory and is 2 KBytes in length.  Care should be used to limit stack usage.  Overflowing the stack will likely cause KFLOP to crash.  Local variables (defined within functions) and passed function parameters reside on the stack.  Large variables should be defined as Global Variables or in the 8 MByte [http://www.dynomotion.com/wiki/index.php?title=KFLOP_C_Programs#Gather_Buffer Gather Buffer]&lt;br /&gt;
&lt;br /&gt;
==Axis Homing and Indexing==&lt;br /&gt;
KFLOP doesn't provide any built in mechanism for homing. Instead a homing sequence can be performed in any manner desired using a KFLOP C Program. A number of examples are included. A typical sequence might be to:&lt;br /&gt;
&lt;br /&gt;
# Jog in some direction&lt;br /&gt;
# wait for an input to change&lt;br /&gt;
# stop&lt;br /&gt;
# wait until fully stopped&lt;br /&gt;
# Zero&lt;br /&gt;
&lt;br /&gt;
For standard homing the example function '''SimpleHomeIndexFunction.c''' can be used.  The example moves to a proximity sensor, optionally reverses to an Index Pulse, moves a fixed distance, then zeros the Axis.  Specify -1 for the Index Bit number if no Index pulse exists or is not desired to be used.  Below is an example call to the Function showing the parameters to be specified:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;	    result = SimpleHomeIndexFunction(2,  // axis number to home&lt;br /&gt;
        1000.0,  // speed to move toward home&lt;br /&gt;
        -1,      // direction to move toward home (+1 or -1)&lt;br /&gt;
        138, 	// limit bit number to watch for&lt;br /&gt;
        0,		// limit polarity to wait for (1 or 0)&lt;br /&gt;
        100.0,	// speed to move while searching for index&lt;br /&gt;
        -1,		// index bit number to watch for (use -1 for none)&lt;br /&gt;
        1, 		// index polarity to wait for (1 or 0)&lt;br /&gt;
        5000);	// amount to move inside limits&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example '''SimpleHomeIndexFunctionTest.c''' shows an example of homing 3 axes sequentially.&lt;br /&gt;
&lt;br /&gt;
Note that because homing is all performed in software any IO bits can be used.  Some of the documentation lists IO bits to be used but these are only suggestions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Index pulses from encoders are typically differential signals.  The differential index pulse signal can be connected to any unused A or B differential input.  Or one of the + or - differential signals can be connected to a single ended digital input.  Note that KFLOP's 3.3V inputs should not be driven hard (&amp;gt; 10ma) above 3.8V.  Most 5V differential drivers do not do this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
KFLOP User C Programs are given [http://dynomotion.com/Help/Multitasking.htm CPU Time Slices] to execute so they are guaranteed to execute on a periodic basis.  With only 1 User Thread running they are guaranteed to execute every 180us.  So any index pulse longer that this time period will never be missed.  Also with a proximity sensor the change in state will be guaranteed to be detected within this time period.&lt;br /&gt;
&lt;br /&gt;
==Gather Buffer==&lt;br /&gt;
KFLOP contains a relatively large global array (8MBytes) of 1 million double precision floating point values that can be used by C Programs.   It is often used for capturing/gathering data so it is named the gather_buffer.  KMotionCNC Step Response Screen uses this memory.  But the memory can be used for any purpose.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Gather Buffer is defined in KMotionDef.h as:&lt;br /&gt;
&lt;br /&gt;
define MAX_GATHER_DATA 1000000 // Size of gather buffer (number of doubles, 8 bytes each).                   &amp;lt;br /&amp;gt;extern double *gather_buffer;   // Large buffer for data gathering, Bode plots, or User use&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
C access syntax is '''gather_buffer[xxx]''' where xxx is in the range 0 ... 999999.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The gather_buffer pointer can be cast as other types to make use of the memory.  ie:&lt;br /&gt;
&lt;br /&gt;
int *gather_buffer_int = (int *)gather_buffer;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The PC can also access the gather buffer with Console Script Commands: &lt;br /&gt;
&lt;br /&gt;
[http://www.dynomotion.com/Help/Cmd.htm#GetGatherDec GetGatherDec]  [http://www.dynomotion.com/Help/Cmd.htm#SetGatherDec SetGatherDec]  [http://www.dynomotion.com/Help/Cmd.htm#GetGatherHex GetGatherHex]  [http://www.dynomotion.com/Help/Cmd.htm#SetGatherHex SetGatherHex]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Performing multiple Operations continually in a forever Loop==&lt;br /&gt;
It doesn't make logical sense to have more than one forever loop in a program.  That would be like saying to someone go and check if any mail arrived over and over forever and then when you are done with that go and check if someone is at the back door over and over forever.  Obviously the back door will never get around to being checked.  &amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; The solution is to create a single loop that checks two things each time through the loop.   #1 go check the mail, #2 go check the back door, # 3 repeat.   Using this technique any number of things can be continuously performed in a single loop.  &amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; There is one catch with this technique. None of the operations should &amp;quot;block&amp;quot; or take a significant amount of time to perform.  If you were to perform an operation that took a long time to complete all the other continuous operations would be blocked and go unserviced for that period of time.  If it is required to do something that takes a significant amount of time then the solution is to break it down into pieces (states) that can be each performed in an insignificant amount of time.  For example say you wish to activate a lubrication relay for 2 seconds each time a button is pushed.  Instead of delaying 2 seconds you would instead record the time the relay was turned on, then go off and do other things while frequently returning to see if it is time to turn the relay off.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is an example to cycle an IO bit continuously based on time.  Note that although this is a complete example for testing you would normally already have a forever loop in your Initialization program.  In that case only add the ServiceTimerSequence Function to your Initialization Program and add the Function call to your existing forever loop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;KMotionDef.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
void ServiceTimerSequence(void);&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
	for (;;) // loop forever&lt;br /&gt;
	{&lt;br /&gt;
		WaitNextTimeSlice(); // execute loop once every time slice&lt;br /&gt;
		ServiceTimerSequence();  // service the timer sequencing&lt;br /&gt;
	}   // end of forever loop&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// sequence an IO Bit Based on Time in a non-blocking manner&lt;br /&gt;
&lt;br /&gt;
#define TIME_ON 5.0 //seconds&lt;br /&gt;
#define CYCLE_TIME 15.0 //seconds&lt;br /&gt;
#define OUTPUT_BIT 46 // which IO bit to drive&lt;br /&gt;
void ServiceTimerSequence(void)&lt;br /&gt;
{&lt;br /&gt;
	static double T0=0.0;  // remember the last time we turned on&lt;br /&gt;
	double T=Time_sec(); // get current Time_sec&lt;br /&gt;
	&lt;br /&gt;
	if (T0==0.0 || T &amp;gt; T0 + CYCLE_TIME) T0=T;  // set start time of cycle&lt;br /&gt;
	&lt;br /&gt;
	if (T &amp;lt; T0 + TIME_ON)  // are we within the TIME_ON section of the cycle?&lt;br /&gt;
		SetBit(OUTPUT_BIT);  //yes&lt;br /&gt;
	else&lt;br /&gt;
		ClearBit(OUTPUT_BIT);  //no&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Common C Programming Mistakes==&lt;br /&gt;
A common programming mistake is to forget to add the '()' for a function call.  It might not be obvious why this isn't flagged as an error.  In some programming languages such as Basic a subroutine with no parameters can be called by coding the name with no parenthesis.  In C the name of a function represents the address of the function. Adding the () is required to make a function call to that address.&lt;br /&gt;
&lt;br /&gt;
Furthermore in C any valid expression is allowed. For example:&lt;br /&gt;
&lt;br /&gt;
2+2;&lt;br /&gt;
&lt;br /&gt;
is a valid C expression. The compiler computes 4 and does nothing with it (sometimes computing things have side effects and therefore have purpose).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2;&lt;br /&gt;
&lt;br /&gt;
is a valid C expression. The compiler computes 2 and does nothing with it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ClearStopImmediately;&lt;br /&gt;
&lt;br /&gt;
is a valid expression. The compiler computes the address of the function ClearStopImmediately and does nothing with it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' You can use our Code Validator in our latest Test Version 4.35a. See detailed [http://www.dynomotion.com/Help/ProgramScreen/ShowContextMenu.htm help] or our [https://www.youtube.com/watch?v=N2KSdYuag1U Validate C Programs video].&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/Kinematics</id>
		<title>Kinematics</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/Kinematics"/>
				<updated>2024-09-05T00:12:43Z</updated>
		
		<summary type="html">&lt;p&gt;TK: /* Kinematics GimbalCB and guide contributed by kizilkaya */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Advantages of Kinematics and Rotation Tool Center Point (RTCP)==&lt;br /&gt;
RTCP takes into consideration the Kinematics of the machine to allow angular changes to the tool while keeping the tool center point at the same location relative to the machine table. Note this is true regardless of whether the Tool angle changes or the Table angle changes.  The diagram below shows an example where the Tool angle is changed.&lt;br /&gt;
&lt;br /&gt;
[[File:RTCP_On_Off.png|none|link=|670x350px]]&lt;br /&gt;
&lt;br /&gt;
To perform RTCP an XYZ adjustment is applied to correct for XYZ shifts that occur with ABC angular changes.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For Gimbal Head type systems the Tool Tip location relative to the head pivot points must be known to compute the appropriate adjustments.  This means that changes of Tool Lengths and Tool Offsets will affect the required adjustments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For Trunnion Table table type systems the Tool Tip location relative to the Table pivot points must be known to compute the appropriate adjustments.  This means that changes to GCode Offsets (Fixture/work or Global) will shift all the Tool Tip locations relative to the Table and will affect the required adjustments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The data flow diagram below shows the difference between having a CAD system perform the Kinematics vs having the Controller perform the Kinematics.  Having the Controller perform the Kinematics allows the same GCode to be used even though Tool Lengths, Work Offsets, or even Machine Geometries have been changed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RTCP_Data_Flow.png|none|link=|770x550px]]&lt;br /&gt;
&lt;br /&gt;
An additional advantage to having Kinematics performed in the Controller is that the Kinematics/RTCP is performed continuously throughout angular motions and not only on GCode Coordinates/Blocks/Lines.  So for example in the case where only the B Axis is desired to rotate:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
G0 B0  (start at angle 0)&lt;br /&gt;
&lt;br /&gt;
G1 B90 (rotate B 90 degrees).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With RTCP in the Controller, only one line of GCode is required to rotate B 90degrees and throughout the motion the tool tip will remain in the same place.  With RTCP in CAD, many lines of GCode would be required that include all the intermediate XYZ positions to keep the tool tip in the same place.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
Kinematics are part of the Coordinated Motion Library which is used by the GCode Interpreter.  It provides a transformation from the desired CAD positions to the System's required Actuator positions to move there.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To add new Kinematics a new C++ Kinematics Class will be required to be added to the GCodeInterpreter Project.  See [http://www.dynomotion.com/wiki/index.php?title=PC_Example_Applications here] for information on modifying and building the KMotion Libraries and PC Examples.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Normally only equations for inverse kinematics (determines Actuator positions from given CAD position) are required to be defined.  The CKinematics class will automatically solve forward kinematics numerically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A text file (Kinematics.txt) in the in the &amp;lt;&amp;gt;\KMotion\Data directory contains a string that is used by the CCoordMotion class to determine what Kinematics Class is to be used.  If the text file doesn't exist standard, orthogonal, linear Kinematics are used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After adding your new kinematics class a test for your new class should be added to CoordMotion.cpp into the code shown below.  Also the appropriate string should be placed into the Kinematics.txt file.  Additional parameters might be included in this file to be read by your Kinematics Class to make it more general.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;	FILE *f = fopen((CString)MainPath + &amp;quot;\\Data\\Kinematics.txt&amp;quot;,&amp;quot;rt&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	if (f)&lt;br /&gt;
	{&lt;br /&gt;
		char s[81];&lt;br /&gt;
		fgets(s, 80, f);&lt;br /&gt;
		// one exists, check if it is calling for Geppetto otherwise assume it is the 3Rod&lt;br /&gt;
&lt;br /&gt;
		if (strstr(s, &amp;quot;5AxisTableAC&amp;quot;) != NULL)&lt;br /&gt;
			Kinematics = new CKinematics5AxisTableAC;&lt;br /&gt;
		else if (strstr(s, &amp;quot;5AxisTableBC&amp;quot;) != NULL)&lt;br /&gt;
			Kinematics = new CKinematics5AxisTableBC;&lt;br /&gt;
		else if (strstr(s, &amp;quot;5AxisGimbalAB&amp;quot;) != NULL)&lt;br /&gt;
			Kinematics = new CKinematics5AxisGimbalAB;&lt;br /&gt;
		else if (strstr(s, &amp;quot;5AxisGimbalCB&amp;quot;) != NULL)&lt;br /&gt;
			Kinematics = new CKinematics5AxisGimbalCB;&lt;br /&gt;
		else if (strstr(s, &amp;quot;GeppettoExtruder&amp;quot;) != NULL)&lt;br /&gt;
			Kinematics = new CKinematicsGeppettoExtrude;&lt;br /&gt;
		else if (strstr(s, &amp;quot;Geppetto&amp;quot;) != NULL)&lt;br /&gt;
			Kinematics = new CKinematicsGeppetto;&lt;br /&gt;
		else&lt;br /&gt;
			Kinematics = new CKinematics3Rod;&lt;br /&gt;
		&lt;br /&gt;
		fclose(f);&lt;br /&gt;
	}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: In order for your new class to be defined its header file should be added into the standard header include file StdAfx.h in the GCodeInterpreter Directory as are the other Kinematic class headers as shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;Kinematics.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Kinematics3Rod.h&amp;quot;&lt;br /&gt;
#include &amp;quot;KinematicsGeppetto.h&amp;quot;&lt;br /&gt;
#include &amp;quot;KinematicsGeppettoExtrude.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Kinematics5AxisGimbalAB.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Kinematics5AxisGimbalCB.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Kinematics5AxisTableAC.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Kinematics5AxisTableBC.h&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Kinematics3Rod==&lt;br /&gt;
The first non-linear Kinematics that was added to the KMotion Libraries was the simple Kinematics3Rod class shown below.  Given the XYZ CAD position it computes the necessary lengths of 3 &amp;quot;rod&amp;quot; type linear actuators to place the end effector at the desired CAD location.  Also below is a old video of it in operation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;	// Kinematics3Rod.cpp: implementation of the CKinematics3Rod class.&lt;br /&gt;
//&lt;br /&gt;
//////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Kinematics3Rod.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#define sqr(x) ((x)*(x))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Construction/Destruction&lt;br /&gt;
//////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
CKinematics3Rod::CKinematics3Rod()&lt;br /&gt;
{&lt;br /&gt;
	Act0Center.x = 12;&lt;br /&gt;
	Act0Center.y = 0;&lt;br /&gt;
	Act0Center.z = 0;&lt;br /&gt;
&lt;br /&gt;
	Act1Center.x = 0;&lt;br /&gt;
	Act1Center.y = 12;&lt;br /&gt;
	Act1Center.z = 0;&lt;br /&gt;
&lt;br /&gt;
	Act2Center.x = 11;&lt;br /&gt;
	Act2Center.y = 3;&lt;br /&gt;
	Act2Center.z = 12;&lt;br /&gt;
&lt;br /&gt;
	// when actuator position is zero this is how long the rod is&lt;br /&gt;
&lt;br /&gt;
	Act0Off = sqrt(sqr(Act0Center.x) + sqr(Act0Center.y) + sqr(Act0Center.z));  &lt;br /&gt;
	Act1Off = sqrt(sqr(Act1Center.x) + sqr(Act1Center.y) + sqr(Act1Center.z));&lt;br /&gt;
	Act2Off = sqrt(sqr(Act2Center.x) + sqr(Act2Center.y) + sqr(Act2Center.z));&lt;br /&gt;
&lt;br /&gt;
	m_MotionParams.MaxLinearLength = 0.25;  // limit the segment lengs for nonlinear systems&lt;br /&gt;
	m_MotionParams.MaxRapidFRO = 1.0;       // limit the increase in Rapid HW FRO&lt;br /&gt;
	m_MotionParams.UseOnlyLinearSegments=true;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
CKinematics3Rod::~CKinematics3Rod()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int CKinematics3Rod::TransformCADtoActuators(double x, double y, double z, double a, double b, double c, double *Acts, bool NoGeo)&lt;br /&gt;
{&lt;br /&gt;
	// find lengths of each actuator&lt;br /&gt;
&lt;br /&gt;
	GeoCorrect(x,y,z,&amp;amp;x,&amp;amp;y,&amp;amp;z);&lt;br /&gt;
&lt;br /&gt;
	double r0 = sqrt(sqr(x-Act0Center.x) + sqr(y-Act0Center.y) + sqr(z-Act0Center.z)) - Act0Off;&lt;br /&gt;
	double r1 = sqrt(sqr(x-Act1Center.x) + sqr(y-Act1Center.y) + sqr(z-Act1Center.z)) - Act1Off;&lt;br /&gt;
	double r2 = sqrt(sqr(x-Act2Center.x) + sqr(y-Act2Center.y) + sqr(z-Act2Center.z)) - Act2Off;&lt;br /&gt;
&lt;br /&gt;
	Acts[0] = r0*m_MotionParams.CountsPerInchX;&lt;br /&gt;
	Acts[1] = r1*m_MotionParams.CountsPerInchY;&lt;br /&gt;
	Acts[2] = r2*m_MotionParams.CountsPerInchZ;&lt;br /&gt;
&lt;br /&gt;
	Acts[3] = a*m_MotionParams.CountsPerInchA;&lt;br /&gt;
	Acts[4] = b*m_MotionParams.CountsPerInchB;&lt;br /&gt;
	Acts[5] = c*m_MotionParams.CountsPerInchC;&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// perform Inversion to go the other way&lt;br /&gt;
&lt;br /&gt;
int CKinematics3Rod::TransformActuatorstoCAD(double *Acts, double *xr, double *yr, double *zr, double *ar, double *br, double *cr, bool NoGeo)&lt;br /&gt;
{&lt;br /&gt;
	return InvertTransformCADtoActuators(Acts, xr, yr, zr, ar, br, cr);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 {{#ev:youtube|MV42zmiT_4I}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==A more complex 6 axis Kinematics (CKinematicsGeppetto)==&lt;br /&gt;
 {{#ev:youtube|MSONYPXe3bE}}&lt;br /&gt;
Formulas to calculate Actuator Positions from XYZABC CAD Position uses Rotate3 function to rotate a point through 3 angles.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;int CKinematicsGeppettoExtrude::TransformCADtoActuators(double x, double y, double z, double a, double b, double c, double *Acts, bool NoGeo)&lt;br /&gt;
{&lt;br /&gt;
	double x_0,y_0,z_0,x_1,y_1,z_1,x_2,y_2,z_2,x_3,y_3,z_3,x_4,y_4,z_4,x_5,y_5,z_5, TCP_Rotated_x,TCP_Rotated_y,TCP_Rotated_z;&lt;br /&gt;
	// find lengths of each actuator&lt;br /&gt;
&lt;br /&gt;
	// Determine where the TCP rotated point would be relative to origin when oriented at the desired angles.&lt;br /&gt;
	Rotate3(0, 0, 0, m_MotionParams.TCP_X, m_MotionParams.TCP_Y, m_MotionParams.TCP_Z, a, b, c, &amp;amp;TCP_Rotated_x, &amp;amp;TCP_Rotated_y, &amp;amp;TCP_Rotated_z);&lt;br /&gt;
&lt;br /&gt;
	// Translate from TCP to end effector origin&lt;br /&gt;
	x += TCP_Rotated_x - m_MotionParams.TCP_X;&lt;br /&gt;
	y += TCP_Rotated_y - m_MotionParams.TCP_Y;&lt;br /&gt;
	z += TCP_Rotated_z - m_MotionParams.TCP_Z;&lt;br /&gt;
&lt;br /&gt;
	if (!NoGeo) GeoCorrect(x,y,z,a,b,c,&amp;amp;x,&amp;amp;y, &amp;amp;z, &amp;amp;a, &amp;amp;b, &amp;amp;c);&lt;br /&gt;
&lt;br /&gt;
	// Find where connection points should be&lt;br /&gt;
	Rotate3(x,y,z,x+X0,y+Y0,z+Z0,a,b,c,&amp;amp;x_0,&amp;amp;y_0,&amp;amp;z_0);&lt;br /&gt;
	Rotate3(x,y,z,x+X1,y+Y1,z+Z1,a,b,c,&amp;amp;x_1,&amp;amp;y_1,&amp;amp;z_1);&lt;br /&gt;
	Rotate3(x,y,z,x+X2,y+Y2,z+Z2,a,b,c,&amp;amp;x_2,&amp;amp;y_2,&amp;amp;z_2);&lt;br /&gt;
	Rotate3(x,y,z,x+X3,y+Y3,z+Z3,a,b,c,&amp;amp;x_3,&amp;amp;y_3,&amp;amp;z_3);&lt;br /&gt;
	Rotate3(x,y,z,x+X4,y+Y4,z+Z4,a,b,c,&amp;amp;x_4,&amp;amp;y_4,&amp;amp;z_4);&lt;br /&gt;
	Rotate3(x,y,z,x+X5,y+Y5,z+Z5,a,b,c,&amp;amp;x_5,&amp;amp;y_5,&amp;amp;z_5);&lt;br /&gt;
&lt;br /&gt;
	double r0 = sqrt(sqr(x_0 - Act0Center.x) + sqr(y_0 - Act0Center.y) + sqr(z_0 - Act0Center.z)) - Act0Off;&lt;br /&gt;
	double r1 = sqrt(sqr(x_1 - Act1Center.x) + sqr(y_1 - Act1Center.y) + sqr(z_1 - Act1Center.z)) - Act1Off;&lt;br /&gt;
	double r2 = sqrt(sqr(x_2 - Act2Center.x) + sqr(y_2 - Act2Center.y) + sqr(z_2 - Act2Center.z)) - Act2Off;&lt;br /&gt;
	double r3 = sqrt(sqr(x_3 - Act3Center.x) + sqr(y_3 - Act3Center.y) + sqr(z_3 - Act3Center.z)) - Act3Off;&lt;br /&gt;
	double r4 = sqrt(sqr(x_4 - Act4Center.x) + sqr(y_4 - Act4Center.y) + sqr(z_4 - Act4Center.z)) - Act4Off;&lt;br /&gt;
	double r5 = sqrt(sqr(x_5 - Act5Center.x) + sqr(y_5 - Act5Center.y) + sqr(z_5 - Act5Center.z)) - Act5Off;&lt;br /&gt;
&lt;br /&gt;
	Acts[0] = r0*m_MotionParams.CountsPerInchX;&lt;br /&gt;
	Acts[1] = r1*m_MotionParams.CountsPerInchY;&lt;br /&gt;
	Acts[2] = r2*m_MotionParams.CountsPerInchZ;&lt;br /&gt;
	Acts[3] = r3*m_MotionParams.CountsPerInchA;&lt;br /&gt;
	Acts[4] = r4*m_MotionParams.CountsPerInchB;&lt;br /&gt;
	Acts[5] = r5*m_MotionParams.CountsPerInchC;&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Alex's system with a Table A axis and Gimbal B axis (Kinematics5AxisTableAGimbalB.cpp)==&lt;br /&gt;
[[File:TableAGimbalBCAD.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|PuIdtZKdYfA}}&lt;br /&gt;
Here is the math. First the definitions:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:TableAGimbalBDefs.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Origin Definition&lt;br /&gt;
&lt;br /&gt;
[[File:TableAGimbalBOrigin.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
The Solution&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:TableAGimbalBSolution.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The formula in C++ code:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;// Kienematics for Table with A Axis and Tool Gimble head with B Axis &lt;br /&gt;
//&lt;br /&gt;
// A axis always rotates about X axis&lt;br /&gt;
// B axis always rotates about Y axis&lt;br /&gt;
&lt;br /&gt;
int CKinematics5AxisTableAGimbalB::TransformCADtoActuators(double x, double y, double z, double a, double b, double c, double *Acts, bool NoGeo)&lt;br /&gt;
{&lt;br /&gt;
	double Xt, Yt, Zt, Xa, Ya, Za, ToolXR, ToolZR, ChuckXR, ChuckZR, Dummy;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	if (m_MotionParams.TCP_Active)&lt;br /&gt;
	{&lt;br /&gt;
		//Find CAD Tool Tip Location from coordinate passed in (Xt, Yt, Zt)&lt;br /&gt;
		Xt = x - m_MotionParams.TCP_X;  // remove tool offset&lt;br /&gt;
		Yt = y - m_MotionParams.TCP_Y;&lt;br /&gt;
		Zt = z - m_MotionParams.TCP_Z;&lt;br /&gt;
&lt;br /&gt;
		//Perform A rotation to obtain (Xa, Ya, Za)&lt;br /&gt;
		Rotate3(0, 0, 0, Xt, Yt, Zt, a, 0, 0, &amp;amp;Xa, &amp;amp;Ya, &amp;amp;Za);	&lt;br /&gt;
&lt;br /&gt;
		//Determine ChuckXR ChuckZR by rotating PivotChuckLength by Angle B &lt;br /&gt;
		Rotate3(0, 0, 0, 0, 0, PivotToChuckLength, 0, -b, 0, &amp;amp;ChuckXR, &amp;amp;Dummy, &amp;amp;ChuckZR);&lt;br /&gt;
&lt;br /&gt;
		//Determine Rotated Tool offset ToolXR ToolZR by rotating ToolX ToolZ by Angle B&lt;br /&gt;
		Rotate3(0, 0, 0, m_MotionParams.TCP_X, m_MotionParams.TCP_Y, m_MotionParams.TCP_Z, 0, -b, 0, &amp;amp;ToolXR, &amp;amp;Dummy, &amp;amp;ToolZR);&lt;br /&gt;
&lt;br /&gt;
		x = Xa + ToolXR + ChuckXR;&lt;br /&gt;
		y = Ya;&lt;br /&gt;
		z = Za + ToolZR + ChuckZR - PivotToChuckLength;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	if (!NoGeo) GeoCorrect(x,y,z,&amp;amp;x,&amp;amp;y, &amp;amp;z);&lt;br /&gt;
&lt;br /&gt;
	Acts[0] = x*m_MotionParams.CountsPerInchX;&lt;br /&gt;
	Acts[1] = y*m_MotionParams.CountsPerInchY;&lt;br /&gt;
	Acts[2] = z*m_MotionParams.CountsPerInchZ;&lt;br /&gt;
	Acts[3] = a*m_MotionParams.CountsPerInchA;&lt;br /&gt;
	Acts[4] = b*m_MotionParams.CountsPerInchB;&lt;br /&gt;
	Acts[5] = c*m_MotionParams.CountsPerInchC;&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Scara Robot Kinematics by Demondor==&lt;br /&gt;
See Forum Thread with code [https://www.dynomotion.com/forum/viewtopic.php?f=10&amp;amp;t=922 here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Geometry below&lt;br /&gt;
&lt;br /&gt;
[[File:ScaraGeometry.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Class name CKinematicsScara&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==2 Axis Spray Robot by Scott Little==&lt;br /&gt;
Simulation&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|veQftMBxbzU}}&lt;br /&gt;
 {{#ev:youtube|eon96CIPQkY}}&lt;br /&gt;
&lt;br /&gt;
Forum Thread [https://dynomotion.com/forum/viewtopic.php?f=16&amp;amp;t=1182 here].&lt;br /&gt;
&lt;br /&gt;
Class Name CKinematics2AxisRobot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3 Axis Cable Delta Robot by Александр Украинец==&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|1LG6tnt08wE}}&lt;br /&gt;
&lt;br /&gt;
Class Name CKinematics3axisDeltaRobot&lt;br /&gt;
&lt;br /&gt;
Project Details&lt;br /&gt;
&lt;br /&gt;
[https://docs.google.com/document/d/1FLZXM_LQojO0Z4cQUFxOFcynNfsAr4oe34-rbIXFz8E/edit?usp=sharing Shared Project Files]&lt;br /&gt;
&lt;br /&gt;
==5 Axis Gimbal CB by Forum User kizilkaya==&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|US-MbuuB5U8}}&lt;br /&gt;
&lt;br /&gt;
Class Name CKinematicsGimbalCB&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an RTCP Guide submitted by kizilkaya&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is a lot of complicated information about RTCP and it took me a long time to collect all this and deliver the machine to my customer, but I finally succeeded. RTCP works without any problems. I have prepared a detailed guide for those who do not want to experience difficulties like me. I would be happy if you share it.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;STEP 1 ) Adjust all axis settings very precisely, especially the angled axes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;STEP 2 ) Kinematics.txt from Data.rar copy to C:\KMotion5.3.4\GCodeInterpreter&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;STEP 3 ) Select Kinematic from Kinematics.txt according to your machine configuration. (e.g. Kinematics5AxisGimbalCB).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;STEP 4 )B and C axis positions must be set to &amp;quot;0 (zero)&amp;quot; as shown in the picture, otherwise the angled axes will tilt in different directions when RTCP is active.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;STEP 5 ) Open the C:\KMotion5.3.4\GCodeInterpreter\GCodeInterpreter.vcxproj file with Visual Studio and set the pivot as seen in the pivot.png image, then compile the project and create the GCodeInterpreter element.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Now you can use rctp actively with &amp;quot;G43.4 Hx (x tool number)&amp;quot; and turn off rtcp with &amp;quot;G49&amp;quot;.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Example ;&amp;lt;br /&amp;gt;Please first pull the x, y and z axes (taking the pivot length into consideration) to a safe area and edit the g code according to the C and B axis limits.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;G43.4 H1 G1 F3000 B0 C0&amp;lt;br /&amp;gt;B90&amp;lt;br /&amp;gt;B-90&amp;lt;br /&amp;gt;C-180&amp;lt;br /&amp;gt;C180&amp;lt;br /&amp;gt;B0 C0&amp;lt;br /&amp;gt;M30&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:pivot.png|none|link=|958x393px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Cosmeq.jpeg|none|link=|768x432px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Download Project [[Media:5AxisGimbalCBFiles.zip|Files]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:Cosmeq.jpeg</id>
		<title>File:Cosmeq.jpeg</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:Cosmeq.jpeg"/>
				<updated>2024-09-05T00:01:31Z</updated>
		
		<summary type="html">&lt;p&gt;TK: TK uploaded a new version of &amp;amp;quot;File:Cosmeq.jpeg&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:pivot.png</id>
		<title>File:pivot.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:pivot.png"/>
				<updated>2024-09-04T23:59:20Z</updated>
		
		<summary type="html">&lt;p&gt;TK: TK uploaded a new version of &amp;amp;quot;File:pivot.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:pivot.png</id>
		<title>File:pivot.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:pivot.png"/>
				<updated>2024-09-04T23:55:11Z</updated>
		
		<summary type="html">&lt;p&gt;TK: TK uploaded a new version of &amp;amp;quot;File:pivot.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:Cosmeq.jpeg</id>
		<title>File:Cosmeq.jpeg</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:Cosmeq.jpeg"/>
				<updated>2024-09-04T23:51:56Z</updated>
		
		<summary type="html">&lt;p&gt;TK: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:pivot.png</id>
		<title>File:pivot.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:pivot.png"/>
				<updated>2024-09-04T23:51:25Z</updated>
		
		<summary type="html">&lt;p&gt;TK: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:5AxisGimbalCBFiles.zip</id>
		<title>File:5AxisGimbalCBFiles.zip</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:5AxisGimbalCBFiles.zip"/>
				<updated>2024-09-04T23:46:38Z</updated>
		
		<summary type="html">&lt;p&gt;TK: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/Main_Page"/>
				<updated>2024-06-24T00:26:18Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Linear Table Corrections&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Dynomotion wiki'''&amp;lt;span style=&amp;quot;color: #999999;&amp;quot;&amp;gt;'''&amp;lt;br /&amp;gt;'''&amp;lt;/span&amp;gt;==&lt;br /&gt;
Welcome to our wiki where you can find and share knowledge on Dynomotion's systems.  To begin adding information to this wiki, simply create an account, verify your email, and start editing (click pencil icon). To make editing pages easier for everyone, we have installed a [https://help.bluespice.com/index.php/VisualEditor visual editor] by default.  This visual editor allows you to edit a wiki page much like you would a standard word processing document.&amp;amp;nbsp; For the seasoned wiki editors, standard [https://www.mediawiki.org/wiki/Help:Editing MediaWiki editing] may also be used.&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Warning: Use at your own risk.&amp;amp;nbsp; Information is for example purposes only and may contain errors.&amp;amp;nbsp; It is up to the User to verify the information is correct and is safe to use. In no case will any contributor or Dynomotion be liable for incorrect information.  Dynomotion reserves the right to modify or delete any contributions.&amp;lt;br /&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Thanks for Contributing!&lt;br /&gt;
&lt;br /&gt;
[http://dynomotion.com Official Dynomotion Site]&lt;br /&gt;
&lt;br /&gt;
==Editing and Creating Wiki Pages==&lt;br /&gt;
Unintuitively, you first create a link to the page you want to make before you can make the page.  To make a new page: while editing, right-click where you want your link to be, insert a link with a descriptive title and link text, save the page, click on the link you created, then click on &amp;quot;Empty Page&amp;quot; to begin editing your new page.&lt;br /&gt;
&lt;br /&gt;
Here are a few other quick tips:&lt;br /&gt;
&lt;br /&gt;
* You can insert links or images by Right-Clicking with the mouse on the line where you want the link or image to appear.&lt;br /&gt;
* For Spell Correction you can use Ctrl-Right-Click. &lt;br /&gt;
* To insert a YouTube Video use an EmbedVideo command such as &amp;lt;nowiki&amp;gt; {{#ev:youtube|xxxxx}}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;with xxxxx changed to the Video ID.&lt;br /&gt;
* Choose a descriptive page name and link text when creating a new page: e.g. Not &amp;quot;My Machine&amp;quot;, but rather &amp;quot;Brand X Three Axis Milling Machine Retrofit&amp;quot;&lt;br /&gt;
* Create pages in an organized manner: Describe what the page is about, create clear sections that flow&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
[[Help:New Page Creation|How to create a new wiki page]]&lt;br /&gt;
&lt;br /&gt;
[[Help:Editing Pages|How to Edit and insert Media into your wiki pages]]&lt;br /&gt;
&lt;br /&gt;
==Dynomotion Software Topics==&lt;br /&gt;
===Installation Topics===&lt;br /&gt;
* Announcement of our Latest Release (5.3.3) on the [https://www.dynomotion.com/forum/viewtopic.php?f=4&amp;amp;t=1752 Dynomotion Forum]&lt;br /&gt;
* [https://dynomotion.com/Software/Download.html Latest Release] Note: For Windows 7 64bit signed Drivers to work, all Windows Updates should be performed.&lt;br /&gt;
* [[Upgrading from previous KMotion Versions]]&lt;br /&gt;
&lt;br /&gt;
Archive of Test Releases:&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 02/01/2024: [https://dynomotion.com/Software/KMotion5.3.2.exe KMotion.exe 5.3.2], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.2%20Changes.pdf 5.3.2 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 11/20/2023: [https://dynomotion.com/Software/KMotion5.3.1.exe KMotion.exe 5.3.1], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.1%20Changes.pdf 5.3.1 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/19/2023: [https://dynomotion.com/Software/KMotion5.3.0.exe KMotion.exe 5.3.0], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.0%20Changes.pdf 5.3.0 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 06/30/2023: [https://dynomotion.com/Software/KMotion5.1.0.exe KMotion.exe 5.1.0], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.1.0%20Changes.pdf 5.1.0 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 05/01/2023: [https://dynomotion.com/Software/KMotion5.0.7.exe KMotion.exe 5.0.7], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.0.7%20Changes.pdf 5.0.7 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/21/2022: [https://dynomotion.com/Software/KMotion435h.exe KMotion.exe V4.35h], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35h%20Changes.pdf V4.35h release notes (pdf)]&lt;br /&gt;
* Previous Version 4.35g was not released, but see the change notes for this version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35g%20Changes.pdf V4.35g change notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/28/2020: [https://dynomotion.com/Software/KMotion435f.exe KMotion.exe V4.35f], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35f%20Changes.pdf V4.35f release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 11/18/2019: [https://dynomotion.com/Software/KMotion435e.exe KMotion.exe V4.35e], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35e%20Changes.pdf V4.35e release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/10/2019: [https://dynomotion.com/Software/KMotion435d.exe KMotion.exe V4.35d], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35d%20Changes.pdf V4.35d release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 01/28/2019: [https://dynomotion.com/Software/KMotion435b.exe KMotion.exe V4.35b], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35b%20Changes.pdf V4.35b release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/21/2018: [https://dynomotion.com/Software/KMotion435a.exe KMotion.exe V4.35a], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35a%20Changes.pdf V4.35a release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/28/2017: [https://dynomotion.com/Software/KMotion434j.exe KMotion.exe V4.34j], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34j%20Changes.pdf V4.34j release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 05/07/2017: [https://dynomotion.com/Software/KMotion434i.exe KMotion.exe V4.34i], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34i%20Changes.pdf V4.34i release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/14/2016: [https://dynomotion.com/Software/KMotion434h.exe KMotion.exe V4.34h], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34h%20Changes.pdf V4.34h release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/13/2016: [https://dynomotion.com/Software/KMotion434g.exe KMotion.exe V4.34g], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34g%20Changes.pdf V4.34g release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/05/2016: [https://dynomotion.com/Software/KMotion434f.exe KMotion.exe V4.34f], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34f%20Changes.pdf V4.34f release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 11/07/2016: [https://dynomotion.com/Software/KMotion434e.exe KMotion.exe V4.34e], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34e%20Changes.pdf V4.34e release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/32/2016: [https://dynomotion.com/Software/KMotion434d.exe KMotion.exe V4.34d], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34d%20Changes.pdf V4.34d release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/23/2016: [https://dynomotion.com/Software/KMotion434c.exe KMotion.exe V4.34c], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34c%20Changes.pdf V4.34c release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/03/2016: [https://dynomotion.com/Software/KMotion434b.exe KMotion.exe V4.34b], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34b%20Changes.pdf V4.34b release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 03/09/2016: [https://dynomotion.com/Software/KMotion434a.exe KMotion.exe V4.34a], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34a%20Changes.pdf V4.34a release notes (pdf)]&lt;br /&gt;
* [https://dynomotion.com/Help/KFLOPQuickStart/KFLOPQuickStart.htm How to install KMotion.exe and KMotionCNC]&lt;br /&gt;
* [[How to install KMotion.exe and KMotion in Windows 10|Preparing Windows 10 for driver installation]] (no longer required)&lt;br /&gt;
* [[Special Case for Windows 8.1 Industry Embedded Enterprise]]&lt;br /&gt;
* [[Updating KFLOP Firmware|How to update KFLOP Firmware]] - whenever a new version of software is installed, the firmware within KFLOP must be updated to match the new version&lt;br /&gt;
&lt;br /&gt;
===KMotion.exe Executive Software Topics===&lt;br /&gt;
KMotion.exe is the main program that is used to configure settings in KFLOP, initialize axes, and to write C programs to configure and setup KFLOP to control your system. In this program you can plot step response, test movement, view Bode plots, monitor I/O, set filter parameters, and generally set the pertinent parameters.&lt;br /&gt;
&lt;br /&gt;
* [http://www.dynomotion.com/Help/index.htm General software information] from the manuals&lt;br /&gt;
* Insert pages for other KMotion.exe-related topics here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Configuration Topics===&lt;br /&gt;
====Channels, Channels, Channels what are they?====&lt;br /&gt;
[[Channels Channels Channels|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====How to Setup Backlash Compensation====&lt;br /&gt;
[[Backlash Compensation|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====PWM Output Mode====&lt;br /&gt;
[[PWM Output Mode|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
===KMotionCNC Software Topics===&lt;br /&gt;
KMotionCNC is Dynomotion's CNC program used as a graphical user interface to your KFLOP-enabled machine tool. KMotionCNC has all of the basic functionality you need to run a machine of up to 6 axes, in addition to spindle control.&lt;br /&gt;
&lt;br /&gt;
* Insert pages for other KMotionCNC-related general topics here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;Using KMotionCNC&amp;lt;/span&amp;gt;====&lt;br /&gt;
* Homing discussion - page to be created&lt;br /&gt;
* Insert other KMotionCNC use pages here&lt;br /&gt;
&lt;br /&gt;
[[Internal/concave Path Tool Radius Compensation Example G41/G42]]&lt;br /&gt;
&lt;br /&gt;
[[Known KMotionCNC CAD/CAM Post Processors]]&lt;br /&gt;
&lt;br /&gt;
[[Invoking C Programs with Execute Only for previously Downloaded Programs]]&lt;br /&gt;
&lt;br /&gt;
[[Rigid Tapping G84 Setup and Use]]&lt;br /&gt;
&lt;br /&gt;
[[Tool Length/Offsets G43Hn G49]]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;Customize KMotionCNC&amp;lt;/span&amp;gt;====&lt;br /&gt;
KMotionCNC is written as a Windows C++ MFC (Microsoft Foundation Classes) program developed in Visual Studio.  Source code is provided and may be customized using Visual Studio.  MFC Support is a requirement. &lt;br /&gt;
&lt;br /&gt;
: '''General Information'''&lt;br /&gt;
: Compiling KMotionCNC&lt;br /&gt;
:: The KMotionCNC's Visual Studio Project Solution (\PC VC Programs\KMotionCNC\KMotionCNC.sln) is currently written for Visual Studio 2015 Standard.  This version can be used for the simplest compatibility.  Projects can be upgraded to newer version of VS with minimal effort.  Including Microsoft's Free Visual Studio 2013 Community.  [[PC Example Applications|More info on PC Example Applications.]]&lt;br /&gt;
:: Note Test Versions 4.34a and later have project solutions targeted for Visual Studio 2015 Community which is free for most Users.&lt;br /&gt;
: '''KMotionCNC Customization Examples and Applications'''&lt;br /&gt;
:: Links to examples of projects that explain KMotionCNC customizations. Troy (tmday7) created some helpful documents (PDF format):&lt;br /&gt;
: &lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/How%20to%20Edit%20KMotionCNC%20Faces.pdf How to edit KMotionCNC faces]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20External%20Buttons.pdf Adding external buttons]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20More%20User%20Buttons.pdf Adding more user buttons]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20Jog%20Percent%20Cell%20to%20Main%20Dialog%20Face.pdf Adding Jog Percent Cell to Main Dialog Face]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;KMotionCNC Screen Editor&amp;lt;/span&amp;gt;====&lt;br /&gt;
Introduces the capability of using Screen Script files to modify the look and function of KMotionCNC.&amp;lt;br /&amp;gt;[[KMotionCNC Screen Editor|More information.]]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;KMotionCNC Geometric Correction&amp;lt;/span&amp;gt;====&lt;br /&gt;
Information regarding the powerful [https://dynomotion.com/Help/KMotionCNC/GeoCorrection.htm Geometric Correction capability] which allows calibration and distortion correction of the XY CAD space to Machine/Actuator Space as well as flatness in Z.  Simple 4 point correction tables can apply XY Scale, Rotation, skew, offset, tilt.  Larger tables can apply more non-linear corrections.&lt;br /&gt;
&lt;br /&gt;
Note the Geometric Correction is built into the KMotion Libraries and can be utilized by Custom Programs as well as with KMotionCNC&amp;lt;br /&amp;gt;[[Geometric Correction|More information and Examples.]]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;KMotionCNC Linear Table Correction (Screw Mapping)&amp;lt;/span&amp;gt;====&lt;br /&gt;
Individual Axes can be corrected in a 1 dimensional manner referred to as Linear Table Corrections.  For more information See [[Linear Table Correction|here]].&lt;br /&gt;
&lt;br /&gt;
===PC Example Applications===&lt;br /&gt;
A number of PC Applications using the KMotion Libraries are available in the Software download.&amp;amp;nbsp; Visual Studio should be used to modify/compile the applications.&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note All the projects in KMotion Versions 4.34a and later have now been updated and should work out-of-the-box with VS2015.'''&lt;br /&gt;
&lt;br /&gt;
[[PC Example Applications|More information.]]&lt;br /&gt;
&lt;br /&gt;
===KMotion Libraries - GCode Interpreter - Trajectory Planner - Coordinated Motion - .NET===&lt;br /&gt;
The KMotion Libraries are a series of DLLs (Dynamic Link Libraries) that reside on the PC that contain the common core motion control, I/O, and communication functionality for KFLOP.  These libraries permit PC Applications to be built using high level control without being concerned with the underlying details of Interpreting GCode, Trajectory Planning, Coordinated Motion, Motion Buffering, USB Communication, etc.&lt;br /&gt;
&lt;br /&gt;
[[KMotion Libraries - GCode Interpreter - Trajectory Planner - Coordinated Motion - .NET|More information]].&lt;br /&gt;
&lt;br /&gt;
===Kinematics===&lt;br /&gt;
The KMotion Libraries contain a Kinematics Layer where Users can add their own non-linear Kinematics&lt;br /&gt;
&lt;br /&gt;
[[Kinematics|More information]].&lt;br /&gt;
&lt;br /&gt;
===KFLOP C Programs===&lt;br /&gt;
C Programs provide a powerful and flexible capability to perform almost any sequence of operations within KFLOP.   In most cases after you have tested and tuned all your hardware using the KMotion.exe setup program all the settings and initialization steps required for your system can be placed into an Initialization C Program so that your system can be fully initialized simply by executing the Initialization program.&lt;br /&gt;
&lt;br /&gt;
[[KFLOP C Programs|More Information]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ModBus===&lt;br /&gt;
Modbus can be connected to the PC or directly to KFLOP.  A PC connection will not be deterministically real-time but may work for basic speed control and on/off.  Here is a related Thread for interfacing KMotionCNC to Modbus using a [http://www.modbusdriver.com/modpoll.html free utility]:&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/sending%20ModBus%20msgs%20from%20KmotionCNC%20to%20a%20RS485%20port.html Sending ModBus msgs from KmotionCNC to a RS485 port]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To connect Modbus directly to KFLOP's [http://www.dynomotion.com/Help/RS232/RS232.htm UART] see the C Examples in \C Programs\RS232\ModBus\&lt;br /&gt;
&lt;br /&gt;
===Linux Support===&lt;br /&gt;
KMotion Motion Libraries are fully supported under Microsoft Windows. Some Users have ported the KMotion Libraries to Linux.  Dynomotion will offer support where possible but can't offer full support under Linux.  Special Thanks to [https://github.com/parhansson/KMotionX Par Hansson] for the initial Linux Port.&lt;br /&gt;
&lt;br /&gt;
See [[Linux|here]] for more info.&lt;br /&gt;
&lt;br /&gt;
==Dynomotion Hardware Topics==&lt;br /&gt;
===General Hardware Information===&lt;br /&gt;
====[[KFLOP Hardware Info|KFLOP specific Hardware Info]]====&lt;br /&gt;
====[[KStep Hardware Info|KStep specific Hardware Info]]====&lt;br /&gt;
====[[Kanalog Hardware Info|Kanalog specific Hardware Info]]====&lt;br /&gt;
====[[SnapAmp Info|SnapAmp specific Hardware Info]]====&lt;br /&gt;
====[[Konnect Hardware Info|Konnect specific Hardware Info]]====&lt;br /&gt;
&lt;br /&gt;
===Wiring Diagrams===&lt;br /&gt;
[[Media:Kanalog_Connections.pdf|Basic Kanalog DAC and Encoder Connections 3 Axis]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KanalogSchematic3Axis.pdf|Basic Kanalog DAC and Encoder Connections 3 Axis #2]]&lt;br /&gt;
&lt;br /&gt;
[[Media:dyn4 kanalog KE1524 V1.1.png|Basic Kanalog DAC and DMM DYN4 Drive 1 Axis]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Kflop-Kanalog_wiring_11-19-2018.pdf|Kanalog with Geckos G210 updated 11-19-2018]] (Thanks to &amp;lt;span style=&amp;quot;color: windowtext;&amp;quot;&amp;gt;Joseph Mirocha&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog_to_Tree_Journeyman_325_by_Rick_B.pdf|Kanalog to Tree Journeyman 325.pdf]] (Thanks to &amp;lt;span style=&amp;quot;color: windowtext;&amp;quot;&amp;gt;Rick_B&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Media:KFlopSnapBrushMPG.pdf|KFLOP+SnapAmp DC Brush Motors with MPG]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Stepper_Wiring_Diagram_Step-Dir_on_JP5.pdf|KFLOP JP5 Open Collector Step/Dir Connections to Power Step PSD5042-2P Drives ]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Matrika_V1_wiring_diagram_Rev1.pdf|KFLOP+KStep with VFD and NPN Limit Switches for Matrika Rev1]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KonnectTouchPlate.png|Touch Plate Wiring to Konnect]]&lt;br /&gt;
&lt;br /&gt;
[https://easyeda.com/350banshee/BreakoutBoard-93bdd16e3c3d48b98ae66c34f2436c40 User Created KFLOP JP7 Breakout/OptoIsolation Board] Schematic, Gerbers, PCBs Publicly available (thanks 350banshee)&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/wiki/index.php?action=ajax&amp;amp;title=-&amp;amp;rs=SecureFileStore::getFile&amp;amp;f=/b/bb/RotarySwitchToKanalog.png Rotary Switch Connected to Kanalog Opto Inputs]&lt;br /&gt;
&lt;br /&gt;
===3D Board Models===&lt;br /&gt;
[[Media:kflop-kstep-3d-models-1.snapshot.3.zip.txt|kflop-kstep-3d-models-1.snapshot.3.zip.txt]]  STEP file format - Thanks to Curtis&lt;br /&gt;
&lt;br /&gt;
[[File:kflop_kstep_render.JPG|none|link=|329x329px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:KFLOP3D_Step_IGS_Chris.zip.txt|KFLOP3D_Step_IGS_Chris.zip.txt]] STEP and IGS models - Thanks to Chris&lt;br /&gt;
&lt;br /&gt;
[[File:KFLOP_3D.png|none|link=|413x296px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:KONNECT_BOARD_MODEL.zip.txt|KONNECT_BOARD_MODEL.zip.txt]] STEP model - Thanks to Jeff Redington&lt;br /&gt;
&lt;br /&gt;
(Component locations may be off one way or another by .5mm)&lt;br /&gt;
&lt;br /&gt;
[[File:Konnect_Board.png|none|link=|339x292px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Konnect Basic Step file showing hole locations&lt;br /&gt;
&lt;br /&gt;
[[Media:KonnectHoles.stp.txt|KonnectHoles.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KonnectHoles.png|none|link=|352x323px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kanalog Step Model with Mechanical hole and Pin locations&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog.stp.txt|Kanalog.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KanalogFromStep.png|none|link=|304x279px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kanalog Step Model with Mechanical hole and Connectors (Thanks to&lt;br /&gt;
&lt;br /&gt;
Roberto Gotti of Powertech)'''&amp;lt;br /&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
[[Media:KANALOG_BOARD.stp.txt|KANALOG_BOARD.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KanalogWithConnectors.png|none|link=|311x286px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Board Terminal DXF/DWG files===&lt;br /&gt;
[[Media:KFLOP_Terminals.dxf|KFLOP_Terminals.dxf]] [[Media:KFLOP_Terminals.dwg|KFLOP_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog_Terminals.dxf|Kanalog_Terminals.dxf]] [[Media:Kanalog_Terminals.dwg|Kanalog_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Konnect_Terminals.dxf|Konnect_Terminals.dxf]] [[Media:Konnect_Terminals.dwg|Konnect_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KStep_Terminals.dxf|KStep_Terminals.dxf]] [[Media:KStep_Terminals.dwg|KStep_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
===Wiring Topics===&lt;br /&gt;
Place links to pages on wiring inputs and&lt;br /&gt;
&lt;br /&gt;
outputs specific to your experiences and projects.  Be descriptive with page titles and links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====KFLOP IDC Connectors and Cables====&lt;br /&gt;
Cables that connect between Dynomotion boards are normally included when purchasing the boards together. They are also very common and easy to make. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Use '''16-conductor or 26-conductor ribbon cable''' (0.05 inch pitch 26 AWG preferrably or 28AWG) and IDC sockets.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;[[File:RibbonCable.png|none|link=]]&lt;br /&gt;
16 conductor ribbon cable 3M part number 3801/16 100 &amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/3m/3801-16-100/3M156105-100-ND/1107501&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;26 conductor ribbon cable 3M part number C3801/26 100 &amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/3m/C3801-26-100/C3801-26-100-ND/1107648&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Winford also sells ribbon cable (although only the thinner 28 AWG):&amp;lt;br /&amp;gt;http://www.winford.com/products/rib.php&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Note you can usually tear off wires to reduce the number of conductors. For example from 26 down to 16. Tear off the conductors away from the red stripe that marks pin 1.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;The '''crimp tools''' are common:&amp;lt;br /&amp;gt;https://www.amazon.com/Accessories-Crimp-Ribbon-Cable-Connectors/dp/B007R2JEM4/&amp;lt;br /&amp;gt;[[File:RibbonCrimp.png|none|link=]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;'''IDC Sockets 16-pin '''(pin pitch 0.1 inch)&amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/assmann-wsw-components/AWP-16-7240-T/HHKC16H-ND/5031953&amp;lt;br /&amp;gt;Assman Part number AWP 16-7240-T&lt;br /&gt;
[[File:16pinIDC.png|none|link=]]&lt;br /&gt;
https://www.digikey.com/product-detail/en/assmann-wsw-components/AWP-26-7240-T/HHKC26H-ND/5011313&lt;br /&gt;
[[File:26pinIDC.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
====KFLOP KStep JR1 Molex Power Connectors====&lt;br /&gt;
KFLOP and KStep JR1 are standard Disk Drive Power Connectors. Possibly one of the most common connectors. Originally used on PC ATX Power Supplies. Sometimes referred to as Molex Connectors. They have 4 pins with 0.2 inch pitch with 0.083~0.084 inch socket pins. The mating cable will have female socket pins as shown here:&lt;br /&gt;
&lt;br /&gt;
[[File:Molex_female_connector.jpg|none|link=|251x168px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Molex Series 8981 P# [https://www.digikey.com/short/zjp329 0015244048]  using Molex Series 8980 Crimp Pins P# [https://www.digikey.com/short/zjp3ff 0002081201]&lt;br /&gt;
&lt;br /&gt;
Also AMP Series MATE-N-LOK P# [https://www.digikey.com/short/zjpq3n 1-480424-0] using AMP Series MATE-N-LOK Crimp Pins P# [https://www.digikey.com/short/zjpqqw 60619-1] or P# [https://www.digikey.com/en/products/detail/molex/0194200002/2404783 194200002]&lt;br /&gt;
&lt;br /&gt;
Molex Crimp Tool P# [https://www.digikey.com/en/products/detail/molex/0640160035/665311 0640160035]&lt;br /&gt;
&lt;br /&gt;
====MPG Wiring and Interface====&lt;br /&gt;
MPGs (Manual Pulse Generators) should be connected directly to KFLOP for guaranteed real-time response (not USB based or connected to the PC).  MPGs are handled by a C Program that monitors the MPG and creates motion based on the MPG Encoder changes and switch selections for axis, speed, and so forth.  See the MPG C Program Examples.  Here is a Discussion with other links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/Jogging%20Pendant.html Jogging Pendant]&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/Connecting%20Keling%20MPG2%20pendant.html Connecting Keling MPG2 Pendant]&lt;br /&gt;
&lt;br /&gt;
[https://www.cnczone.com/forums/dynomotion-kflop-kanalog/349740-applying-acceleration-mpg-target-possible.html#post2119732 CNCZone Thread] on obtaining smooth filtered motion.&lt;br /&gt;
&lt;br /&gt;
[[File:MPG4_from_cnc4pc.jpg|none|link=|83x169px]]&lt;br /&gt;
&lt;br /&gt;
====Interfacing NPN Devices to KFLOP IO====&lt;br /&gt;
NPN devices (open collector)operate as a switch to GND and can be interfaced to KFLOP using a pull up resistor as shown below. When the transistor switches to 0V the KFLOP IO Pin is driven low. The transistor will need to sink ~3ma. When the transistor is off (open circuit) the resistor pulls the IO Pin to 3.3V. Note even though some KFLOP IO Pins can tolerate 5V pulling them above 3.8V should be avoided when possible so the 3.3V supply is used. This technique will only work with KFLOP IO Pins that do not have pull down resistors (JP7 and JP5). In some cases a 0.1uF Ceramic capacitor connected close to KFLOP might be added in parallel with the resistor to filter noise.  Cable shielding connected to KFLOP GND on the KFLOP end only is recommended.  Note that in noisy environments this technique may couple noise into KFLOP so opto isolation should be used instead.&lt;br /&gt;
&lt;br /&gt;
[[File:NPN_Interface_to_KFLOP.png|none|link=|544x544px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Multiplexing Encoder Inputs to KFLOP JP4 and JP6====&lt;br /&gt;
If KFLOP JP7 and JP5 are used for other purposes the encoder inputs can be multiplexed to KFLOP JP4 and JP6. There is an option to multiplex encoders 0-3 from JP7 to JP4 and another option to multiplex encoders 4-7 from JP5 to JP6. See the MuxEncoders.c for an example.&lt;br /&gt;
&lt;br /&gt;
Note the JP4 and JP6 IO are 3.3V inputs and shouldn't be driven hard (more than 10ma) above 3.8V. This is not usually an issue as most encoders or RS422 drivers don't do this. The inputs also have 150 ohm termination.&lt;br /&gt;
&lt;br /&gt;
The following line of code might be added to your Initialization C Program. It needs to be executed once to multiplex the encoders after any power cycle. Encoders 0-3 will then be input on JP4 and 4-7 will be on JP6. Both JP4 and Jp6 have 10 IO bits. The 4 encoders will appear on the first 8 IO bits. 2 bits for each encoder's A B channels in order. So for example Encoder #0 will appear on JP4 IO16 (Pin5) and IO17 (Pin6)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt; &lt;br /&gt;
// Mux encoder inputs from KFLOP JP7 &amp;amp; JP5 to JP4 and JP6&lt;br /&gt;
FPGAW(ENC_NOISE_FILTER_ADD) = ENC_0_3_JP4 + ENC_4_7_JP6 + ENC_NOISE_FILTER_DEFAULT_VAL; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JP4 and JP6 have +5V available on Pin1 and GND on Pins 8 and 9 that might be used to power 5V encoders.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span id=&amp;quot;Axes_Servo_Tuning_and_Trajectory_Planner&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axes Servo Tuning and Trajectory Planner&amp;lt;/span&amp;gt;==&lt;br /&gt;
===Basic Servo Tuning Overview===&lt;br /&gt;
Once an axis is configured and proved capable of holding a position it is ready to be tuned and optimized. Most often a small value of P Gain only is used to show the servo is functional and can hold position. The Servo may be very weak and inaccurate but will be functional.&lt;br /&gt;
&lt;br /&gt;
Every system is different and the tuning parameters are interactive in a manner that usually doesn't allow parameters to be determined one at a time. Rather after one parameter is changed it may be necessary to revisit the other parameters.&lt;br /&gt;
&lt;br /&gt;
In general higher gains will reduce errors and improve accuracy, but tend to make the system more unstable.  So the general idea is to increase gains to reduce errors as much as possible but still have a stable system.&lt;br /&gt;
&lt;br /&gt;
Often during tuning the system may go unstable. In fact, it is normally intentionally driven to instability to find its limits for a certain parameter. This can result in a violent oscillation or worse so one should be prepared to quickly disable the Servo. If an appropriate [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Max_Following_Error Max Following Error] is used the axis can be automatically disabled before the oscillation becomes too violent, yet not disable when performing a normal test.&lt;br /&gt;
&lt;br /&gt;
KMotion.exe allows you to change any axis parameter on the Step/Response, Config, or Filters Screens then simply push &amp;quot;Move&amp;quot; to see the effect of the change.  Note that as performance improves the errors will become small and difficult to see on the Position Plot without Zooming in (Left click drag) so changing the plot type to plot the error is useful.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The overall process normally goes something like this:&lt;br /&gt;
&lt;br /&gt;
# Select a Test [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Measurement Move Size] and [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Motion_Profile Motion Profile].  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Velocity.2C_Acceleration.2C_and_Jerk See Also]&lt;br /&gt;
# Select [http://dynomotion.com/Help/StepScreen/StepScreen.htm#max_limits Max Limits] to allow for the Test.  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Max_Limits_-_Error See Also]&lt;br /&gt;
# Determine maximum level of [http://dynomotion.com/Help/StepScreen/StepScreen.htm#PID P Gain]&lt;br /&gt;
# Determine maximum level of [http://dynomotion.com/Help/StepScreen/StepScreen.htm#PID D Gain] (with Low Pass Filtering)  See Also [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Torque_Servos_vs_Velocity_Servos here] and [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Lead_Compensator_vs_Derivative_Gain here].&lt;br /&gt;
# Determine new maximum level of P Gain now that D Gain increased stability&lt;br /&gt;
# Add I Gain to improve accuracy and remove steady state errors.  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#I_Gain.2FMax_Limit_Integrator See Also]&lt;br /&gt;
# Add [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Feed_Forward Feed Forward] to reduce errors&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Torque Servos vs Velocity Servos===&lt;br /&gt;
+/-10V Analog Amplifiers usually come in one of two varieties: '''Torque''' or '''Velocity'''. Torque mode amplifiers consider the input command as a Torque Command and work to generate the commanded Motor Torque. Velocity mode amplifiers consider the input command as a Velocity Command and work to generate the commanded Velocity.  Its important to understand what type of Amplifiers you have.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Velocity Mode Amplifiers''' need some form of feedback going to the Amplifier in order for the drive to know the current velocity. This might be a digital encoder or an analog tachometer.&lt;br /&gt;
&lt;br /&gt;
Its easy to tell if you have a Velocity Mode Amplifier by looking at a plot of a move on the Step Response Screen.  The Output (green plot with right scale) will be proportion to the motor velocity.  When moving at constant speed the output will be relatively constant.  See in the plot below the output (green) remains at a relatively constant ~1100 DAC counts while the position (red) ramps at a constant slope of the 90000 count/sec rate:&lt;br /&gt;
&lt;br /&gt;
[[File:VelocityAmp.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Velocity mode amplifiers can be relatively easy to tune using only P (Proportional) Gain.  Additional Gains and filters can be used for best performance but using only P Gain will often result in reasonable performance and a stable system (unlike Torque Mode Amplifiers). &lt;br /&gt;
&lt;br /&gt;
As an example consider controlling the speed of a car using only Proportional Gain as it approaches a target (Stop sign).  Consider a P Gain of 0.1 where at 1000ft from the stop sign we command 1000 x 0.1 = 100MPH.  Then at 100ft we command 10MPH.  Then at 10ft we command 1MPH.  This results in a nice, smooth, exponential approach, without overshoot.&lt;br /&gt;
&lt;br /&gt;
Contrast this with controlling the acceleration (torque) of a car using only Proportional Gain as it approaches a target (Stop sign).  At large distance we apply maximum acceleration.  Although as we approach the stop sign we reduce acceleration, we continue to accelerate and speed continues to increase until we pass the stop sign.  Torque mode servos are inherently unstable.  P only gain only works at all if there is some friction (the car is dragging a sled which slows us down with less torque).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Acceleration Mode Servos''' may or may not have any feedback.  If they have feedback it is usually used only to commutate a brushless motor.  In the plots the Output (green) will have large magnitude when the Position (red) is accelerating, where the plot has curvature (changing slope).&lt;br /&gt;
&lt;br /&gt;
Acceleration mode Servos are unlikely to work well or at all with only P Gain.  Some form of damping or lead compensation will usually be required to get a stable system.   D (derivative) Gain (or a lead compensator) should be included with the P Gain to help stabilize the system.  D Gain can be increased to make the system more stable up to a point.  After some point the additional D Gain will make the system more unstable. and should be reduced.&lt;br /&gt;
&lt;br /&gt;
When using D Gain (or lead compensation) the quantization noise (steps) in the encoder position can cause spikes in the output.  For example a D Gain of 100 will cause a spike of 100 counts in the output whenever the input changes suddenly by 1 count.  If the spikes are very high amplitude and short duration, the Amplifier may not handle them in the expected manner.  A low pass filter can be used to widen and reduce their amplitude allowing the amplifier to handle them more effectively.  Typically a 2nd order low pass filter of 500Hz Q=1.4 is used.  The last filter is normally used so it is applied to any Feed Forward. Such as:&lt;br /&gt;
&lt;br /&gt;
[[File:LowPass400Q1p4.png|none|link=|680x439px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;Velocity.2C_Acceleration.2C_and_Jerk&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Velocity, Acceleration, and Jerk&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;div id=&amp;quot;yui_3_16_0_1_1445622719616_3315&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;The Velocity, Acceleration, and Jerk in the Step Response Screen (KFLOP parameter settings) and the Acceleration and Velocity in the KMotionCNC | Tool Setup | Trajectory Planner | Axis Parameters are both used for different things.  The two sets of parameters are independent. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;yui_3_16_0_1_1445622719616_3313&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;The&amp;lt;/span&amp;gt; KFLOP parameters are used for 3rd order motions.   These include things like:  Jogging, Homing, and GCode Rapids (G0).  The units in KFLOP are in counts or steps.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span id=&amp;quot;yui_3_16_0_1_1445622719616_3320&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;The KMotionCNC parameters are used for 2nd order (&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;yui_3_16_0_1_1445622719616_3321&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;infinite &amp;lt;/span&amp;gt;Jerk) coordinated motion paths.  These are GCode G1,G2,G3 continuous paths.  The units are in Inches (or in some cases degrees).   Note there is an Option in KMotionCNC &amp;quot;Rapids as Feeds&amp;quot; where these parameters will also be used for Rapids.  But this option should only be used for highly non-linear Kinematic Systems which can not take advantage of faster/smoother 3rd order point to point straight line Rapids.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;Tests&amp;lt;/span&amp;gt; to find and verify optimal settings for both types of moves should be made using the Step Response Screen.  Optimal settings are usually determined by experimentation.  Although it might be possible to calculate the settings based on motor torque gains, back-emf, amplifier voltage/current, mass, moments of inertia, friction, encoder resolution, leadscrew pitch, required following accuracy, etc... It is often too complicated and with too many unknowns to be practical.  So experimental moves can be tested at ever increasing Velocities, Accelerations, and Jerks until the system is unable to follow the trajectory without having too much error or shock to the system.  After absolute limits of the system are determined then the settings should be backed off by some amount to provide operating margins (ie 20%).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;It is usually best to first determine max possible velocity using a relatively low acceleration. Maximum power is usually required at the point of the trajectory where velocity is high and still accelerating.  Supply Voltage limitations tend to limit velocity.  Current limitations tend to limit acceleration.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[File:MaxVelAccelPower.png|none|link=|485x361px]]&amp;lt;br /&amp;gt;The Step Response Screen always performs 3rd order motion but 2nd order motion can be simulated by temporarily setting the Jerk to a huge value (1000X the acceleration value).  In general reducing the Jerk value will result in longer times to perform motions, but often the improved smoothness will permit higher maximum accelerations and velocities to be used resulting in overall shorter motion times.  An analogy might be how you might stop more quickly in a car, without skidding or spilling your coffee, by applying the brakes harder in a more gradual manner rather than slamming on the brakes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;Make&amp;lt;/span&amp;gt; sure when testing the size of move is long enough for full acceleration and velocity are achieved.  A common mistake is to have Acceleration or Velocity Settings set to too high for your system but when testing a short move there is no indication of a problem.  The plot mode of Velocity Output  vs Time can be helpful to verify full Velocity is being achieved.&amp;lt;span id=&amp;quot;.C2.A0&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt; &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;The idea is that a motor axis has torque and speed limitations and you should determine and understand what they both are for your system. Available motor torque drops off with higher speed. At some speed the motor will not even be able to generate any torque at all. Motor torque is required to accelerate the axis. We need to make sure that no combination of velocity and acceleration will ever cause the axis to fault/stall/fail. So there is often a complex set of speeds and accelerations that will work ok that form an envelope of workable speed and acceleration. So one nice thing to know is top speed possible. It is like taking your car out on a long straight highway and gradually accelerating to find the max speed is 100MPH. You will then know that ever attempting a speed over 100MPH will always fail. Also speed should probably be limited to something like 80MPH to allow for margin and to allow reasonable acceleration up to that speed. The reason for performing the top speed test at low acceleration is to avoid a failure because of not being able to accelerate at the specified rate. So we want to set the acceleration to a low value so it will not be a limiting factor when determining top speed. However if we set the acceleration so low with a short trip distance we will never go very fast and the speed test will be meaningless. This should be avoided. Change the Plot type to Velocity, Output, vs Time to clearly see if this is the case.  You may want to turn off Measured Velocity if it obscures viewing the Commanded Velocity&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;For example to accelerate to 700,000 counts/sec at an acceleration rate of 700,000 counts/sec^2 would take 1 second. And then to slow back down would take 1 more second. So at least 2 seconds of motion would be required to get to full speed. A 100,000 count move (2 inches for a system with 50,000 counts/inch) takes much less time than that. Furthermore with a relatively low Jerk setting (1e6). This means the acceleration will be applied gradually over 0.7 seconds. This means an even much longer time and distance would be required to achieve top speed.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Here is the method to follow to find 2nd/3rd order motion profile limits:&amp;lt;br /&amp;gt;(note every system is different and will vary based on resolution, motor size/type, mass, etc...)&lt;br /&gt;
&lt;br /&gt;
'''1 - Find Max Velocity at low Acceleration and infinite Jerk'''&lt;br /&gt;
&lt;br /&gt;
Choose a Velocity to test (ie V=100000 counts/sec)&amp;lt;br /&amp;gt;Set a moderately low Acceleration Time of 1 second (A = V/1sec = 100000 counts/sec^2)&amp;lt;br /&amp;gt;Set very high Jerk so Acceleration is applied almost instantaneously in 0.001 sec (J = A/0.001sec = 1e8 counst/sec^3)&amp;lt;br /&amp;gt;Test a very long move 20 inches if possible (for resolution 50000 counts/inch, 1,000,000 counts)&amp;lt;br /&amp;gt;Plot Velocity, Output, vs time to see if V is actually obtained&amp;lt;br /&amp;gt;If the motion was successful repeat all above with higher V, if not try lower V&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Once Max V is found reduce by some margin (ie 20-50%)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Note you may decide on lower speed for other reasons (safety, vibration, noise, wobble, shock, etc....)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;'''2 - Find Max Acceleration for your system for the chosen Velocity'''&lt;br /&gt;
&lt;br /&gt;
Using the V found above increase A (keeping Jerk high in the same manner) until the system fails/faults/excessive shock, etc...&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Once Max A is found reduce by some margin (ie 20-50%)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;These V and A Values are now known good values for your system and can be used for 2nd order motions such as KMotionCNC Trajectory Planner or Mach3 Motor tuning. Note units will need to be converted (counts to inches or mm, time from seconds to minutes depending on the App)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3 - Find optimal 3rd order Jerk limited motions.'''&lt;br /&gt;
&lt;br /&gt;
The previous result from Step #1 and #2 used nearly infinite Jerk where Acceleration forces were applied nearly instantaneously. By reducing Jerk smoother motion should be possible. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Set Jerk so it is applied over 20ms (ie for A=200000 J = A/0.020 = 1e7&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Test to see if motions are smoother. With closed loop systems the Position Error Plot can be used to see if the motion has less error and is smoother. Open loop system will require you to hear the difference.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Increase/decrease Jerk to find the optimal value. Note reducing Jerk a lot will of course make the system very smooth, but will also be much slower using less acceleration and velocity which is undesirable. So the highest Jerk possible should be found that still provides some smoothness.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Reducing Jerk only will always make the system slower with less performance (but hopefully significantly smoother). It is usually then possible to increase Acceleration and Velocity somewhat to achieve even higher performance than what was possible with infinite Jerk while being as smooth or smoother.&lt;br /&gt;
&lt;br /&gt;
'''4 - Reduce Max Following Error Limit to small value'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;Now that the system is properly tuned and reasonable Acceleration, Velocity, and Jerk are set the motor Position should always follow the commanded Destinations accurately with only small errors.  By Plotting Position Errors under various conditions (Distances) you can get an idea of the worst case following errors under normal conditions.  The Max Following Error Parameter should be set to a value slightly larger than the worst case following error (ie 20~50% larger).  In this case if anything abnormal occurs: ie. The axis hits an obstacle, commanded at too high of a speed, servo goes unstable, hardware/electronics failure, a Following Error will be immediately detected and the axes disabled.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axis Resolution - counts/inch (or counts/mm)&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Its important to understand the resolution of your Axis which is the number of fundamental raw motor/driver encoder counts or motor steps per standard unit of distance (inch or mm).  Although tuning in KMotion.exe Step Response Screen and motions within KFLOP typically use units of raw counts or steps it is important to know how these translate to real-world distances, speeds, etc...  Later, applications such as KMotionCNC or Mach3 will need this information to scale motions properly.&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;There are usually a number of factors that combine together to determine the Axis Resolution.  These might include:&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;counts or steps per motor revolution&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;any gearing or belts and pulleys involved between motor and drive mechanisms&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;lead screw pitch, rack and pinion tooth pitch, drive belt radius, etc.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For example consider a Stepper Drive with:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;3200 steps per motor rev&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;2:1 gear reduction from motor to lead screw&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;0.2 inch lead screw pitch&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axis Resolution = 3200 step/motor rev x (2 motor rev/ screw rev)  / (0.2 inch / screw rev) = 32000 steps/inch&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;To determine whether your assumptions and calculations are correct perform a test.  Command as large of a move as convenient and measure the actual distance moved with a ruler.   For example in the axis described above you might command a move of 320000 steps.  This should result in a motion of:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;320000 steps / (32000 steps/inch) = 10 inches.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For KMotionCNC set the Axis Resolution in the [http://dynomotion.com/Help/KMotionCNC/ToolSetupScreenTP.htm#Axis_Motion_Parameters Tool Setup | Trajectory Planner Screen | Axis Parameters | cnts/inch].  Note units must be in units of inches.  If your resolution is in mm units multiply by 25.4.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For Mach3 enter the Axis Resolution in the Configuration | Motor Tuning Screen.  Make sure the setup units (not GCode units) match the mode of your values.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Servo Dither/Hunting - (oscillation around zero error)===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;Servos have high accuracy because they are always actively trying to make corrections and drive the error to zero.  Unfortunately this can sometimes cause annoying dither or position hunting around zero when not moving.  This is a very complex non-linear effect dependent on the dynamics of the mechanics.  Because of the highly non-linear quantization effects of single &amp;quot;steps&amp;quot; in the encoder position, stiction, backlash, etc. it follows different rules and is harder to analyze than normal servo tuning/stability in the larger magnitude more linear regime.  For example attempting to apply &amp;quot;Damping&amp;quot; is unlikely to work.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Lowering gains will usually help at the expense of performance.  However in many cases more than acceptable performance can be achieved with lower gains so one should consider if the higher gains are really needed.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;KFLOP has a Deadband Gain and Range feature that can basically be used to tell the servo to not attempt to correct small errors (treat the errors as zero), or to try to correct them less aggressively (with a Gain less than 1.0).  See [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Dead_Band here for more information]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Unfortunately adding Deadband doesn't always help the servo &amp;quot;sit still&amp;quot; and may actually increase the size of the dither depending on the dynamics.&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that when the servo is commanded to a non integer position ie 999999.7 encoder counts without deadband the servo will always be making corrections.  The best the servo can do is dither between encoder positions 999999.0 and 1000000.0.  With an error of either -0.7 or +0.3.  A servo with Integrator gain will guarantee the average is 999999.7&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;If dither is still a major problem a C Program might be used to monitor things and change settings under certain conditions to reduce dither.  See the example AntiServoDither__ALL.c which monitors for small errors for a period of time and if so reduces or turns off Integrator gain.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
===Noisy GCode - Trajectory Planner Smoothing===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;An analysis of Quantization Noise in GCode and Trajectory Planner Settings to generate smooth motion.&amp;lt;br /&amp;gt;[[File:GCode_Noisy_Path.png|none|link=|432x432px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[Trajectory Planner Smoothing Noisy GCode|See Analysis and Solution]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===Arc &amp;quot;faceting&amp;quot; - Trajectory Planner - Collinear Tolerance===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[File:ArcsTrajectoryZoomXTol.0005.png|none|link=|526x460px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[ArcFacetingColinearTol|See Analysis and Solution]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===I Gain/Max Limit Integrator===&lt;br /&gt;
I (Integrator) Gain can be used to eliminate persistent errors.  In fact any Integrator Gain at all guarantees the average error over infinite time is zero.  Without I Gain a system might have a small error that does not create enough output to overcome stiction to make a correction.  In such a case the error could persist forever.  Not so with any Integrator Gain.  Any error will be integrated and ramp the output higher and higher until eventually there will be a correction.  That assumes the Integrator or Output doesn't saturate or reach their programmed limits.  The rate the output ramps (or sums) is dependent on the size of the error and the I Gain value.  The Error x I Gain is summed every servo sample (90us).  This is why I Gain values are often small numbers (0.0001 - 0.01 typical range).  There is no guarantee that the position doesn't over shoot the target Destination.  In fact it is likely as as any error (area) under the trajectory will always be balanced by an equal area over the trajectory.  Too high of I Gain will make the system unstable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another case where I Gain is useful is when moving at high speed with a Velocity Amplifier.  To move at high speed a significant amount of output is required.  Without I Gain a significant amount of error could be required to provide this Output (ie Error x P Gain = Output).    With I Gain the Integrator will eventually ramp up to provide any Output necessary to move at the desired speed driving the error to zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Integrators have an issue often referred to as &amp;quot;Integrator Wind Up&amp;quot;.  This issue usually doesn't arise under normal conditions.  However if something is preventing the servo from making a correction such as forcing the position away from the target for a sustained amount of time, or disabling the amplifier, the Integrator will integrate to a huge unlimited value.  When the force is removed or amplifier re-enabled, the Integrator will likely cause a violent motion and overshoot.  Max Limit Integrator can help to minimize this issue by limiting the amount the Integrator can ramp up to.  So the Max Limit Integrator Value should be set at the minimum value that can still allow the Integrator to function in normal circumstances.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Typically there are two cases that should be considered when determining the Max Limit Integrator. &lt;br /&gt;
&lt;br /&gt;
# The amount of output expected to be required to overcome any stiction, friction, or other forces (cutting, gravity, etc...).  This is often not a large value and can be estimated or can be observed from the Step Response Screen (green plot right side scale is the output) when making a move.&lt;br /&gt;
# The amount of output required to provide the output needed to move at speed.  It is important to note that D Gain provides a damping or drag effect on the Output.  So the Integrator must be able to ramp up to a sufficient level to overcome the damping or drag effect and still provide enough output to move at the commanded speed.  For example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assume:&lt;br /&gt;
&lt;br /&gt;
# Commanded speed of 500,000 counts/sec&lt;br /&gt;
# D Gain of 35&lt;br /&gt;
# Output required to move at speed is 1800 DAC Counts&lt;br /&gt;
# Servo Sample Time of 90us&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Damping effect = Speed x D Gain x Sample Time = 500000 x 35 x 90e-6 = 1575 counts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Required Integrator Value = 1800 + 1575 = 3375&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So to provide some margin an Max Limit Integrator Value of 3500 might be used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Max Limits - Error===&lt;br /&gt;
Max limits error can be helpful to have your system respond less violently in the abnormal event where an excessively large error occurs.  Normally with a properly tuned system following errors should be small.   Setting a Max limits error can cause the servo to treat errors beyond a specified limit as if they were only the size of the limit and therefore respond less so than they would otherwise.  The max limits error is normally set to a value so it is not limiting under normal circumstances.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Plot below shows a situation where a small max limits error combined with a low P gain severely limits the Output.  In the plot below a large move (10000 counts) at a high speed (40000 counts/sec) is commanded.  Only P Gain (0.2) is used to provide the Output (green).  The max error limit of 200 combined with the low gain (0.2) limits the output to only 40 DAC counts.  Even as the true error increases to many thousands of counts, the servo is told to ignore the amount over 200.  So the output can never exceed 40 DAC counts.  The 40 DAC count limit means that the Axis is therefor not capable of providing the output necessary to keep up with the commanded motion.  The axis does the best it can with the limited output, and only does a fraction of the desired motion.&lt;br /&gt;
&lt;br /&gt;
[[File:Move10000.png|none|link=|665x431px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After increasing the max limits error the Output (green - right scale) now goes to a much higher value (900), and the Position (red) follows the Command (blue) to a much better degree.&lt;br /&gt;
&lt;br /&gt;
[[File:Move10000_nolimit.png|none|link=|667x430px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Increasing the P Gain to 1.6 also applies more Output sooner and the Position follows the command still better.&lt;br /&gt;
&lt;br /&gt;
[[File:Move1000_p1.6.png|none|link=|667x432px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Lead Compensator vs Derivative Gain===&lt;br /&gt;
Derivative (D) Gain is often used to help stabilize a system.&amp;amp;nbsp; It helps to think in the Frequency Domain to help understand how the two forms of compensation help.&amp;amp;nbsp; Please read below and [http://dynomotion.com/Help/BodeScreen/BodeScreen.htm this] for more information on the Frequency Domain.&amp;amp;nbsp; Both Compensation methods add positive phase to help stabilize the system.&amp;amp;nbsp; Unfortunately both methods increase gain at higher frequencies possibly causing the system to go unstable at higher frequency.&amp;amp;nbsp; A Lead Compensator provides the benefit of positive phase but without as much gain increase at higher frequencies.&amp;amp;nbsp; This figure shows a simplified Gain Plot comparison:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:DGainvsLead.png|none|link=|593x593px]]&lt;br /&gt;
&lt;br /&gt;
Here is a Bode Plot of a P=0.5 D=20 Compensator.   Note the KMotion.exe Bode Plot Screen has the capability of plotting the Frequency Domain Response of the PID+Filters Compensation.  Assume we desire positive phase to be added at 40Hz.  Notice the positive phase of 40 degrees at 40Hz which is good.  However the Gain increase in the 1KHz region of about 21db which is bad.&lt;br /&gt;
&lt;br /&gt;
[[File:P.5D20Annotate.png|none|link=|621x460px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a Bode Plot of a P=0.5 N1=N2=25Hz D1=D2=70Hz Compensator.   Assume we desire positive phase to be added at 40Hz.  We choose N1 N2 and D1 D2 to surround the frequency where the positive phase is desired.  Moving them further apart will increase the amount of positive phase but also increase the added Gain.  Notice the positive phase of 60 degrees at 40Hz which is good.  However the Gain increase in the 1KHz region of about 12db which is bad.  However both are improvements over the D Gain compensator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:PoleZeroFilter.png|none|link=|210x319px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:P.5D0N25D70Annotate.png|none|link=|644x478px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Tuning Master/Slave Configurations===&lt;br /&gt;
Master/Slave [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Master/Slave_Settings Configurations] allow two (or more) motors to drive the same axis.  Slaves are configured to follow a Master Axis.  For example two lead screws on both sides of a gantry.&lt;br /&gt;
&lt;br /&gt;
Tuning slaved axes is kind of a catch 22.  In order to tune one axis the other axis must be tuned well enough to follow and vice versa.  If possible, disconnect any mechanical linkage between the Master and Slave and test them separately without Slaving the Axes together to verify each axis Servos (can hold a position), moves at least somewhat properly, and moves in the same direction (assuming a positive [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Master/Slave_Settings Slave Gain] will be used).&lt;br /&gt;
&lt;br /&gt;
It is usually possible to incrementally tune each axis, at first moving slowly, then later at higher speeds, accelerations, and gains.  Only the Master Axis can be tested with the [http://dynomotion.com/Help/StepScreen/StepScreen.htm Step Response Screen].  This is because the Slave will follow any movement of the Master, but the Master will not follow movement of the Slave.  So if the Master Axis is moved all is well as both axes will move together, but if you try to move the Slave axis the two axes will fight.  The Master fighting to stay where it is, and the Slave fighting to move.&lt;br /&gt;
&lt;br /&gt;
To test/tune the Slave axis temporarily reverse the Master/Slave roles to make it the Master and then test it as the Master.&lt;br /&gt;
&lt;br /&gt;
Note: only the Master Axis should be included into the Coordinated Motion System.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Bode Plots===&lt;br /&gt;
A Bode Plot is a powerful tool for characterizing and providing insight into a dynamic system. It can help determine closed loop stability, bandwidth/performance, resonant frequencies, and more. It is entirely based on the system being linear. Linear in the sense that if the amplitude of some input signal is changed then the output signal will change proportionally as well. Unfortunately most systems are not entirely linear. Stiction, backlash, encoder quantization, amplifier saturation, and other effects are non-linear. For example driving a system with a signal too small to overcome stiction will result in no output at all whereas a larger signal will result in some output. This is clearly non-linear behavior. It would be nice to use a technique that handles non-linear systems but basically none are known.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;A Bode Plot is made injecting a stimulus to the system and observing how the system responds. For the reasons of non-linearity it is very important to perform a Bode Plot measurement using a representative level of stimulus similar to what the system will actually have during normal operation. If the Stimulus is not adjusted properly the result is likely to be completely invalid. Additionally the system should be reasonably tuned and stable so that it is responding in a reasonable way to the stimulus. If the system is unstable or very poorly tuned the result is likely to be completely invalid.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;You might think of it somewhat like shaking a box to determine what is in it. You should shake it with enough intensity and at frequencies to get some reaction, but not so high of intensity to break or distort the object inside.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;To create a Bode Plot use the KMotion.exe Bode Plot Screen. First select Plot: Time domain - Command, Position, Output vs Time and adjust the Amplitude and cutoff Freq until there is small but significant Position (red) changes (ie 50 encoder counts), at a frequency low enough that the Position at least somewhat attempts to follow the Command (blue), and where the Output (green) is not near saturation for the Drive being used.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;After the Stimulus/Noise Injection settings are set switch to Plot: Open Loop - Magnitude and Phase vs Frequency. Set the number of Samples to average (ie 20) and perform a Measurement.&amp;amp;nbsp; [http://dynomotion.com/Help/BodeScreen/BodeScreen.htm See here for more information].&lt;br /&gt;
&lt;br /&gt;
===Links to other Information on Tuning and Bode Plots===&lt;br /&gt;
[http://ctms.engin.umich.edu/CTMS/index.php?example=Introduction&amp;amp;section=ControlFrequency umich.edu Introduction section Control Frequency]&lt;br /&gt;
&lt;br /&gt;
[http://www.motiontech.com.au/assets/pdf/Kollmorgen%20Use%20Control%20Theory%20to%20Improve%20Servo%20Performance%20230712.pdf  Kollmorgen Use Control Theory to Improve Servo Performance 230712.pdf]&lt;br /&gt;
&lt;br /&gt;
==Problems and Resolutions==&lt;br /&gt;
====General====&lt;br /&gt;
:* [[Noise - Typical Problems and Resolutions|Dealing with noise on inputs]].  If you experience issues with inputs misreading, the issue may be noise.  This page provides examples on what might be causing noise issues and examples of how to possibly deal with noise.&lt;br /&gt;
:* Other&lt;br /&gt;
===Software-Specific Problems and Resolutions===&lt;br /&gt;
:* Place links to pages explaining resolutions to problems that are largely software-related here&lt;br /&gt;
[[KFLOP User C Programs Compiling/Launching Slowly because of Windows Defender]]&lt;br /&gt;
&lt;br /&gt;
===Hardware-Specific Problems and Resolutions===&lt;br /&gt;
:* Place links to pages explaining resolutions to problems that are largely hardware-related&lt;br /&gt;
====[[Step/Dir Drives lose 2 Steps for each pair of Direction Reversals]]====&lt;br /&gt;
&lt;br /&gt;
==Applications and Projects==&lt;br /&gt;
:* Place links to pages that explain how you accomplished your particular project.  Write clear explanations that provide background on what you did and how you did it.&lt;br /&gt;
====[[Tool Changer - router linear 4 Tools - C Program]]====&lt;br /&gt;
[[File:LINEAT+ATC.jpg|none|link=|246x178px]]&lt;br /&gt;
More linear milling tools: https://www.ichome.com/&lt;br /&gt;
&lt;br /&gt;
====[[Part Zero &amp;amp; Tool Height Touch Plate|Part Zero &amp;amp; Tool Height Touch Plate]]====&lt;br /&gt;
====[[Driving Hobby Servos]]====&lt;br /&gt;
[[File:HobbyServo.png|left|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
HiTec Type&lt;br /&gt;
&lt;br /&gt;
==Electrical Discharge Machining==&lt;br /&gt;
[https://en.wikipedia.org/wiki/Electrical_discharge_machining EDM (wikipedia)] is a method of cutting materials with high precision and detail.  Dynomotion Motion Controllers work well for EDM because of the ability for feedrate to be dynamically controlled including reversal along cutting path.&lt;br /&gt;
&lt;br /&gt;
[[Information on BAXEDM Arc Generators used with KFLOP]]&lt;br /&gt;
&lt;br /&gt;
Applied Science video that shows how to build an BAXEDM drilling machine using KFLOP and describes how it works:&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|https://youtu.be/rpHYBz7ToII|||||start=980}}&lt;br /&gt;
&lt;br /&gt;
==How to convert a milling machine to a 3D printer in 3 easy steps==&lt;br /&gt;
[[File:CNCto3DPrinter.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
More information [[How to convert a milling machine to a 3D printer in 3 easy steps|here]].&lt;br /&gt;
&lt;br /&gt;
==International and other Languages==&lt;br /&gt;
[[Russian]]&lt;br /&gt;
&lt;br /&gt;
[[Spanish]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/Linear_Table_Correction</id>
		<title>Linear Table Correction</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/Linear_Table_Correction"/>
				<updated>2024-06-24T00:19:08Z</updated>
		
		<summary type="html">&lt;p&gt;TK: /* Linear Table Correction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Linear Table Correction==&lt;br /&gt;
Besides the [https://dynomotion.com/Help/KMotionCNC/GeoCorrection.htm 2.5D Geometric Correction capability] 1D Linear Table corrections can be applied to each axis independently.  Lead Screw mapping fits into this category where there a nonlinear distortion of the commanded axis position to the true position of the axis.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Each or both 2.5D Geo Correction and 1D Linear correction can be applied.  If both are applied then the 2.5D Geo Correction is applied first and then the Actuator positions have 1D Linear corrections applied.  Between Points a linear interpolation is used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is shown an example plot of a correction table for an angular A axis.  The table values contain the commanded positions required to position at the theoretical positions.  For example in the plot below to move to angle 0 the axis actually needs to be commanded to 10 degrees.  To move to 90 degrees the axis would need to be commanded to 95 degrees.  Note these values are exaggerated over what they would typically be for a real system for demonstration purposes.  The example is created using a cosine function where the correction is 0 at -80 and +180 degrees and 10 degrees at 0 degrees.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The actual table contains a list of necessary commanded position but the plot below shows the difference between the commanded positions and the theoretical positions to plot errors and to make the errors more visible.&lt;br /&gt;
&lt;br /&gt;
[[File:CosineCorrection_Excel_Plot.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Below is a fragment of the text file for a Linear Correction Table.  The first 3 lines define the table range.&lt;br /&gt;
&lt;br /&gt;
Line 1 contains the number of commanded positions.  Note that for N ranges N+1 points must be specified.  The example defined 180 2 degree ranges so 181 points are required.&lt;br /&gt;
&lt;br /&gt;
Line 2 defines the size of each range.  In this case 2 degrees.&lt;br /&gt;
&lt;br /&gt;
Line 3 defines the offset or starting point for the table.  In this example it is assumed the useful machine range is from -180 to +180 degrees.  So the Table offset is -180.  The A axis theoretically goes from -infinity to +infinity so it must be specified what range the table should be applied.  If the machine coordinates operated from 0 to 360 degrees then the offset would be 0. &lt;br /&gt;
&lt;br /&gt;
Line 4 through N+3 defines the actual axis commanded values preceded by the point number.  The points may be specified in any order as long as all point numbers are specified.&lt;br /&gt;
&lt;br /&gt;
[[File:MapFile.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
The Tool Setup | Tool/Setup Files | Geo File specifies the root of which files are to be used.   The file name itself specified the name of the 2.5D Geo Correction file.  The Linear Table corrections files are derived from this name by appending: '_X', '_Y', '_Z ', '_A', '_B' or '_C' before any suffix.  So assuming a Geo Correction name of C:\Temp\MapFile.txt the Linear Table Names would be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
C:\Temp\MapFile_X.txt&lt;br /&gt;
&lt;br /&gt;
C:\Temp\MapFile_Y.txt&lt;br /&gt;
&lt;br /&gt;
C:\Temp\MapFile_Z.txt&lt;br /&gt;
&lt;br /&gt;
C:\Temp\MapFile_A.txt&lt;br /&gt;
&lt;br /&gt;
C:\Temp\MapFile_B.txt&lt;br /&gt;
&lt;br /&gt;
C:\Temp\MapFile_C.txt&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br class=&amp;quot;Apple-interchange-newline&amp;quot;&amp;gt;The Software will automatically search for these files and apply corrections for the found files.  The 2.5D Geo Correction file may or may not be present.  But at least one file must be present and valid. &amp;lt;br class=&amp;quot;Apple-interchange-newline&amp;quot;&amp;gt;[[File:GeoFile.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the above Linear Correction in effect and the GCode A Axis commanded to 0 degrees note that the actual commanded axis position is 1000 counts.  This corresponds to a 10 degree offset because the trajectory Planner settings are specified to be 100 count/degree&lt;br /&gt;
&lt;br /&gt;
[[File:A0_Correction10.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here the GCode A Axis commanded to -90 degrees note that the actual commanded axis position is -8500 counts (-85 degrees).  This corresponds to a +5 degree offset&lt;br /&gt;
&lt;br /&gt;
[[File:A-90_Correction5.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here the GCode A Axis commanded to -180 degrees note that the actual commanded axis position is -18000 counts (-90 degrees).  This corresponds to no offset&lt;br /&gt;
&lt;br /&gt;
[[File:A-180_Correction0.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is an example KFLOP/Kogna C Program that was used to create the MapFile_A.txt file &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;KMotionDef.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
// Create Simple Linear Correction file for A axis&lt;br /&gt;
 &lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
	int i;&lt;br /&gt;
	double angle, error;&lt;br /&gt;
	&lt;br /&gt;
	// Calibrate Table for A -180 to +180 degrees at 2 degree increments&lt;br /&gt;
    FILE *f=fopen(&amp;quot;C:\\Temp\\MapFile_A.txt&amp;quot;,&amp;quot;wt&amp;quot;);&lt;br /&gt;
    fprintf(f,&amp;quot;181\n&amp;quot;);   // 181 points specify 180 regions&lt;br /&gt;
    fprintf(f,&amp;quot;2.0\n&amp;quot;);   // 2 degree Spacing&lt;br /&gt;
    fprintf(f,&amp;quot;-180\n&amp;quot;);  // Offset - Table begins at -180&lt;br /&gt;
&lt;br /&gt;
	// use dummy correction of cosine function with no error&lt;br /&gt;
	// at -180 and +180 but 10 degrees at center (0 degrees)&lt;br /&gt;
	&lt;br /&gt;
	for (i=0; i&amp;lt;181; i++)&lt;br /&gt;
	{&lt;br /&gt;
		angle = -180.0 + i * 2.0;&lt;br /&gt;
		error = (cos(angle * PI/180.0)+1)/2.0 * 10.0;&lt;br /&gt;
		fprintf(f,&amp;quot;%d,%.11f\n&amp;quot;, i, angle+error);&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
    fclose(f);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the Excel Spreadsheet used to create the Error Plot from the Linear Table file.&lt;br /&gt;
&lt;br /&gt;
[[:Media:PlotLinearCorrectionTable.xlsx|PlotLinearCorrectionTable.xlsx]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/Linear_Table_Correction</id>
		<title>Linear Table Correction</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/Linear_Table_Correction"/>
				<updated>2024-06-23T23:43:09Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Linear Table Correction Description Added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Linear Table Correction==&lt;br /&gt;
Besides the 2.5D Geometric Correction capability 1D Linear Table corrections can be applied to each axis independently.  Lead Screw mapping fits into this category where there a nonlinear distortion of the commanded axis position to the true position of the axis.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Each or both 2.5D Geo Correction and 1D Linear correction can be applied.  If both are applied then the 2.5D Geo Correction is applied first and then the Actuator positions have 1D Linear corrections applied.  Between Points a linear interpolation is used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is shown an example plot of a correction table for an angular A axis.  The table values contain the commanded positions required to position at the theoretical positions.  For example in the plot below to move to angle 0 the axis actually needs to be commanded to 10 degrees.  To move to 90 degrees the axis would need to be commanded to 95 degrees.  Note these values are exaggerated over what they would typically be for a real system for demonstration purposes.  The example is created using a cosine function where the correction is 0 at -80 and +180 degrees and 10 degrees at 0 degrees.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The actual table contains a list of necessary commanded position but the plot below shows the difference between the commanded positions and the theoretical positions to plot errors and to make the errors more visible.&lt;br /&gt;
&lt;br /&gt;
[[File:CosineCorrection_Excel_Plot.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Below is a fragment of the text file for a Linear Correction Table.  The first 3 lines define the table range.&lt;br /&gt;
&lt;br /&gt;
Line 1 contains the number of commanded positions.  Note that for N ranges N+1 points must be specified.  The example defined 180 2 degree ranges so 181 points are required.&lt;br /&gt;
&lt;br /&gt;
Line 2 defines the size of each range.  In this case 2 degrees.&lt;br /&gt;
&lt;br /&gt;
Line 3 defines the offset or starting point for the table.  In this example it is assumed the useful machine range is from -180 to +180 degrees.  So the Table offset is -180.  The A axis theoretically goes from -infinity to +infinity so it must be specified what range the table should be applied.  If the machine coordinates operated from 0 to 360 degrees then the offset would be 0. &lt;br /&gt;
&lt;br /&gt;
Line 4 through N+3 defines the actual axis commanded values preceded by the point number.  The points may be specified in any order as long as all point numbers are specified.&lt;br /&gt;
&lt;br /&gt;
[[File:MapFile.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
The Tool Setup | Tool/Setup Files | Geo File specifies the root of which files are to be used.   The file name itself specified the name of the 2.5D Geo Correction file.  The Linear Table corrections files are derived from this name by appending: '_X', '_Y', '_Z ', '_A', '_B' or '_C' before any suffix.  So assuming a Geo Correction name of C:\Temp\MapFile.txt the Linear Table Names would be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
C:\Temp\MapFile_X.txt&lt;br /&gt;
&lt;br /&gt;
C:\Temp\MapFile_Y.txt&lt;br /&gt;
&lt;br /&gt;
C:\Temp\MapFile_Z.txt&lt;br /&gt;
&lt;br /&gt;
C:\Temp\MapFile_A.txt&lt;br /&gt;
&lt;br /&gt;
C:\Temp\MapFile_B.txt&lt;br /&gt;
&lt;br /&gt;
C:\Temp\MapFile_C.txt&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br class=&amp;quot;Apple-interchange-newline&amp;quot;&amp;gt;The Software will automatically search for these files and apply corrections for the found files.  The 2.5D Geo Correction file may or may not be present.  But at least one file must be present and valid. &amp;lt;br class=&amp;quot;Apple-interchange-newline&amp;quot;&amp;gt;[[File:GeoFile.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the above Linear Correction in effect and the GCode A Axis commanded to 0 degrees note that the actual commanded axis position is 1000 counts.  This corresponds to a 10 degree offset because the trajectory Planner settings are specified to be 100 count/degree&lt;br /&gt;
&lt;br /&gt;
[[File:A0_Correction10.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here the GCode A Axis commanded to -90 degrees note that the actual commanded axis position is -8500 counts (-85 degrees).  This corresponds to a +5 degree offset&lt;br /&gt;
&lt;br /&gt;
[[File:A-90_Correction5.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here the GCode A Axis commanded to -180 degrees note that the actual commanded axis position is -18000 counts (-90 degrees).  This corresponds to no offset&lt;br /&gt;
&lt;br /&gt;
[[File:A-180_Correction0.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is an example KFLOP/Kogna C Program that was used to create the MapFile_A.txt file &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;KMotionDef.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
// Create Simple Linear Correction file for A axis&lt;br /&gt;
 &lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
	int i;&lt;br /&gt;
	double angle, error;&lt;br /&gt;
	&lt;br /&gt;
	// Calibrate Table for A -180 to +180 degrees at 2 degree increments&lt;br /&gt;
    FILE *f=fopen(&amp;quot;C:\\Temp\\MapFile_A.txt&amp;quot;,&amp;quot;wt&amp;quot;);&lt;br /&gt;
    fprintf(f,&amp;quot;181\n&amp;quot;);   // 181 points specify 180 regions&lt;br /&gt;
    fprintf(f,&amp;quot;2.0\n&amp;quot;);   // 2 degree Spacing&lt;br /&gt;
    fprintf(f,&amp;quot;-180\n&amp;quot;);  // Offset - Table begins at -180&lt;br /&gt;
&lt;br /&gt;
	// use dummy correction of cosine function with no error&lt;br /&gt;
	// at -180 and +180 but 10 degrees at center (0 degrees)&lt;br /&gt;
	&lt;br /&gt;
	for (i=0; i&amp;lt;181; i++)&lt;br /&gt;
	{&lt;br /&gt;
		angle = -180.0 + i * 2.0;&lt;br /&gt;
		error = (cos(angle * PI/180.0)+1)/2.0 * 10.0;&lt;br /&gt;
		fprintf(f,&amp;quot;%d,%.11f\n&amp;quot;, i, angle+error);&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
    fclose(f);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the Excel Spreadsheet used to create the Error Plot from the Linear Table file.&lt;br /&gt;
&lt;br /&gt;
[file:///PlotLinearCorrectionTable.xlsx Plot Linear Correction Table Excel File]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:PlotLinearCorrectionTable.xlsx</id>
		<title>File:PlotLinearCorrectionTable.xlsx</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:PlotLinearCorrectionTable.xlsx"/>
				<updated>2024-06-23T23:36:29Z</updated>
		
		<summary type="html">&lt;p&gt;TK: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:A-180_Correction0.png</id>
		<title>File:A-180 Correction0.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:A-180_Correction0.png"/>
				<updated>2024-06-23T00:56:02Z</updated>
		
		<summary type="html">&lt;p&gt;TK: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:A-90_Correction5.png</id>
		<title>File:A-90 Correction5.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:A-90_Correction5.png"/>
				<updated>2024-06-23T00:55:31Z</updated>
		
		<summary type="html">&lt;p&gt;TK: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:A0_Correction10.png</id>
		<title>File:A0 Correction10.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:A0_Correction10.png"/>
				<updated>2024-06-23T00:55:11Z</updated>
		
		<summary type="html">&lt;p&gt;TK: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:GeoFile.png</id>
		<title>File:GeoFile.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:GeoFile.png"/>
				<updated>2024-06-23T00:54:37Z</updated>
		
		<summary type="html">&lt;p&gt;TK: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:MapFile.png</id>
		<title>File:MapFile.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:MapFile.png"/>
				<updated>2024-06-23T00:54:02Z</updated>
		
		<summary type="html">&lt;p&gt;TK: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:CosineCorrection_Excel_Plot.png</id>
		<title>File:CosineCorrection Excel Plot.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:CosineCorrection_Excel_Plot.png"/>
				<updated>2024-06-23T00:53:06Z</updated>
		
		<summary type="html">&lt;p&gt;TK: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/Main_Page"/>
				<updated>2024-05-09T23:07:09Z</updated>
		
		<summary type="html">&lt;p&gt;TK: /* KFLOP KStep JR1 Molex Power Connectors additional P#*/&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Dynomotion wiki'''&amp;lt;span style=&amp;quot;color: #999999;&amp;quot;&amp;gt;'''&amp;lt;br /&amp;gt;'''&amp;lt;/span&amp;gt;==&lt;br /&gt;
Welcome to our wiki where you can find and share knowledge on Dynomotion's systems.  To begin adding information to this wiki, simply create an account, verify your email, and start editing (click pencil icon). To make editing pages easier for everyone, we have installed a [https://help.bluespice.com/index.php/VisualEditor visual editor] by default.  This visual editor allows you to edit a wiki page much like you would a standard word processing document.&amp;amp;nbsp; For the seasoned wiki editors, standard [https://www.mediawiki.org/wiki/Help:Editing MediaWiki editing] may also be used.&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Warning: Use at your own risk.&amp;amp;nbsp; Information is for example purposes only and may contain errors.&amp;amp;nbsp; It is up to the User to verify the information is correct and is safe to use. In no case will any contributor or Dynomotion be liable for incorrect information.  Dynomotion reserves the right to modify or delete any contributions.&amp;lt;br /&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Thanks for Contributing!&lt;br /&gt;
&lt;br /&gt;
[http://dynomotion.com Official Dynomotion Site]&lt;br /&gt;
&lt;br /&gt;
==Editing and Creating Wiki Pages==&lt;br /&gt;
Unintuitively, you first create a link to the page you want to make before you can make the page.  To make a new page: while editing, right-click where you want your link to be, insert a link with a descriptive title and link text, save the page, click on the link you created, then click on &amp;quot;Empty Page&amp;quot; to begin editing your new page.&lt;br /&gt;
&lt;br /&gt;
Here are a few other quick tips:&lt;br /&gt;
&lt;br /&gt;
* You can insert links or images by Right-Clicking with the mouse on the line where you want the link or image to appear.&lt;br /&gt;
* For Spell Correction you can use Ctrl-Right-Click. &lt;br /&gt;
* To insert a YouTube Video use an EmbedVideo command such as &amp;lt;nowiki&amp;gt; {{#ev:youtube|xxxxx}}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;with xxxxx changed to the Video ID.&lt;br /&gt;
* Choose a descriptive page name and link text when creating a new page: e.g. Not &amp;quot;My Machine&amp;quot;, but rather &amp;quot;Brand X Three Axis Milling Machine Retrofit&amp;quot;&lt;br /&gt;
* Create pages in an organized manner: Describe what the page is about, create clear sections that flow&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
[[Help:New Page Creation|How to create a new wiki page]]&lt;br /&gt;
&lt;br /&gt;
[[Help:Editing Pages|How to Edit and insert Media into your wiki pages]]&lt;br /&gt;
&lt;br /&gt;
==Dynomotion Software Topics==&lt;br /&gt;
===Installation Topics===&lt;br /&gt;
* Announcement of our Latest Release (5.3.3) on the [https://www.dynomotion.com/forum/viewtopic.php?f=4&amp;amp;t=1752 Dynomotion Forum]&lt;br /&gt;
* [https://dynomotion.com/Software/Download.html Latest Release] Note: For Windows 7 64bit signed Drivers to work, all Windows Updates should be performed.&lt;br /&gt;
* [[Upgrading from previous KMotion Versions]]&lt;br /&gt;
&lt;br /&gt;
Archive of Test Releases:&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 02/01/2024: [https://dynomotion.com/Software/KMotion5.3.2.exe KMotion.exe 5.3.2], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.2%20Changes.pdf 5.3.2 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 11/20/2023: [https://dynomotion.com/Software/KMotion5.3.1.exe KMotion.exe 5.3.1], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.1%20Changes.pdf 5.3.1 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/19/2023: [https://dynomotion.com/Software/KMotion5.3.0.exe KMotion.exe 5.3.0], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.0%20Changes.pdf 5.3.0 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 06/30/2023: [https://dynomotion.com/Software/KMotion5.1.0.exe KMotion.exe 5.1.0], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.1.0%20Changes.pdf 5.1.0 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 05/01/2023: [https://dynomotion.com/Software/KMotion5.0.7.exe KMotion.exe 5.0.7], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.0.7%20Changes.pdf 5.0.7 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/21/2022: [https://dynomotion.com/Software/KMotion435h.exe KMotion.exe V4.35h], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35h%20Changes.pdf V4.35h release notes (pdf)]&lt;br /&gt;
* Previous Version 4.35g was not released, but see the change notes for this version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35g%20Changes.pdf V4.35g change notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/28/2020: [https://dynomotion.com/Software/KMotion435f.exe KMotion.exe V4.35f], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35f%20Changes.pdf V4.35f release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 11/18/2019: [https://dynomotion.com/Software/KMotion435e.exe KMotion.exe V4.35e], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35e%20Changes.pdf V4.35e release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/10/2019: [https://dynomotion.com/Software/KMotion435d.exe KMotion.exe V4.35d], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35d%20Changes.pdf V4.35d release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 01/28/2019: [https://dynomotion.com/Software/KMotion435b.exe KMotion.exe V4.35b], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35b%20Changes.pdf V4.35b release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/21/2018: [https://dynomotion.com/Software/KMotion435a.exe KMotion.exe V4.35a], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35a%20Changes.pdf V4.35a release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/28/2017: [https://dynomotion.com/Software/KMotion434j.exe KMotion.exe V4.34j], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34j%20Changes.pdf V4.34j release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 05/07/2017: [https://dynomotion.com/Software/KMotion434i.exe KMotion.exe V4.34i], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34i%20Changes.pdf V4.34i release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/14/2016: [https://dynomotion.com/Software/KMotion434h.exe KMotion.exe V4.34h], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34h%20Changes.pdf V4.34h release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/13/2016: [https://dynomotion.com/Software/KMotion434g.exe KMotion.exe V4.34g], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34g%20Changes.pdf V4.34g release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/05/2016: [https://dynomotion.com/Software/KMotion434f.exe KMotion.exe V4.34f], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34f%20Changes.pdf V4.34f release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 11/07/2016: [https://dynomotion.com/Software/KMotion434e.exe KMotion.exe V4.34e], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34e%20Changes.pdf V4.34e release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/32/2016: [https://dynomotion.com/Software/KMotion434d.exe KMotion.exe V4.34d], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34d%20Changes.pdf V4.34d release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/23/2016: [https://dynomotion.com/Software/KMotion434c.exe KMotion.exe V4.34c], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34c%20Changes.pdf V4.34c release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/03/2016: [https://dynomotion.com/Software/KMotion434b.exe KMotion.exe V4.34b], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34b%20Changes.pdf V4.34b release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 03/09/2016: [https://dynomotion.com/Software/KMotion434a.exe KMotion.exe V4.34a], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34a%20Changes.pdf V4.34a release notes (pdf)]&lt;br /&gt;
* [https://dynomotion.com/Help/KFLOPQuickStart/KFLOPQuickStart.htm How to install KMotion.exe and KMotionCNC]&lt;br /&gt;
* [[How to install KMotion.exe and KMotion in Windows 10|Preparing Windows 10 for driver installation]] (no longer required)&lt;br /&gt;
* [[Special Case for Windows 8.1 Industry Embedded Enterprise]]&lt;br /&gt;
* [[Updating KFLOP Firmware|How to update KFLOP Firmware]] - whenever a new version of software is installed, the firmware within KFLOP must be updated to match the new version&lt;br /&gt;
&lt;br /&gt;
===KMotion.exe Executive Software Topics===&lt;br /&gt;
KMotion.exe is the main program that is used to configure settings in KFLOP, initialize axes, and to write C programs to configure and setup KFLOP to control your system. In this program you can plot step response, test movement, view Bode plots, monitor I/O, set filter parameters, and generally set the pertinent parameters.&lt;br /&gt;
&lt;br /&gt;
* [http://www.dynomotion.com/Help/index.htm General software information] from the manuals&lt;br /&gt;
* Insert pages for other KMotion.exe-related topics here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Configuration Topics===&lt;br /&gt;
====Channels, Channels, Channels what are they?====&lt;br /&gt;
[[Channels Channels Channels|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====How to Setup Backlash Compensation====&lt;br /&gt;
[[Backlash Compensation|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====PWM Output Mode====&lt;br /&gt;
[[PWM Output Mode|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
===KMotionCNC Software Topics===&lt;br /&gt;
KMotionCNC is Dynomotion's CNC program used as a graphical user interface to your KFLOP-enabled machine tool. KMotionCNC has all of the basic functionality you need to run a machine of up to 6 axes, in addition to spindle control.&lt;br /&gt;
&lt;br /&gt;
* Insert pages for other KMotionCNC-related general topics here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;Using KMotionCNC&amp;lt;/span&amp;gt;====&lt;br /&gt;
* Homing discussion - page to be created&lt;br /&gt;
* Insert other KMotionCNC use pages here&lt;br /&gt;
&lt;br /&gt;
[[Internal/concave Path Tool Radius Compensation Example G41/G42]]&lt;br /&gt;
&lt;br /&gt;
[[Known KMotionCNC CAD/CAM Post Processors]]&lt;br /&gt;
&lt;br /&gt;
[[Invoking C Programs with Execute Only for previously Downloaded Programs]]&lt;br /&gt;
&lt;br /&gt;
[[Rigid Tapping G84 Setup and Use]]&lt;br /&gt;
&lt;br /&gt;
[[Tool Length/Offsets G43Hn G49]]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;Customize KMotionCNC&amp;lt;/span&amp;gt;====&lt;br /&gt;
KMotionCNC is written as a Windows C++ MFC (Microsoft Foundation Classes) program developed in Visual Studio.  Source code is provided and may be customized using Visual Studio.  MFC Support is a requirement. &lt;br /&gt;
&lt;br /&gt;
: '''General Information'''&lt;br /&gt;
: Compiling KMotionCNC&lt;br /&gt;
:: The KMotionCNC's Visual Studio Project Solution (\PC VC Programs\KMotionCNC\KMotionCNC.sln) is currently written for Visual Studio 2015 Standard.  This version can be used for the simplest compatibility.  Projects can be upgraded to newer version of VS with minimal effort.  Including Microsoft's Free Visual Studio 2013 Community.  [[PC Example Applications|More info on PC Example Applications.]]&lt;br /&gt;
:: Note Test Versions 4.34a and later have project solutions targeted for Visual Studio 2015 Community which is free for most Users.&lt;br /&gt;
: '''KMotionCNC Customization Examples and Applications'''&lt;br /&gt;
:: Links to examples of projects that explain KMotionCNC customizations. Troy (tmday7) created some helpful documents (PDF format):&lt;br /&gt;
: &lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/How%20to%20Edit%20KMotionCNC%20Faces.pdf How to edit KMotionCNC faces]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20External%20Buttons.pdf Adding external buttons]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20More%20User%20Buttons.pdf Adding more user buttons]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20Jog%20Percent%20Cell%20to%20Main%20Dialog%20Face.pdf Adding Jog Percent Cell to Main Dialog Face]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;KMotionCNC Screen Editor&amp;lt;/span&amp;gt;====&lt;br /&gt;
Introduces the capability of using Screen Script files to modify the look and function of KMotionCNC.&amp;lt;br /&amp;gt;[[KMotionCNC Screen Editor|More information.]]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;KMotionCNC Geometric Correction&amp;lt;/span&amp;gt;====&lt;br /&gt;
Information regarding the powerful [https://dynomotion.com/Help/KMotionCNC/GeoCorrection.htm Geometric Correction capability] which allows calibration and distortion correction of the XY CAD space to Machine/Actuator Space as well as flatness in Z.  Simple 4 point correction tables can apply XY Scale, Rotation, skew, offset, tilt.  Larger tables can apply more non-linear corrections.&lt;br /&gt;
&lt;br /&gt;
Note the Geometric Correction is built into the KMotion Libraries and can be utilized by Custom Programs as well as with KMotionCNC&amp;lt;br /&amp;gt;[[Geometric Correction|More information and Examples.]]&lt;br /&gt;
&lt;br /&gt;
===PC Example Applications===&lt;br /&gt;
A number of PC Applications using the KMotion Libraries are available in the Software download.&amp;amp;nbsp; Visual Studio should be used to modify/compile the applications.&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note All the projects in KMotion Versions 4.34a and later have now been updated and should work out-of-the-box with VS2015.'''&lt;br /&gt;
&lt;br /&gt;
[[PC Example Applications|More information.]]&lt;br /&gt;
&lt;br /&gt;
===KMotion Libraries - GCode Interpreter - Trajectory Planner - Coordinated Motion - .NET===&lt;br /&gt;
The KMotion Libraries are a series of DLLs (Dynamic Link Libraries) that reside on the PC that contain the common core motion control, I/O, and communication functionality for KFLOP.  These libraries permit PC Applications to be built using high level control without being concerned with the underlying details of Interpreting GCode, Trajectory Planning, Coordinated Motion, Motion Buffering, USB Communication, etc.&lt;br /&gt;
&lt;br /&gt;
[[KMotion Libraries - GCode Interpreter - Trajectory Planner - Coordinated Motion - .NET|More information]].&lt;br /&gt;
&lt;br /&gt;
===Kinematics===&lt;br /&gt;
The KMotion Libraries contain a Kinematics Layer where Users can add their own non-linear Kinematics&lt;br /&gt;
&lt;br /&gt;
[[Kinematics|More information]].&lt;br /&gt;
&lt;br /&gt;
===KFLOP C Programs===&lt;br /&gt;
C Programs provide a powerful and flexible capability to perform almost any sequence of operations within KFLOP.   In most cases after you have tested and tuned all your hardware using the KMotion.exe setup program all the settings and initialization steps required for your system can be placed into an Initialization C Program so that your system can be fully initialized simply by executing the Initialization program.&lt;br /&gt;
&lt;br /&gt;
[[KFLOP C Programs|More Information]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ModBus===&lt;br /&gt;
Modbus can be connected to the PC or directly to KFLOP.  A PC connection will not be deterministically real-time but may work for basic speed control and on/off.  Here is a related Thread for interfacing KMotionCNC to Modbus using a [http://www.modbusdriver.com/modpoll.html free utility]:&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/sending%20ModBus%20msgs%20from%20KmotionCNC%20to%20a%20RS485%20port.html Sending ModBus msgs from KmotionCNC to a RS485 port]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To connect Modbus directly to KFLOP's [http://www.dynomotion.com/Help/RS232/RS232.htm UART] see the C Examples in \C Programs\RS232\ModBus\&lt;br /&gt;
&lt;br /&gt;
===Linux Support===&lt;br /&gt;
KMotion Motion Libraries are fully supported under Microsoft Windows. Some Users have ported the KMotion Libraries to Linux.  Dynomotion will offer support where possible but can't offer full support under Linux.  Special Thanks to [https://github.com/parhansson/KMotionX Par Hansson] for the initial Linux Port.&lt;br /&gt;
&lt;br /&gt;
See [[Linux|here]] for more info.&lt;br /&gt;
&lt;br /&gt;
==Dynomotion Hardware Topics==&lt;br /&gt;
===General Hardware Information===&lt;br /&gt;
====[[KFLOP Hardware Info|KFLOP specific Hardware Info]]====&lt;br /&gt;
====[[KStep Hardware Info|KStep specific Hardware Info]]====&lt;br /&gt;
====[[Kanalog Hardware Info|Kanalog specific Hardware Info]]====&lt;br /&gt;
====[[SnapAmp Info|SnapAmp specific Hardware Info]]====&lt;br /&gt;
====[[Konnect Hardware Info|Konnect specific Hardware Info]]====&lt;br /&gt;
&lt;br /&gt;
===Wiring Diagrams===&lt;br /&gt;
[[Media:Kanalog_Connections.pdf|Basic Kanalog DAC and Encoder Connections 3 Axis]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KanalogSchematic3Axis.pdf|Basic Kanalog DAC and Encoder Connections 3 Axis #2]]&lt;br /&gt;
&lt;br /&gt;
[[Media:dyn4 kanalog KE1524 V1.1.png|Basic Kanalog DAC and DMM DYN4 Drive 1 Axis]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Kflop-Kanalog_wiring_11-19-2018.pdf|Kanalog with Geckos G210 updated 11-19-2018]] (Thanks to &amp;lt;span style=&amp;quot;color: windowtext;&amp;quot;&amp;gt;Joseph Mirocha&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog_to_Tree_Journeyman_325_by_Rick_B.pdf|Kanalog to Tree Journeyman 325.pdf]] (Thanks to &amp;lt;span style=&amp;quot;color: windowtext;&amp;quot;&amp;gt;Rick_B&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Media:KFlopSnapBrushMPG.pdf|KFLOP+SnapAmp DC Brush Motors with MPG]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Stepper_Wiring_Diagram_Step-Dir_on_JP5.pdf|KFLOP JP5 Open Collector Step/Dir Connections to Power Step PSD5042-2P Drives ]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Matrika_V1_wiring_diagram_Rev1.pdf|KFLOP+KStep with VFD and NPN Limit Switches for Matrika Rev1]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KonnectTouchPlate.png|Touch Plate Wiring to Konnect]]&lt;br /&gt;
&lt;br /&gt;
[https://easyeda.com/350banshee/BreakoutBoard-93bdd16e3c3d48b98ae66c34f2436c40 User Created KFLOP JP7 Breakout/OptoIsolation Board] Schematic, Gerbers, PCBs Publicly available (thanks 350banshee)&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/wiki/index.php?action=ajax&amp;amp;title=-&amp;amp;rs=SecureFileStore::getFile&amp;amp;f=/b/bb/RotarySwitchToKanalog.png Rotary Switch Connected to Kanalog Opto Inputs]&lt;br /&gt;
&lt;br /&gt;
===3D Board Models===&lt;br /&gt;
[[Media:kflop-kstep-3d-models-1.snapshot.3.zip.txt|kflop-kstep-3d-models-1.snapshot.3.zip.txt]]  STEP file format - Thanks to Curtis&lt;br /&gt;
&lt;br /&gt;
[[File:kflop_kstep_render.JPG|none|link=|329x329px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:KFLOP3D_Step_IGS_Chris.zip.txt|KFLOP3D_Step_IGS_Chris.zip.txt]] STEP and IGS models - Thanks to Chris&lt;br /&gt;
&lt;br /&gt;
[[File:KFLOP_3D.png|none|link=|413x296px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:KONNECT_BOARD_MODEL.zip.txt|KONNECT_BOARD_MODEL.zip.txt]] STEP model - Thanks to Jeff Redington&lt;br /&gt;
&lt;br /&gt;
(Component locations may be off one way or another by .5mm)&lt;br /&gt;
&lt;br /&gt;
[[File:Konnect_Board.png|none|link=|339x292px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Konnect Basic Step file showing hole locations&lt;br /&gt;
&lt;br /&gt;
[[Media:KonnectHoles.stp.txt|KonnectHoles.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KonnectHoles.png|none|link=|352x323px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kanalog Step Model with Mechanical hole and Pin locations&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog.stp.txt|Kanalog.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KanalogFromStep.png|none|link=|304x279px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kanalog Step Model with Mechanical hole and Connectors (Thanks to&lt;br /&gt;
&lt;br /&gt;
Roberto Gotti of Powertech)'''&amp;lt;br /&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
[[Media:KANALOG_BOARD.stp.txt|KANALOG_BOARD.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KanalogWithConnectors.png|none|link=|311x286px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Board Terminal DXF/DWG files===&lt;br /&gt;
[[Media:KFLOP_Terminals.dxf|KFLOP_Terminals.dxf]] [[Media:KFLOP_Terminals.dwg|KFLOP_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog_Terminals.dxf|Kanalog_Terminals.dxf]] [[Media:Kanalog_Terminals.dwg|Kanalog_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Konnect_Terminals.dxf|Konnect_Terminals.dxf]] [[Media:Konnect_Terminals.dwg|Konnect_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KStep_Terminals.dxf|KStep_Terminals.dxf]] [[Media:KStep_Terminals.dwg|KStep_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
===Wiring Topics===&lt;br /&gt;
Place links to pages on wiring inputs and&lt;br /&gt;
&lt;br /&gt;
outputs specific to your experiences and projects.  Be descriptive with page titles and links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====KFLOP IDC Connectors and Cables====&lt;br /&gt;
Cables that connect between Dynomotion boards are normally included when purchasing the boards together. They are also very common and easy to make. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Use '''16-conductor or 26-conductor ribbon cable''' (0.05 inch pitch 26 AWG preferrably or 28AWG) and IDC sockets.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;[[File:RibbonCable.png|none|link=]]&lt;br /&gt;
16 conductor ribbon cable 3M part number 3801/16 100 &amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/3m/3801-16-100/3M156105-100-ND/1107501&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;26 conductor ribbon cable 3M part number C3801/26 100 &amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/3m/C3801-26-100/C3801-26-100-ND/1107648&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Winford also sells ribbon cable (although only the thinner 28 AWG):&amp;lt;br /&amp;gt;http://www.winford.com/products/rib.php&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Note you can usually tear off wires to reduce the number of conductors. For example from 26 down to 16. Tear off the conductors away from the red stripe that marks pin 1.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;The '''crimp tools''' are common:&amp;lt;br /&amp;gt;https://www.amazon.com/Accessories-Crimp-Ribbon-Cable-Connectors/dp/B007R2JEM4/&amp;lt;br /&amp;gt;[[File:RibbonCrimp.png|none|link=]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;'''IDC Sockets 16-pin '''(pin pitch 0.1 inch)&amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/assmann-wsw-components/AWP-16-7240-T/HHKC16H-ND/5031953&amp;lt;br /&amp;gt;Assman Part number AWP 16-7240-T&lt;br /&gt;
[[File:16pinIDC.png|none|link=]]&lt;br /&gt;
https://www.digikey.com/product-detail/en/assmann-wsw-components/AWP-26-7240-T/HHKC26H-ND/5011313&lt;br /&gt;
[[File:26pinIDC.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
====KFLOP KStep JR1 Molex Power Connectors====&lt;br /&gt;
KFLOP and KStep JR1 are standard Disk Drive Power Connectors. Possibly one of the most common connectors. Originally used on PC ATX Power Supplies. Sometimes referred to as Molex Connectors. They have 4 pins with 0.2 inch pitch with 0.083~0.084 inch socket pins. The mating cable will have female socket pins as shown here:&lt;br /&gt;
&lt;br /&gt;
[[File:Molex_female_connector.jpg|none|link=|251x168px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Molex Series 8981 P# [https://www.digikey.com/short/zjp329 0015244048]  using Molex Series 8980 Crimp Pins P# [https://www.digikey.com/short/zjp3ff 0002081201]&lt;br /&gt;
&lt;br /&gt;
Also AMP Series MATE-N-LOK P# [https://www.digikey.com/short/zjpq3n 1-480424-0] using AMP Series MATE-N-LOK Crimp Pins P# [https://www.digikey.com/short/zjpqqw 60619-1] or P# [https://www.digikey.com/en/products/detail/molex/0194200002/2404783 194200002]&lt;br /&gt;
&lt;br /&gt;
Molex Crimp Tool P# [https://www.digikey.com/en/products/detail/molex/0640160035/665311 0640160035]&lt;br /&gt;
&lt;br /&gt;
====MPG Wiring and Interface====&lt;br /&gt;
MPGs (Manual Pulse Generators) should be connected directly to KFLOP for guaranteed real-time response (not USB based or connected to the PC).  MPGs are handled by a C Program that monitors the MPG and creates motion based on the MPG Encoder changes and switch selections for axis, speed, and so forth.  See the MPG C Program Examples.  Here is a Discussion with other links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/Jogging%20Pendant.html Jogging Pendant]&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/Connecting%20Keling%20MPG2%20pendant.html Connecting Keling MPG2 Pendant]&lt;br /&gt;
&lt;br /&gt;
[https://www.cnczone.com/forums/dynomotion-kflop-kanalog/349740-applying-acceleration-mpg-target-possible.html#post2119732 CNCZone Thread] on obtaining smooth filtered motion.&lt;br /&gt;
&lt;br /&gt;
[[File:MPG4_from_cnc4pc.jpg|none|link=|83x169px]]&lt;br /&gt;
&lt;br /&gt;
====Interfacing NPN Devices to KFLOP IO====&lt;br /&gt;
NPN devices (open collector)operate as a switch to GND and can be interfaced to KFLOP using a pull up resistor as shown below. When the transistor switches to 0V the KFLOP IO Pin is driven low. The transistor will need to sink ~3ma. When the transistor is off (open circuit) the resistor pulls the IO Pin to 3.3V. Note even though some KFLOP IO Pins can tolerate 5V pulling them above 3.8V should be avoided when possible so the 3.3V supply is used. This technique will only work with KFLOP IO Pins that do not have pull down resistors (JP7 and JP5). In some cases a 0.1uF Ceramic capacitor connected close to KFLOP might be added in parallel with the resistor to filter noise.  Cable shielding connected to KFLOP GND on the KFLOP end only is recommended.  Note that in noisy environments this technique may couple noise into KFLOP so opto isolation should be used instead.&lt;br /&gt;
&lt;br /&gt;
[[File:NPN_Interface_to_KFLOP.png|none|link=|544x544px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Multiplexing Encoder Inputs to KFLOP JP4 and JP6====&lt;br /&gt;
If KFLOP JP7 and JP5 are used for other purposes the encoder inputs can be multiplexed to KFLOP JP4 and JP6. There is an option to multiplex encoders 0-3 from JP7 to JP4 and another option to multiplex encoders 4-7 from JP5 to JP6. See the MuxEncoders.c for an example.&lt;br /&gt;
&lt;br /&gt;
Note the JP4 and JP6 IO are 3.3V inputs and shouldn't be driven hard (more than 10ma) above 3.8V. This is not usually an issue as most encoders or RS422 drivers don't do this. The inputs also have 150 ohm termination.&lt;br /&gt;
&lt;br /&gt;
The following line of code might be added to your Initialization C Program. It needs to be executed once to multiplex the encoders after any power cycle. Encoders 0-3 will then be input on JP4 and 4-7 will be on JP6. Both JP4 and Jp6 have 10 IO bits. The 4 encoders will appear on the first 8 IO bits. 2 bits for each encoder's A B channels in order. So for example Encoder #0 will appear on JP4 IO16 (Pin5) and IO17 (Pin6)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt; &lt;br /&gt;
// Mux encoder inputs from KFLOP JP7 &amp;amp; JP5 to JP4 and JP6&lt;br /&gt;
FPGAW(ENC_NOISE_FILTER_ADD) = ENC_0_3_JP4 + ENC_4_7_JP6 + ENC_NOISE_FILTER_DEFAULT_VAL; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JP4 and JP6 have +5V available on Pin1 and GND on Pins 8 and 9 that might be used to power 5V encoders.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span id=&amp;quot;Axes_Servo_Tuning_and_Trajectory_Planner&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axes Servo Tuning and Trajectory Planner&amp;lt;/span&amp;gt;==&lt;br /&gt;
===Basic Servo Tuning Overview===&lt;br /&gt;
Once an axis is configured and proved capable of holding a position it is ready to be tuned and optimized. Most often a small value of P Gain only is used to show the servo is functional and can hold position. The Servo may be very weak and inaccurate but will be functional.&lt;br /&gt;
&lt;br /&gt;
Every system is different and the tuning parameters are interactive in a manner that usually doesn't allow parameters to be determined one at a time. Rather after one parameter is changed it may be necessary to revisit the other parameters.&lt;br /&gt;
&lt;br /&gt;
In general higher gains will reduce errors and improve accuracy, but tend to make the system more unstable.  So the general idea is to increase gains to reduce errors as much as possible but still have a stable system.&lt;br /&gt;
&lt;br /&gt;
Often during tuning the system may go unstable. In fact, it is normally intentionally driven to instability to find its limits for a certain parameter. This can result in a violent oscillation or worse so one should be prepared to quickly disable the Servo. If an appropriate [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Max_Following_Error Max Following Error] is used the axis can be automatically disabled before the oscillation becomes too violent, yet not disable when performing a normal test.&lt;br /&gt;
&lt;br /&gt;
KMotion.exe allows you to change any axis parameter on the Step/Response, Config, or Filters Screens then simply push &amp;quot;Move&amp;quot; to see the effect of the change.  Note that as performance improves the errors will become small and difficult to see on the Position Plot without Zooming in (Left click drag) so changing the plot type to plot the error is useful.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The overall process normally goes something like this:&lt;br /&gt;
&lt;br /&gt;
# Select a Test [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Measurement Move Size] and [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Motion_Profile Motion Profile].  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Velocity.2C_Acceleration.2C_and_Jerk See Also]&lt;br /&gt;
# Select [http://dynomotion.com/Help/StepScreen/StepScreen.htm#max_limits Max Limits] to allow for the Test.  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Max_Limits_-_Error See Also]&lt;br /&gt;
# Determine maximum level of [http://dynomotion.com/Help/StepScreen/StepScreen.htm#PID P Gain]&lt;br /&gt;
# Determine maximum level of [http://dynomotion.com/Help/StepScreen/StepScreen.htm#PID D Gain] (with Low Pass Filtering)  See Also [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Torque_Servos_vs_Velocity_Servos here] and [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Lead_Compensator_vs_Derivative_Gain here].&lt;br /&gt;
# Determine new maximum level of P Gain now that D Gain increased stability&lt;br /&gt;
# Add I Gain to improve accuracy and remove steady state errors.  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#I_Gain.2FMax_Limit_Integrator See Also]&lt;br /&gt;
# Add [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Feed_Forward Feed Forward] to reduce errors&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Torque Servos vs Velocity Servos===&lt;br /&gt;
+/-10V Analog Amplifiers usually come in one of two varieties: '''Torque''' or '''Velocity'''. Torque mode amplifiers consider the input command as a Torque Command and work to generate the commanded Motor Torque. Velocity mode amplifiers consider the input command as a Velocity Command and work to generate the commanded Velocity.  Its important to understand what type of Amplifiers you have.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Velocity Mode Amplifiers''' need some form of feedback going to the Amplifier in order for the drive to know the current velocity. This might be a digital encoder or an analog tachometer.&lt;br /&gt;
&lt;br /&gt;
Its easy to tell if you have a Velocity Mode Amplifier by looking at a plot of a move on the Step Response Screen.  The Output (green plot with right scale) will be proportion to the motor velocity.  When moving at constant speed the output will be relatively constant.  See in the plot below the output (green) remains at a relatively constant ~1100 DAC counts while the position (red) ramps at a constant slope of the 90000 count/sec rate:&lt;br /&gt;
&lt;br /&gt;
[[File:VelocityAmp.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Velocity mode amplifiers can be relatively easy to tune using only P (Proportional) Gain.  Additional Gains and filters can be used for best performance but using only P Gain will often result in reasonable performance and a stable system (unlike Torque Mode Amplifiers). &lt;br /&gt;
&lt;br /&gt;
As an example consider controlling the speed of a car using only Proportional Gain as it approaches a target (Stop sign).  Consider a P Gain of 0.1 where at 1000ft from the stop sign we command 1000 x 0.1 = 100MPH.  Then at 100ft we command 10MPH.  Then at 10ft we command 1MPH.  This results in a nice, smooth, exponential approach, without overshoot.&lt;br /&gt;
&lt;br /&gt;
Contrast this with controlling the acceleration (torque) of a car using only Proportional Gain as it approaches a target (Stop sign).  At large distance we apply maximum acceleration.  Although as we approach the stop sign we reduce acceleration, we continue to accelerate and speed continues to increase until we pass the stop sign.  Torque mode servos are inherently unstable.  P only gain only works at all if there is some friction (the car is dragging a sled which slows us down with less torque).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Acceleration Mode Servos''' may or may not have any feedback.  If they have feedback it is usually used only to commutate a brushless motor.  In the plots the Output (green) will have large magnitude when the Position (red) is accelerating, where the plot has curvature (changing slope).&lt;br /&gt;
&lt;br /&gt;
Acceleration mode Servos are unlikely to work well or at all with only P Gain.  Some form of damping or lead compensation will usually be required to get a stable system.   D (derivative) Gain (or a lead compensator) should be included with the P Gain to help stabilize the system.  D Gain can be increased to make the system more stable up to a point.  After some point the additional D Gain will make the system more unstable. and should be reduced.&lt;br /&gt;
&lt;br /&gt;
When using D Gain (or lead compensation) the quantization noise (steps) in the encoder position can cause spikes in the output.  For example a D Gain of 100 will cause a spike of 100 counts in the output whenever the input changes suddenly by 1 count.  If the spikes are very high amplitude and short duration, the Amplifier may not handle them in the expected manner.  A low pass filter can be used to widen and reduce their amplitude allowing the amplifier to handle them more effectively.  Typically a 2nd order low pass filter of 500Hz Q=1.4 is used.  The last filter is normally used so it is applied to any Feed Forward. Such as:&lt;br /&gt;
&lt;br /&gt;
[[File:LowPass400Q1p4.png|none|link=|680x439px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;Velocity.2C_Acceleration.2C_and_Jerk&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Velocity, Acceleration, and Jerk&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;div id=&amp;quot;yui_3_16_0_1_1445622719616_3315&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;The Velocity, Acceleration, and Jerk in the Step Response Screen (KFLOP parameter settings) and the Acceleration and Velocity in the KMotionCNC | Tool Setup | Trajectory Planner | Axis Parameters are both used for different things.  The two sets of parameters are independent. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;yui_3_16_0_1_1445622719616_3313&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;The&amp;lt;/span&amp;gt; KFLOP parameters are used for 3rd order motions.   These include things like:  Jogging, Homing, and GCode Rapids (G0).  The units in KFLOP are in counts or steps.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span id=&amp;quot;yui_3_16_0_1_1445622719616_3320&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;The KMotionCNC parameters are used for 2nd order (&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;yui_3_16_0_1_1445622719616_3321&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;infinite &amp;lt;/span&amp;gt;Jerk) coordinated motion paths.  These are GCode G1,G2,G3 continuous paths.  The units are in Inches (or in some cases degrees).   Note there is an Option in KMotionCNC &amp;quot;Rapids as Feeds&amp;quot; where these parameters will also be used for Rapids.  But this option should only be used for highly non-linear Kinematic Systems which can not take advantage of faster/smoother 3rd order point to point straight line Rapids.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;Tests&amp;lt;/span&amp;gt; to find and verify optimal settings for both types of moves should be made using the Step Response Screen.  Optimal settings are usually determined by experimentation.  Although it might be possible to calculate the settings based on motor torque gains, back-emf, amplifier voltage/current, mass, moments of inertia, friction, encoder resolution, leadscrew pitch, required following accuracy, etc... It is often too complicated and with too many unknowns to be practical.  So experimental moves can be tested at ever increasing Velocities, Accelerations, and Jerks until the system is unable to follow the trajectory without having too much error or shock to the system.  After absolute limits of the system are determined then the settings should be backed off by some amount to provide operating margins (ie 20%).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;It is usually best to first determine max possible velocity using a relatively low acceleration. Maximum power is usually required at the point of the trajectory where velocity is high and still accelerating.  Supply Voltage limitations tend to limit velocity.  Current limitations tend to limit acceleration.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[File:MaxVelAccelPower.png|none|link=|485x361px]]&amp;lt;br /&amp;gt;The Step Response Screen always performs 3rd order motion but 2nd order motion can be simulated by temporarily setting the Jerk to a huge value (1000X the acceleration value).  In general reducing the Jerk value will result in longer times to perform motions, but often the improved smoothness will permit higher maximum accelerations and velocities to be used resulting in overall shorter motion times.  An analogy might be how you might stop more quickly in a car, without skidding or spilling your coffee, by applying the brakes harder in a more gradual manner rather than slamming on the brakes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;Make&amp;lt;/span&amp;gt; sure when testing the size of move is long enough for full acceleration and velocity are achieved.  A common mistake is to have Acceleration or Velocity Settings set to too high for your system but when testing a short move there is no indication of a problem.  The plot mode of Velocity Output  vs Time can be helpful to verify full Velocity is being achieved.&amp;lt;span id=&amp;quot;.C2.A0&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt; &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;The idea is that a motor axis has torque and speed limitations and you should determine and understand what they both are for your system. Available motor torque drops off with higher speed. At some speed the motor will not even be able to generate any torque at all. Motor torque is required to accelerate the axis. We need to make sure that no combination of velocity and acceleration will ever cause the axis to fault/stall/fail. So there is often a complex set of speeds and accelerations that will work ok that form an envelope of workable speed and acceleration. So one nice thing to know is top speed possible. It is like taking your car out on a long straight highway and gradually accelerating to find the max speed is 100MPH. You will then know that ever attempting a speed over 100MPH will always fail. Also speed should probably be limited to something like 80MPH to allow for margin and to allow reasonable acceleration up to that speed. The reason for performing the top speed test at low acceleration is to avoid a failure because of not being able to accelerate at the specified rate. So we want to set the acceleration to a low value so it will not be a limiting factor when determining top speed. However if we set the acceleration so low with a short trip distance we will never go very fast and the speed test will be meaningless. This should be avoided. Change the Plot type to Velocity, Output, vs Time to clearly see if this is the case.  You may want to turn off Measured Velocity if it obscures viewing the Commanded Velocity&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;For example to accelerate to 700,000 counts/sec at an acceleration rate of 700,000 counts/sec^2 would take 1 second. And then to slow back down would take 1 more second. So at least 2 seconds of motion would be required to get to full speed. A 100,000 count move (2 inches for a system with 50,000 counts/inch) takes much less time than that. Furthermore with a relatively low Jerk setting (1e6). This means the acceleration will be applied gradually over 0.7 seconds. This means an even much longer time and distance would be required to achieve top speed.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Here is the method to follow to find 2nd/3rd order motion profile limits:&amp;lt;br /&amp;gt;(note every system is different and will vary based on resolution, motor size/type, mass, etc...)&lt;br /&gt;
&lt;br /&gt;
'''1 - Find Max Velocity at low Acceleration and infinite Jerk'''&lt;br /&gt;
&lt;br /&gt;
Choose a Velocity to test (ie V=100000 counts/sec)&amp;lt;br /&amp;gt;Set a moderately low Acceleration Time of 1 second (A = V/1sec = 100000 counts/sec^2)&amp;lt;br /&amp;gt;Set very high Jerk so Acceleration is applied almost instantaneously in 0.001 sec (J = A/0.001sec = 1e8 counst/sec^3)&amp;lt;br /&amp;gt;Test a very long move 20 inches if possible (for resolution 50000 counts/inch, 1,000,000 counts)&amp;lt;br /&amp;gt;Plot Velocity, Output, vs time to see if V is actually obtained&amp;lt;br /&amp;gt;If the motion was successful repeat all above with higher V, if not try lower V&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Once Max V is found reduce by some margin (ie 20-50%)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Note you may decide on lower speed for other reasons (safety, vibration, noise, wobble, shock, etc....)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;'''2 - Find Max Acceleration for your system for the chosen Velocity'''&lt;br /&gt;
&lt;br /&gt;
Using the V found above increase A (keeping Jerk high in the same manner) until the system fails/faults/excessive shock, etc...&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Once Max A is found reduce by some margin (ie 20-50%)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;These V and A Values are now known good values for your system and can be used for 2nd order motions such as KMotionCNC Trajectory Planner or Mach3 Motor tuning. Note units will need to be converted (counts to inches or mm, time from seconds to minutes depending on the App)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3 - Find optimal 3rd order Jerk limited motions.'''&lt;br /&gt;
&lt;br /&gt;
The previous result from Step #1 and #2 used nearly infinite Jerk where Acceleration forces were applied nearly instantaneously. By reducing Jerk smoother motion should be possible. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Set Jerk so it is applied over 20ms (ie for A=200000 J = A/0.020 = 1e7&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Test to see if motions are smoother. With closed loop systems the Position Error Plot can be used to see if the motion has less error and is smoother. Open loop system will require you to hear the difference.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Increase/decrease Jerk to find the optimal value. Note reducing Jerk a lot will of course make the system very smooth, but will also be much slower using less acceleration and velocity which is undesirable. So the highest Jerk possible should be found that still provides some smoothness.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Reducing Jerk only will always make the system slower with less performance (but hopefully significantly smoother). It is usually then possible to increase Acceleration and Velocity somewhat to achieve even higher performance than what was possible with infinite Jerk while being as smooth or smoother.&lt;br /&gt;
&lt;br /&gt;
'''4 - Reduce Max Following Error Limit to small value'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;Now that the system is properly tuned and reasonable Acceleration, Velocity, and Jerk are set the motor Position should always follow the commanded Destinations accurately with only small errors.  By Plotting Position Errors under various conditions (Distances) you can get an idea of the worst case following errors under normal conditions.  The Max Following Error Parameter should be set to a value slightly larger than the worst case following error (ie 20~50% larger).  In this case if anything abnormal occurs: ie. The axis hits an obstacle, commanded at too high of a speed, servo goes unstable, hardware/electronics failure, a Following Error will be immediately detected and the axes disabled.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axis Resolution - counts/inch (or counts/mm)&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Its important to understand the resolution of your Axis which is the number of fundamental raw motor/driver encoder counts or motor steps per standard unit of distance (inch or mm).  Although tuning in KMotion.exe Step Response Screen and motions within KFLOP typically use units of raw counts or steps it is important to know how these translate to real-world distances, speeds, etc...  Later, applications such as KMotionCNC or Mach3 will need this information to scale motions properly.&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;There are usually a number of factors that combine together to determine the Axis Resolution.  These might include:&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;counts or steps per motor revolution&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;any gearing or belts and pulleys involved between motor and drive mechanisms&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;lead screw pitch, rack and pinion tooth pitch, drive belt radius, etc.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For example consider a Stepper Drive with:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;3200 steps per motor rev&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;2:1 gear reduction from motor to lead screw&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;0.2 inch lead screw pitch&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axis Resolution = 3200 step/motor rev x (2 motor rev/ screw rev)  / (0.2 inch / screw rev) = 32000 steps/inch&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;To determine whether your assumptions and calculations are correct perform a test.  Command as large of a move as convenient and measure the actual distance moved with a ruler.   For example in the axis described above you might command a move of 320000 steps.  This should result in a motion of:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;320000 steps / (32000 steps/inch) = 10 inches.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For KMotionCNC set the Axis Resolution in the [http://dynomotion.com/Help/KMotionCNC/ToolSetupScreenTP.htm#Axis_Motion_Parameters Tool Setup | Trajectory Planner Screen | Axis Parameters | cnts/inch].  Note units must be in units of inches.  If your resolution is in mm units multiply by 25.4.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For Mach3 enter the Axis Resolution in the Configuration | Motor Tuning Screen.  Make sure the setup units (not GCode units) match the mode of your values.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Servo Dither/Hunting - (oscillation around zero error)===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;Servos have high accuracy because they are always actively trying to make corrections and drive the error to zero.  Unfortunately this can sometimes cause annoying dither or position hunting around zero when not moving.  This is a very complex non-linear effect dependent on the dynamics of the mechanics.  Because of the highly non-linear quantization effects of single &amp;quot;steps&amp;quot; in the encoder position, stiction, backlash, etc. it follows different rules and is harder to analyze than normal servo tuning/stability in the larger magnitude more linear regime.  For example attempting to apply &amp;quot;Damping&amp;quot; is unlikely to work.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Lowering gains will usually help at the expense of performance.  However in many cases more than acceptable performance can be achieved with lower gains so one should consider if the higher gains are really needed.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;KFLOP has a Deadband Gain and Range feature that can basically be used to tell the servo to not attempt to correct small errors (treat the errors as zero), or to try to correct them less aggressively (with a Gain less than 1.0).  See [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Dead_Band here for more information]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Unfortunately adding Deadband doesn't always help the servo &amp;quot;sit still&amp;quot; and may actually increase the size of the dither depending on the dynamics.&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that when the servo is commanded to a non integer position ie 999999.7 encoder counts without deadband the servo will always be making corrections.  The best the servo can do is dither between encoder positions 999999.0 and 1000000.0.  With an error of either -0.7 or +0.3.  A servo with Integrator gain will guarantee the average is 999999.7&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;If dither is still a major problem a C Program might be used to monitor things and change settings under certain conditions to reduce dither.  See the example AntiServoDither__ALL.c which monitors for small errors for a period of time and if so reduces or turns off Integrator gain.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
===Noisy GCode - Trajectory Planner Smoothing===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;An analysis of Quantization Noise in GCode and Trajectory Planner Settings to generate smooth motion.&amp;lt;br /&amp;gt;[[File:GCode_Noisy_Path.png|none|link=|432x432px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[Trajectory Planner Smoothing Noisy GCode|See Analysis and Solution]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===Arc &amp;quot;faceting&amp;quot; - Trajectory Planner - Collinear Tolerance===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[File:ArcsTrajectoryZoomXTol.0005.png|none|link=|526x460px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[ArcFacetingColinearTol|See Analysis and Solution]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===I Gain/Max Limit Integrator===&lt;br /&gt;
I (Integrator) Gain can be used to eliminate persistent errors.  In fact any Integrator Gain at all guarantees the average error over infinite time is zero.  Without I Gain a system might have a small error that does not create enough output to overcome stiction to make a correction.  In such a case the error could persist forever.  Not so with any Integrator Gain.  Any error will be integrated and ramp the output higher and higher until eventually there will be a correction.  That assumes the Integrator or Output doesn't saturate or reach their programmed limits.  The rate the output ramps (or sums) is dependent on the size of the error and the I Gain value.  The Error x I Gain is summed every servo sample (90us).  This is why I Gain values are often small numbers (0.0001 - 0.01 typical range).  There is no guarantee that the position doesn't over shoot the target Destination.  In fact it is likely as as any error (area) under the trajectory will always be balanced by an equal area over the trajectory.  Too high of I Gain will make the system unstable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another case where I Gain is useful is when moving at high speed with a Velocity Amplifier.  To move at high speed a significant amount of output is required.  Without I Gain a significant amount of error could be required to provide this Output (ie Error x P Gain = Output).    With I Gain the Integrator will eventually ramp up to provide any Output necessary to move at the desired speed driving the error to zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Integrators have an issue often referred to as &amp;quot;Integrator Wind Up&amp;quot;.  This issue usually doesn't arise under normal conditions.  However if something is preventing the servo from making a correction such as forcing the position away from the target for a sustained amount of time, or disabling the amplifier, the Integrator will integrate to a huge unlimited value.  When the force is removed or amplifier re-enabled, the Integrator will likely cause a violent motion and overshoot.  Max Limit Integrator can help to minimize this issue by limiting the amount the Integrator can ramp up to.  So the Max Limit Integrator Value should be set at the minimum value that can still allow the Integrator to function in normal circumstances.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Typically there are two cases that should be considered when determining the Max Limit Integrator. &lt;br /&gt;
&lt;br /&gt;
# The amount of output expected to be required to overcome any stiction, friction, or other forces (cutting, gravity, etc...).  This is often not a large value and can be estimated or can be observed from the Step Response Screen (green plot right side scale is the output) when making a move.&lt;br /&gt;
# The amount of output required to provide the output needed to move at speed.  It is important to note that D Gain provides a damping or drag effect on the Output.  So the Integrator must be able to ramp up to a sufficient level to overcome the damping or drag effect and still provide enough output to move at the commanded speed.  For example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assume:&lt;br /&gt;
&lt;br /&gt;
# Commanded speed of 500,000 counts/sec&lt;br /&gt;
# D Gain of 35&lt;br /&gt;
# Output required to move at speed is 1800 DAC Counts&lt;br /&gt;
# Servo Sample Time of 90us&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Damping effect = Speed x D Gain x Sample Time = 500000 x 35 x 90e-6 = 1575 counts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Required Integrator Value = 1800 + 1575 = 3375&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So to provide some margin an Max Limit Integrator Value of 3500 might be used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Max Limits - Error===&lt;br /&gt;
Max limits error can be helpful to have your system respond less violently in the abnormal event where an excessively large error occurs.  Normally with a properly tuned system following errors should be small.   Setting a Max limits error can cause the servo to treat errors beyond a specified limit as if they were only the size of the limit and therefore respond less so than they would otherwise.  The max limits error is normally set to a value so it is not limiting under normal circumstances.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Plot below shows a situation where a small max limits error combined with a low P gain severely limits the Output.  In the plot below a large move (10000 counts) at a high speed (40000 counts/sec) is commanded.  Only P Gain (0.2) is used to provide the Output (green).  The max error limit of 200 combined with the low gain (0.2) limits the output to only 40 DAC counts.  Even as the true error increases to many thousands of counts, the servo is told to ignore the amount over 200.  So the output can never exceed 40 DAC counts.  The 40 DAC count limit means that the Axis is therefor not capable of providing the output necessary to keep up with the commanded motion.  The axis does the best it can with the limited output, and only does a fraction of the desired motion.&lt;br /&gt;
&lt;br /&gt;
[[File:Move10000.png|none|link=|665x431px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After increasing the max limits error the Output (green - right scale) now goes to a much higher value (900), and the Position (red) follows the Command (blue) to a much better degree.&lt;br /&gt;
&lt;br /&gt;
[[File:Move10000_nolimit.png|none|link=|667x430px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Increasing the P Gain to 1.6 also applies more Output sooner and the Position follows the command still better.&lt;br /&gt;
&lt;br /&gt;
[[File:Move1000_p1.6.png|none|link=|667x432px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Lead Compensator vs Derivative Gain===&lt;br /&gt;
Derivative (D) Gain is often used to help stabilize a system.&amp;amp;nbsp; It helps to think in the Frequency Domain to help understand how the two forms of compensation help.&amp;amp;nbsp; Please read below and [http://dynomotion.com/Help/BodeScreen/BodeScreen.htm this] for more information on the Frequency Domain.&amp;amp;nbsp; Both Compensation methods add positive phase to help stabilize the system.&amp;amp;nbsp; Unfortunately both methods increase gain at higher frequencies possibly causing the system to go unstable at higher frequency.&amp;amp;nbsp; A Lead Compensator provides the benefit of positive phase but without as much gain increase at higher frequencies.&amp;amp;nbsp; This figure shows a simplified Gain Plot comparison:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:DGainvsLead.png|none|link=|593x593px]]&lt;br /&gt;
&lt;br /&gt;
Here is a Bode Plot of a P=0.5 D=20 Compensator.   Note the KMotion.exe Bode Plot Screen has the capability of plotting the Frequency Domain Response of the PID+Filters Compensation.  Assume we desire positive phase to be added at 40Hz.  Notice the positive phase of 40 degrees at 40Hz which is good.  However the Gain increase in the 1KHz region of about 21db which is bad.&lt;br /&gt;
&lt;br /&gt;
[[File:P.5D20Annotate.png|none|link=|621x460px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a Bode Plot of a P=0.5 N1=N2=25Hz D1=D2=70Hz Compensator.   Assume we desire positive phase to be added at 40Hz.  We choose N1 N2 and D1 D2 to surround the frequency where the positive phase is desired.  Moving them further apart will increase the amount of positive phase but also increase the added Gain.  Notice the positive phase of 60 degrees at 40Hz which is good.  However the Gain increase in the 1KHz region of about 12db which is bad.  However both are improvements over the D Gain compensator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:PoleZeroFilter.png|none|link=|210x319px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:P.5D0N25D70Annotate.png|none|link=|644x478px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Tuning Master/Slave Configurations===&lt;br /&gt;
Master/Slave [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Master/Slave_Settings Configurations] allow two (or more) motors to drive the same axis.  Slaves are configured to follow a Master Axis.  For example two lead screws on both sides of a gantry.&lt;br /&gt;
&lt;br /&gt;
Tuning slaved axes is kind of a catch 22.  In order to tune one axis the other axis must be tuned well enough to follow and vice versa.  If possible, disconnect any mechanical linkage between the Master and Slave and test them separately without Slaving the Axes together to verify each axis Servos (can hold a position), moves at least somewhat properly, and moves in the same direction (assuming a positive [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Master/Slave_Settings Slave Gain] will be used).&lt;br /&gt;
&lt;br /&gt;
It is usually possible to incrementally tune each axis, at first moving slowly, then later at higher speeds, accelerations, and gains.  Only the Master Axis can be tested with the [http://dynomotion.com/Help/StepScreen/StepScreen.htm Step Response Screen].  This is because the Slave will follow any movement of the Master, but the Master will not follow movement of the Slave.  So if the Master Axis is moved all is well as both axes will move together, but if you try to move the Slave axis the two axes will fight.  The Master fighting to stay where it is, and the Slave fighting to move.&lt;br /&gt;
&lt;br /&gt;
To test/tune the Slave axis temporarily reverse the Master/Slave roles to make it the Master and then test it as the Master.&lt;br /&gt;
&lt;br /&gt;
Note: only the Master Axis should be included into the Coordinated Motion System.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Bode Plots===&lt;br /&gt;
A Bode Plot is a powerful tool for characterizing and providing insight into a dynamic system. It can help determine closed loop stability, bandwidth/performance, resonant frequencies, and more. It is entirely based on the system being linear. Linear in the sense that if the amplitude of some input signal is changed then the output signal will change proportionally as well. Unfortunately most systems are not entirely linear. Stiction, backlash, encoder quantization, amplifier saturation, and other effects are non-linear. For example driving a system with a signal too small to overcome stiction will result in no output at all whereas a larger signal will result in some output. This is clearly non-linear behavior. It would be nice to use a technique that handles non-linear systems but basically none are known.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;A Bode Plot is made injecting a stimulus to the system and observing how the system responds. For the reasons of non-linearity it is very important to perform a Bode Plot measurement using a representative level of stimulus similar to what the system will actually have during normal operation. If the Stimulus is not adjusted properly the result is likely to be completely invalid. Additionally the system should be reasonably tuned and stable so that it is responding in a reasonable way to the stimulus. If the system is unstable or very poorly tuned the result is likely to be completely invalid.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;You might think of it somewhat like shaking a box to determine what is in it. You should shake it with enough intensity and at frequencies to get some reaction, but not so high of intensity to break or distort the object inside.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;To create a Bode Plot use the KMotion.exe Bode Plot Screen. First select Plot: Time domain - Command, Position, Output vs Time and adjust the Amplitude and cutoff Freq until there is small but significant Position (red) changes (ie 50 encoder counts), at a frequency low enough that the Position at least somewhat attempts to follow the Command (blue), and where the Output (green) is not near saturation for the Drive being used.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;After the Stimulus/Noise Injection settings are set switch to Plot: Open Loop - Magnitude and Phase vs Frequency. Set the number of Samples to average (ie 20) and perform a Measurement.&amp;amp;nbsp; [http://dynomotion.com/Help/BodeScreen/BodeScreen.htm See here for more information].&lt;br /&gt;
&lt;br /&gt;
===Links to other Information on Tuning and Bode Plots===&lt;br /&gt;
[http://ctms.engin.umich.edu/CTMS/index.php?example=Introduction&amp;amp;section=ControlFrequency umich.edu Introduction section Control Frequency]&lt;br /&gt;
&lt;br /&gt;
[http://www.motiontech.com.au/assets/pdf/Kollmorgen%20Use%20Control%20Theory%20to%20Improve%20Servo%20Performance%20230712.pdf  Kollmorgen Use Control Theory to Improve Servo Performance 230712.pdf]&lt;br /&gt;
&lt;br /&gt;
==Problems and Resolutions==&lt;br /&gt;
====General====&lt;br /&gt;
:* [[Noise - Typical Problems and Resolutions|Dealing with noise on inputs]].  If you experience issues with inputs misreading, the issue may be noise.  This page provides examples on what might be causing noise issues and examples of how to possibly deal with noise.&lt;br /&gt;
:* Other&lt;br /&gt;
===Software-Specific Problems and Resolutions===&lt;br /&gt;
:* Place links to pages explaining resolutions to problems that are largely software-related here&lt;br /&gt;
[[KFLOP User C Programs Compiling/Launching Slowly because of Windows Defender]]&lt;br /&gt;
&lt;br /&gt;
===Hardware-Specific Problems and Resolutions===&lt;br /&gt;
:* Place links to pages explaining resolutions to problems that are largely hardware-related&lt;br /&gt;
====[[Step/Dir Drives lose 2 Steps for each pair of Direction Reversals]]====&lt;br /&gt;
&lt;br /&gt;
==Applications and Projects==&lt;br /&gt;
:* Place links to pages that explain how you accomplished your particular project.  Write clear explanations that provide background on what you did and how you did it.&lt;br /&gt;
====[[Tool Changer - router linear 4 Tools - C Program]]====&lt;br /&gt;
[[File:LINEAT+ATC.jpg|none|link=|246x178px]]&lt;br /&gt;
More linear milling tools: https://www.ichome.com/&lt;br /&gt;
&lt;br /&gt;
====[[Part Zero &amp;amp; Tool Height Touch Plate|Part Zero &amp;amp; Tool Height Touch Plate]]====&lt;br /&gt;
====[[Driving Hobby Servos]]====&lt;br /&gt;
[[File:HobbyServo.png|left|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
HiTec Type&lt;br /&gt;
&lt;br /&gt;
==Electrical Discharge Machining==&lt;br /&gt;
[https://en.wikipedia.org/wiki/Electrical_discharge_machining EDM (wikipedia)] is a method of cutting materials with high precision and detail.  Dynomotion Motion Controllers work well for EDM because of the ability for feedrate to be dynamically controlled including reversal along cutting path.&lt;br /&gt;
&lt;br /&gt;
[[Information on BAXEDM Arc Generators used with KFLOP]]&lt;br /&gt;
&lt;br /&gt;
Applied Science video that shows how to build an BAXEDM drilling machine using KFLOP and describes how it works:&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|https://youtu.be/rpHYBz7ToII|||||start=980}}&lt;br /&gt;
&lt;br /&gt;
==How to convert a milling machine to a 3D printer in 3 easy steps==&lt;br /&gt;
[[File:CNCto3DPrinter.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
More information [[How to convert a milling machine to a 3D printer in 3 easy steps|here]].&lt;br /&gt;
&lt;br /&gt;
==International and other Languages==&lt;br /&gt;
[[Russian]]&lt;br /&gt;
&lt;br /&gt;
[[Spanish]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/Main_Page"/>
				<updated>2024-04-04T23:57:53Z</updated>
		
		<summary type="html">&lt;p&gt;TK: /* Installation Topics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Dynomotion wiki'''&amp;lt;span style=&amp;quot;color: #999999;&amp;quot;&amp;gt;'''&amp;lt;br /&amp;gt;'''&amp;lt;/span&amp;gt;==&lt;br /&gt;
Welcome to our wiki where you can find and share knowledge on Dynomotion's systems.  To begin adding information to this wiki, simply create an account, verify your email, and start editing (click pencil icon). To make editing pages easier for everyone, we have installed a [https://help.bluespice.com/index.php/VisualEditor visual editor] by default.  This visual editor allows you to edit a wiki page much like you would a standard word processing document.&amp;amp;nbsp; For the seasoned wiki editors, standard [https://www.mediawiki.org/wiki/Help:Editing MediaWiki editing] may also be used.&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Warning: Use at your own risk.&amp;amp;nbsp; Information is for example purposes only and may contain errors.&amp;amp;nbsp; It is up to the User to verify the information is correct and is safe to use. In no case will any contributor or Dynomotion be liable for incorrect information.  Dynomotion reserves the right to modify or delete any contributions.&amp;lt;br /&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Thanks for Contributing!&lt;br /&gt;
&lt;br /&gt;
[http://dynomotion.com Official Dynomotion Site]&lt;br /&gt;
&lt;br /&gt;
==Editing and Creating Wiki Pages==&lt;br /&gt;
Unintuitively, you first create a link to the page you want to make before you can make the page.  To make a new page: while editing, right-click where you want your link to be, insert a link with a descriptive title and link text, save the page, click on the link you created, then click on &amp;quot;Empty Page&amp;quot; to begin editing your new page.&lt;br /&gt;
&lt;br /&gt;
Here are a few other quick tips:&lt;br /&gt;
&lt;br /&gt;
* You can insert links or images by Right-Clicking with the mouse on the line where you want the link or image to appear.&lt;br /&gt;
* For Spell Correction you can use Ctrl-Right-Click. &lt;br /&gt;
* To insert a YouTube Video use an EmbedVideo command such as &amp;lt;nowiki&amp;gt; {{#ev:youtube|xxxxx}}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;with xxxxx changed to the Video ID.&lt;br /&gt;
* Choose a descriptive page name and link text when creating a new page: e.g. Not &amp;quot;My Machine&amp;quot;, but rather &amp;quot;Brand X Three Axis Milling Machine Retrofit&amp;quot;&lt;br /&gt;
* Create pages in an organized manner: Describe what the page is about, create clear sections that flow&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
[[Help:New Page Creation|How to create a new wiki page]]&lt;br /&gt;
&lt;br /&gt;
[[Help:Editing Pages|How to Edit and insert Media into your wiki pages]]&lt;br /&gt;
&lt;br /&gt;
==Dynomotion Software Topics==&lt;br /&gt;
===Installation Topics===&lt;br /&gt;
* Announcement of our Latest Release (5.3.3) on the [https://www.dynomotion.com/forum/viewtopic.php?f=4&amp;amp;t=1752 Dynomotion Forum]&lt;br /&gt;
* [https://dynomotion.com/Software/Download.html Latest Release] Note: For Windows 7 64bit signed Drivers to work, all Windows Updates should be performed.&lt;br /&gt;
* [[Upgrading from previous KMotion Versions]]&lt;br /&gt;
&lt;br /&gt;
Archive of Test Releases:&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 02/01/2024: [https://dynomotion.com/Software/KMotion5.3.2.exe KMotion.exe 5.3.2], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.2%20Changes.pdf 5.3.2 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 11/20/2023: [https://dynomotion.com/Software/KMotion5.3.1.exe KMotion.exe 5.3.1], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.1%20Changes.pdf 5.3.1 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/19/2023: [https://dynomotion.com/Software/KMotion5.3.0.exe KMotion.exe 5.3.0], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.0%20Changes.pdf 5.3.0 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 06/30/2023: [https://dynomotion.com/Software/KMotion5.1.0.exe KMotion.exe 5.1.0], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.1.0%20Changes.pdf 5.1.0 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 05/01/2023: [https://dynomotion.com/Software/KMotion5.0.7.exe KMotion.exe 5.0.7], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.0.7%20Changes.pdf 5.0.7 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/21/2022: [https://dynomotion.com/Software/KMotion435h.exe KMotion.exe V4.35h], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35h%20Changes.pdf V4.35h release notes (pdf)]&lt;br /&gt;
* Previous Version 4.35g was not released, but see the change notes for this version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35g%20Changes.pdf V4.35g change notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/28/2020: [https://dynomotion.com/Software/KMotion435f.exe KMotion.exe V4.35f], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35f%20Changes.pdf V4.35f release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 11/18/2019: [https://dynomotion.com/Software/KMotion435e.exe KMotion.exe V4.35e], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35e%20Changes.pdf V4.35e release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/10/2019: [https://dynomotion.com/Software/KMotion435d.exe KMotion.exe V4.35d], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35d%20Changes.pdf V4.35d release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 01/28/2019: [https://dynomotion.com/Software/KMotion435b.exe KMotion.exe V4.35b], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35b%20Changes.pdf V4.35b release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/21/2018: [https://dynomotion.com/Software/KMotion435a.exe KMotion.exe V4.35a], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35a%20Changes.pdf V4.35a release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/28/2017: [https://dynomotion.com/Software/KMotion434j.exe KMotion.exe V4.34j], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34j%20Changes.pdf V4.34j release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 05/07/2017: [https://dynomotion.com/Software/KMotion434i.exe KMotion.exe V4.34i], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34i%20Changes.pdf V4.34i release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/14/2016: [https://dynomotion.com/Software/KMotion434h.exe KMotion.exe V4.34h], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34h%20Changes.pdf V4.34h release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/13/2016: [https://dynomotion.com/Software/KMotion434g.exe KMotion.exe V4.34g], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34g%20Changes.pdf V4.34g release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/05/2016: [https://dynomotion.com/Software/KMotion434f.exe KMotion.exe V4.34f], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34f%20Changes.pdf V4.34f release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 11/07/2016: [https://dynomotion.com/Software/KMotion434e.exe KMotion.exe V4.34e], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34e%20Changes.pdf V4.34e release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/32/2016: [https://dynomotion.com/Software/KMotion434d.exe KMotion.exe V4.34d], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34d%20Changes.pdf V4.34d release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/23/2016: [https://dynomotion.com/Software/KMotion434c.exe KMotion.exe V4.34c], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34c%20Changes.pdf V4.34c release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/03/2016: [https://dynomotion.com/Software/KMotion434b.exe KMotion.exe V4.34b], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34b%20Changes.pdf V4.34b release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 03/09/2016: [https://dynomotion.com/Software/KMotion434a.exe KMotion.exe V4.34a], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34a%20Changes.pdf V4.34a release notes (pdf)]&lt;br /&gt;
* [https://dynomotion.com/Help/KFLOPQuickStart/KFLOPQuickStart.htm How to install KMotion.exe and KMotionCNC]&lt;br /&gt;
* [[How to install KMotion.exe and KMotion in Windows 10|Preparing Windows 10 for driver installation]] (no longer required)&lt;br /&gt;
* [[Special Case for Windows 8.1 Industry Embedded Enterprise]]&lt;br /&gt;
* [[Updating KFLOP Firmware|How to update KFLOP Firmware]] - whenever a new version of software is installed, the firmware within KFLOP must be updated to match the new version&lt;br /&gt;
&lt;br /&gt;
===KMotion.exe Executive Software Topics===&lt;br /&gt;
KMotion.exe is the main program that is used to configure settings in KFLOP, initialize axes, and to write C programs to configure and setup KFLOP to control your system. In this program you can plot step response, test movement, view Bode plots, monitor I/O, set filter parameters, and generally set the pertinent parameters.&lt;br /&gt;
&lt;br /&gt;
* [http://www.dynomotion.com/Help/index.htm General software information] from the manuals&lt;br /&gt;
* Insert pages for other KMotion.exe-related topics here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Configuration Topics===&lt;br /&gt;
====Channels, Channels, Channels what are they?====&lt;br /&gt;
[[Channels Channels Channels|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====How to Setup Backlash Compensation====&lt;br /&gt;
[[Backlash Compensation|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====PWM Output Mode====&lt;br /&gt;
[[PWM Output Mode|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
===KMotionCNC Software Topics===&lt;br /&gt;
KMotionCNC is Dynomotion's CNC program used as a graphical user interface to your KFLOP-enabled machine tool. KMotionCNC has all of the basic functionality you need to run a machine of up to 6 axes, in addition to spindle control.&lt;br /&gt;
&lt;br /&gt;
* Insert pages for other KMotionCNC-related general topics here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;Using KMotionCNC&amp;lt;/span&amp;gt;====&lt;br /&gt;
* Homing discussion - page to be created&lt;br /&gt;
* Insert other KMotionCNC use pages here&lt;br /&gt;
&lt;br /&gt;
[[Internal/concave Path Tool Radius Compensation Example G41/G42]]&lt;br /&gt;
&lt;br /&gt;
[[Known KMotionCNC CAD/CAM Post Processors]]&lt;br /&gt;
&lt;br /&gt;
[[Invoking C Programs with Execute Only for previously Downloaded Programs]]&lt;br /&gt;
&lt;br /&gt;
[[Rigid Tapping G84 Setup and Use]]&lt;br /&gt;
&lt;br /&gt;
[[Tool Length/Offsets G43Hn G49]]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;Customize KMotionCNC&amp;lt;/span&amp;gt;====&lt;br /&gt;
KMotionCNC is written as a Windows C++ MFC (Microsoft Foundation Classes) program developed in Visual Studio.  Source code is provided and may be customized using Visual Studio.  MFC Support is a requirement. &lt;br /&gt;
&lt;br /&gt;
: '''General Information'''&lt;br /&gt;
: Compiling KMotionCNC&lt;br /&gt;
:: The KMotionCNC's Visual Studio Project Solution (\PC VC Programs\KMotionCNC\KMotionCNC.sln) is currently written for Visual Studio 2015 Standard.  This version can be used for the simplest compatibility.  Projects can be upgraded to newer version of VS with minimal effort.  Including Microsoft's Free Visual Studio 2013 Community.  [[PC Example Applications|More info on PC Example Applications.]]&lt;br /&gt;
:: Note Test Versions 4.34a and later have project solutions targeted for Visual Studio 2015 Community which is free for most Users.&lt;br /&gt;
: '''KMotionCNC Customization Examples and Applications'''&lt;br /&gt;
:: Links to examples of projects that explain KMotionCNC customizations. Troy (tmday7) created some helpful documents (PDF format):&lt;br /&gt;
: &lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/How%20to%20Edit%20KMotionCNC%20Faces.pdf How to edit KMotionCNC faces]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20External%20Buttons.pdf Adding external buttons]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20More%20User%20Buttons.pdf Adding more user buttons]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20Jog%20Percent%20Cell%20to%20Main%20Dialog%20Face.pdf Adding Jog Percent Cell to Main Dialog Face]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;KMotionCNC Screen Editor&amp;lt;/span&amp;gt;====&lt;br /&gt;
Introduces the capability of using Screen Script files to modify the look and function of KMotionCNC.&amp;lt;br /&amp;gt;[[KMotionCNC Screen Editor|More information.]]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;KMotionCNC Geometric Correction&amp;lt;/span&amp;gt;====&lt;br /&gt;
Information regarding the powerful [https://dynomotion.com/Help/KMotionCNC/GeoCorrection.htm Geometric Correction capability] which allows calibration and distortion correction of the XY CAD space to Machine/Actuator Space as well as flatness in Z.  Simple 4 point correction tables can apply XY Scale, Rotation, skew, offset, tilt.  Larger tables can apply more non-linear corrections.&lt;br /&gt;
&lt;br /&gt;
Note the Geometric Correction is built into the KMotion Libraries and can be utilized by Custom Programs as well as with KMotionCNC&amp;lt;br /&amp;gt;[[Geometric Correction|More information and Examples.]]&lt;br /&gt;
&lt;br /&gt;
===PC Example Applications===&lt;br /&gt;
A number of PC Applications using the KMotion Libraries are available in the Software download.&amp;amp;nbsp; Visual Studio should be used to modify/compile the applications.&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note All the projects in KMotion Versions 4.34a and later have now been updated and should work out-of-the-box with VS2015.'''&lt;br /&gt;
&lt;br /&gt;
[[PC Example Applications|More information.]]&lt;br /&gt;
&lt;br /&gt;
===KMotion Libraries - GCode Interpreter - Trajectory Planner - Coordinated Motion - .NET===&lt;br /&gt;
The KMotion Libraries are a series of DLLs (Dynamic Link Libraries) that reside on the PC that contain the common core motion control, I/O, and communication functionality for KFLOP.  These libraries permit PC Applications to be built using high level control without being concerned with the underlying details of Interpreting GCode, Trajectory Planning, Coordinated Motion, Motion Buffering, USB Communication, etc.&lt;br /&gt;
&lt;br /&gt;
[[KMotion Libraries - GCode Interpreter - Trajectory Planner - Coordinated Motion - .NET|More information]].&lt;br /&gt;
&lt;br /&gt;
===Kinematics===&lt;br /&gt;
The KMotion Libraries contain a Kinematics Layer where Users can add their own non-linear Kinematics&lt;br /&gt;
&lt;br /&gt;
[[Kinematics|More information]].&lt;br /&gt;
&lt;br /&gt;
===KFLOP C Programs===&lt;br /&gt;
C Programs provide a powerful and flexible capability to perform almost any sequence of operations within KFLOP.   In most cases after you have tested and tuned all your hardware using the KMotion.exe setup program all the settings and initialization steps required for your system can be placed into an Initialization C Program so that your system can be fully initialized simply by executing the Initialization program.&lt;br /&gt;
&lt;br /&gt;
[[KFLOP C Programs|More Information]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ModBus===&lt;br /&gt;
Modbus can be connected to the PC or directly to KFLOP.  A PC connection will not be deterministically real-time but may work for basic speed control and on/off.  Here is a related Thread for interfacing KMotionCNC to Modbus using a [http://www.modbusdriver.com/modpoll.html free utility]:&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/sending%20ModBus%20msgs%20from%20KmotionCNC%20to%20a%20RS485%20port.html Sending ModBus msgs from KmotionCNC to a RS485 port]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To connect Modbus directly to KFLOP's [http://www.dynomotion.com/Help/RS232/RS232.htm UART] see the C Examples in \C Programs\RS232\ModBus\&lt;br /&gt;
&lt;br /&gt;
===Linux Support===&lt;br /&gt;
KMotion Motion Libraries are fully supported under Microsoft Windows. Some Users have ported the KMotion Libraries to Linux.  Dynomotion will offer support where possible but can't offer full support under Linux.  Special Thanks to [https://github.com/parhansson/KMotionX Par Hansson] for the initial Linux Port.&lt;br /&gt;
&lt;br /&gt;
See [[Linux|here]] for more info.&lt;br /&gt;
&lt;br /&gt;
==Dynomotion Hardware Topics==&lt;br /&gt;
===General Hardware Information===&lt;br /&gt;
====[[KFLOP Hardware Info|KFLOP specific Hardware Info]]====&lt;br /&gt;
====[[KStep Hardware Info|KStep specific Hardware Info]]====&lt;br /&gt;
====[[Kanalog Hardware Info|Kanalog specific Hardware Info]]====&lt;br /&gt;
====[[SnapAmp Info|SnapAmp specific Hardware Info]]====&lt;br /&gt;
====[[Konnect Hardware Info|Konnect specific Hardware Info]]====&lt;br /&gt;
&lt;br /&gt;
===Wiring Diagrams===&lt;br /&gt;
[[Media:Kanalog_Connections.pdf|Basic Kanalog DAC and Encoder Connections 3 Axis]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KanalogSchematic3Axis.pdf|Basic Kanalog DAC and Encoder Connections 3 Axis #2]]&lt;br /&gt;
&lt;br /&gt;
[[Media:dyn4 kanalog KE1524 V1.1.png|Basic Kanalog DAC and DMM DYN4 Drive 1 Axis]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Kflop-Kanalog_wiring_11-19-2018.pdf|Kanalog with Geckos G210 updated 11-19-2018]] (Thanks to &amp;lt;span style=&amp;quot;color: windowtext;&amp;quot;&amp;gt;Joseph Mirocha&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog_to_Tree_Journeyman_325_by_Rick_B.pdf|Kanalog to Tree Journeyman 325.pdf]] (Thanks to &amp;lt;span style=&amp;quot;color: windowtext;&amp;quot;&amp;gt;Rick_B&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Media:KFlopSnapBrushMPG.pdf|KFLOP+SnapAmp DC Brush Motors with MPG]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Stepper_Wiring_Diagram_Step-Dir_on_JP5.pdf|KFLOP JP5 Open Collector Step/Dir Connections to Power Step PSD5042-2P Drives ]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Matrika_V1_wiring_diagram_Rev1.pdf|KFLOP+KStep with VFD and NPN Limit Switches for Matrika Rev1]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KonnectTouchPlate.png|Touch Plate Wiring to Konnect]]&lt;br /&gt;
&lt;br /&gt;
[https://easyeda.com/350banshee/BreakoutBoard-93bdd16e3c3d48b98ae66c34f2436c40 User Created KFLOP JP7 Breakout/OptoIsolation Board] Schematic, Gerbers, PCBs Publicly available (thanks 350banshee)&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/wiki/index.php?action=ajax&amp;amp;title=-&amp;amp;rs=SecureFileStore::getFile&amp;amp;f=/b/bb/RotarySwitchToKanalog.png Rotary Switch Connected to Kanalog Opto Inputs]&lt;br /&gt;
&lt;br /&gt;
===3D Board Models===&lt;br /&gt;
[[Media:kflop-kstep-3d-models-1.snapshot.3.zip.txt|kflop-kstep-3d-models-1.snapshot.3.zip.txt]]  STEP file format - Thanks to Curtis&lt;br /&gt;
&lt;br /&gt;
[[File:kflop_kstep_render.JPG|none|link=|329x329px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:KFLOP3D_Step_IGS_Chris.zip.txt|KFLOP3D_Step_IGS_Chris.zip.txt]] STEP and IGS models - Thanks to Chris&lt;br /&gt;
&lt;br /&gt;
[[File:KFLOP_3D.png|none|link=|413x296px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:KONNECT_BOARD_MODEL.zip.txt|KONNECT_BOARD_MODEL.zip.txt]] STEP model - Thanks to Jeff Redington&lt;br /&gt;
&lt;br /&gt;
(Component locations may be off one way or another by .5mm)&lt;br /&gt;
&lt;br /&gt;
[[File:Konnect_Board.png|none|link=|339x292px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Konnect Basic Step file showing hole locations&lt;br /&gt;
&lt;br /&gt;
[[Media:KonnectHoles.stp.txt|KonnectHoles.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KonnectHoles.png|none|link=|352x323px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kanalog Step Model with Mechanical hole and Pin locations&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog.stp.txt|Kanalog.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KanalogFromStep.png|none|link=|304x279px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kanalog Step Model with Mechanical hole and Connectors (Thanks to&lt;br /&gt;
&lt;br /&gt;
Roberto Gotti of Powertech)'''&amp;lt;br /&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
[[Media:KANALOG_BOARD.stp.txt|KANALOG_BOARD.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KanalogWithConnectors.png|none|link=|311x286px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Board Terminal DXF/DWG files===&lt;br /&gt;
[[Media:KFLOP_Terminals.dxf|KFLOP_Terminals.dxf]] [[Media:KFLOP_Terminals.dwg|KFLOP_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog_Terminals.dxf|Kanalog_Terminals.dxf]] [[Media:Kanalog_Terminals.dwg|Kanalog_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Konnect_Terminals.dxf|Konnect_Terminals.dxf]] [[Media:Konnect_Terminals.dwg|Konnect_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KStep_Terminals.dxf|KStep_Terminals.dxf]] [[Media:KStep_Terminals.dwg|KStep_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
===Wiring Topics===&lt;br /&gt;
Place links to pages on wiring inputs and&lt;br /&gt;
&lt;br /&gt;
outputs specific to your experiences and projects.  Be descriptive with page titles and links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====KFLOP IDC Connectors and Cables====&lt;br /&gt;
Cables that connect between Dynomotion boards are normally included when purchasing the boards together. They are also very common and easy to make. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Use '''16-conductor or 26-conductor ribbon cable''' (0.05 inch pitch 26 AWG preferrably or 28AWG) and IDC sockets.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;[[File:RibbonCable.png|none|link=]]&lt;br /&gt;
16 conductor ribbon cable 3M part number 3801/16 100 &amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/3m/3801-16-100/3M156105-100-ND/1107501&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;26 conductor ribbon cable 3M part number C3801/26 100 &amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/3m/C3801-26-100/C3801-26-100-ND/1107648&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Winford also sells ribbon cable (although only the thinner 28 AWG):&amp;lt;br /&amp;gt;http://www.winford.com/products/rib.php&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Note you can usually tear off wires to reduce the number of conductors. For example from 26 down to 16. Tear off the conductors away from the red stripe that marks pin 1.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;The '''crimp tools''' are common:&amp;lt;br /&amp;gt;https://www.amazon.com/Accessories-Crimp-Ribbon-Cable-Connectors/dp/B007R2JEM4/&amp;lt;br /&amp;gt;[[File:RibbonCrimp.png|none|link=]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;'''IDC Sockets 16-pin '''(pin pitch 0.1 inch)&amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/assmann-wsw-components/AWP-16-7240-T/HHKC16H-ND/5031953&amp;lt;br /&amp;gt;Assman Part number AWP 16-7240-T&lt;br /&gt;
[[File:16pinIDC.png|none|link=]]&lt;br /&gt;
https://www.digikey.com/product-detail/en/assmann-wsw-components/AWP-26-7240-T/HHKC26H-ND/5011313&lt;br /&gt;
[[File:26pinIDC.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
====KFLOP KStep JR1 Molex Power Connectors====&lt;br /&gt;
KFLOP and KStep JR1 are standard Disk Drive Power Connectors. Possibly one of the most common connectors. Originally used on PC ATX Power Supplies. Sometimes referred to as Molex Connectors. They have 4 pins with 0.2 inch pitch with 0.083~0.084 inch socket pins. The mating cable will have female socket pins as shown here:&lt;br /&gt;
&lt;br /&gt;
[[File:Molex_female_connector.jpg|none|link=|251x168px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Molex Series 8981 P# [https://www.digikey.com/short/zjp329 0015244048]  using Molex Series 8980 Crimp Pins P# [https://www.digikey.com/short/zjp3ff 0002081201]&lt;br /&gt;
&lt;br /&gt;
Also AMP Series MATE-N-LOK P# [https://www.digikey.com/short/zjpq3n 1-480424-0] using AMP Series MATE-N-LOK Crimp Pins P# [https://www.digikey.com/short/zjpqqw 60619-1]&lt;br /&gt;
&lt;br /&gt;
====MPG Wiring and Interface====&lt;br /&gt;
MPGs (Manual Pulse Generators) should be connected directly to KFLOP for guaranteed real-time response (not USB based or connected to the PC).  MPGs are handled by a C Program that monitors the MPG and creates motion based on the MPG Encoder changes and switch selections for axis, speed, and so forth.  See the MPG C Program Examples.  Here is a Discussion with other links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/Jogging%20Pendant.html Jogging Pendant]&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/Connecting%20Keling%20MPG2%20pendant.html Connecting Keling MPG2 Pendant]&lt;br /&gt;
&lt;br /&gt;
[https://www.cnczone.com/forums/dynomotion-kflop-kanalog/349740-applying-acceleration-mpg-target-possible.html#post2119732 CNCZone Thread] on obtaining smooth filtered motion.&lt;br /&gt;
&lt;br /&gt;
[[File:MPG4_from_cnc4pc.jpg|none|link=|83x169px]]&lt;br /&gt;
&lt;br /&gt;
====Interfacing NPN Devices to KFLOP IO====&lt;br /&gt;
NPN devices (open collector)operate as a switch to GND and can be interfaced to KFLOP using a pull up resistor as shown below. When the transistor switches to 0V the KFLOP IO Pin is driven low. The transistor will need to sink ~3ma. When the transistor is off (open circuit) the resistor pulls the IO Pin to 3.3V. Note even though some KFLOP IO Pins can tolerate 5V pulling them above 3.8V should be avoided when possible so the 3.3V supply is used. This technique will only work with KFLOP IO Pins that do not have pull down resistors (JP7 and JP5). In some cases a 0.1uF Ceramic capacitor connected close to KFLOP might be added in parallel with the resistor to filter noise.  Cable shielding connected to KFLOP GND on the KFLOP end only is recommended.  Note that in noisy environments this technique may couple noise into KFLOP so opto isolation should be used instead.&lt;br /&gt;
&lt;br /&gt;
[[File:NPN_Interface_to_KFLOP.png|none|link=|544x544px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Multiplexing Encoder Inputs to KFLOP JP4 and JP6====&lt;br /&gt;
If KFLOP JP7 and JP5 are used for other purposes the encoder inputs can be multiplexed to KFLOP JP4 and JP6. There is an option to multiplex encoders 0-3 from JP7 to JP4 and another option to multiplex encoders 4-7 from JP5 to JP6. See the MuxEncoders.c for an example.&lt;br /&gt;
&lt;br /&gt;
Note the JP4 and JP6 IO are 3.3V inputs and shouldn't be driven hard (more than 10ma) above 3.8V. This is not usually an issue as most encoders or RS422 drivers don't do this. The inputs also have 150 ohm termination.&lt;br /&gt;
&lt;br /&gt;
The following line of code might be added to your Initialization C Program. It needs to be executed once to multiplex the encoders after any power cycle. Encoders 0-3 will then be input on JP4 and 4-7 will be on JP6. Both JP4 and Jp6 have 10 IO bits. The 4 encoders will appear on the first 8 IO bits. 2 bits for each encoder's A B channels in order. So for example Encoder #0 will appear on JP4 IO16 (Pin5) and IO17 (Pin6)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt; &lt;br /&gt;
// Mux encoder inputs from KFLOP JP7 &amp;amp; JP5 to JP4 and JP6&lt;br /&gt;
FPGAW(ENC_NOISE_FILTER_ADD) = ENC_0_3_JP4 + ENC_4_7_JP6 + ENC_NOISE_FILTER_DEFAULT_VAL; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JP4 and JP6 have +5V available on Pin1 and GND on Pins 8 and 9 that might be used to power 5V encoders.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span id=&amp;quot;Axes_Servo_Tuning_and_Trajectory_Planner&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axes Servo Tuning and Trajectory Planner&amp;lt;/span&amp;gt;==&lt;br /&gt;
===Basic Servo Tuning Overview===&lt;br /&gt;
Once an axis is configured and proved capable of holding a position it is ready to be tuned and optimized. Most often a small value of P Gain only is used to show the servo is functional and can hold position. The Servo may be very weak and inaccurate but will be functional.&lt;br /&gt;
&lt;br /&gt;
Every system is different and the tuning parameters are interactive in a manner that usually doesn't allow parameters to be determined one at a time. Rather after one parameter is changed it may be necessary to revisit the other parameters.&lt;br /&gt;
&lt;br /&gt;
In general higher gains will reduce errors and improve accuracy, but tend to make the system more unstable.  So the general idea is to increase gains to reduce errors as much as possible but still have a stable system.&lt;br /&gt;
&lt;br /&gt;
Often during tuning the system may go unstable. In fact, it is normally intentionally driven to instability to find its limits for a certain parameter. This can result in a violent oscillation or worse so one should be prepared to quickly disable the Servo. If an appropriate [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Max_Following_Error Max Following Error] is used the axis can be automatically disabled before the oscillation becomes too violent, yet not disable when performing a normal test.&lt;br /&gt;
&lt;br /&gt;
KMotion.exe allows you to change any axis parameter on the Step/Response, Config, or Filters Screens then simply push &amp;quot;Move&amp;quot; to see the effect of the change.  Note that as performance improves the errors will become small and difficult to see on the Position Plot without Zooming in (Left click drag) so changing the plot type to plot the error is useful.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The overall process normally goes something like this:&lt;br /&gt;
&lt;br /&gt;
# Select a Test [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Measurement Move Size] and [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Motion_Profile Motion Profile].  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Velocity.2C_Acceleration.2C_and_Jerk See Also]&lt;br /&gt;
# Select [http://dynomotion.com/Help/StepScreen/StepScreen.htm#max_limits Max Limits] to allow for the Test.  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Max_Limits_-_Error See Also]&lt;br /&gt;
# Determine maximum level of [http://dynomotion.com/Help/StepScreen/StepScreen.htm#PID P Gain]&lt;br /&gt;
# Determine maximum level of [http://dynomotion.com/Help/StepScreen/StepScreen.htm#PID D Gain] (with Low Pass Filtering)  See Also [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Torque_Servos_vs_Velocity_Servos here] and [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Lead_Compensator_vs_Derivative_Gain here].&lt;br /&gt;
# Determine new maximum level of P Gain now that D Gain increased stability&lt;br /&gt;
# Add I Gain to improve accuracy and remove steady state errors.  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#I_Gain.2FMax_Limit_Integrator See Also]&lt;br /&gt;
# Add [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Feed_Forward Feed Forward] to reduce errors&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Torque Servos vs Velocity Servos===&lt;br /&gt;
+/-10V Analog Amplifiers usually come in one of two varieties: '''Torque''' or '''Velocity'''. Torque mode amplifiers consider the input command as a Torque Command and work to generate the commanded Motor Torque. Velocity mode amplifiers consider the input command as a Velocity Command and work to generate the commanded Velocity.  Its important to understand what type of Amplifiers you have.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Velocity Mode Amplifiers''' need some form of feedback going to the Amplifier in order for the drive to know the current velocity. This might be a digital encoder or an analog tachometer.&lt;br /&gt;
&lt;br /&gt;
Its easy to tell if you have a Velocity Mode Amplifier by looking at a plot of a move on the Step Response Screen.  The Output (green plot with right scale) will be proportion to the motor velocity.  When moving at constant speed the output will be relatively constant.  See in the plot below the output (green) remains at a relatively constant ~1100 DAC counts while the position (red) ramps at a constant slope of the 90000 count/sec rate:&lt;br /&gt;
&lt;br /&gt;
[[File:VelocityAmp.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Velocity mode amplifiers can be relatively easy to tune using only P (Proportional) Gain.  Additional Gains and filters can be used for best performance but using only P Gain will often result in reasonable performance and a stable system (unlike Torque Mode Amplifiers). &lt;br /&gt;
&lt;br /&gt;
As an example consider controlling the speed of a car using only Proportional Gain as it approaches a target (Stop sign).  Consider a P Gain of 0.1 where at 1000ft from the stop sign we command 1000 x 0.1 = 100MPH.  Then at 100ft we command 10MPH.  Then at 10ft we command 1MPH.  This results in a nice, smooth, exponential approach, without overshoot.&lt;br /&gt;
&lt;br /&gt;
Contrast this with controlling the acceleration (torque) of a car using only Proportional Gain as it approaches a target (Stop sign).  At large distance we apply maximum acceleration.  Although as we approach the stop sign we reduce acceleration, we continue to accelerate and speed continues to increase until we pass the stop sign.  Torque mode servos are inherently unstable.  P only gain only works at all if there is some friction (the car is dragging a sled which slows us down with less torque).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Acceleration Mode Servos''' may or may not have any feedback.  If they have feedback it is usually used only to commutate a brushless motor.  In the plots the Output (green) will have large magnitude when the Position (red) is accelerating, where the plot has curvature (changing slope).&lt;br /&gt;
&lt;br /&gt;
Acceleration mode Servos are unlikely to work well or at all with only P Gain.  Some form of damping or lead compensation will usually be required to get a stable system.   D (derivative) Gain (or a lead compensator) should be included with the P Gain to help stabilize the system.  D Gain can be increased to make the system more stable up to a point.  After some point the additional D Gain will make the system more unstable. and should be reduced.&lt;br /&gt;
&lt;br /&gt;
When using D Gain (or lead compensation) the quantization noise (steps) in the encoder position can cause spikes in the output.  For example a D Gain of 100 will cause a spike of 100 counts in the output whenever the input changes suddenly by 1 count.  If the spikes are very high amplitude and short duration, the Amplifier may not handle them in the expected manner.  A low pass filter can be used to widen and reduce their amplitude allowing the amplifier to handle them more effectively.  Typically a 2nd order low pass filter of 500Hz Q=1.4 is used.  The last filter is normally used so it is applied to any Feed Forward. Such as:&lt;br /&gt;
&lt;br /&gt;
[[File:LowPass400Q1p4.png|none|link=|680x439px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;Velocity.2C_Acceleration.2C_and_Jerk&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Velocity, Acceleration, and Jerk&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;div id=&amp;quot;yui_3_16_0_1_1445622719616_3315&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;The Velocity, Acceleration, and Jerk in the Step Response Screen (KFLOP parameter settings) and the Acceleration and Velocity in the KMotionCNC | Tool Setup | Trajectory Planner | Axis Parameters are both used for different things.  The two sets of parameters are independent. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;yui_3_16_0_1_1445622719616_3313&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;The&amp;lt;/span&amp;gt; KFLOP parameters are used for 3rd order motions.   These include things like:  Jogging, Homing, and GCode Rapids (G0).  The units in KFLOP are in counts or steps.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span id=&amp;quot;yui_3_16_0_1_1445622719616_3320&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;The KMotionCNC parameters are used for 2nd order (&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;yui_3_16_0_1_1445622719616_3321&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;infinite &amp;lt;/span&amp;gt;Jerk) coordinated motion paths.  These are GCode G1,G2,G3 continuous paths.  The units are in Inches (or in some cases degrees).   Note there is an Option in KMotionCNC &amp;quot;Rapids as Feeds&amp;quot; where these parameters will also be used for Rapids.  But this option should only be used for highly non-linear Kinematic Systems which can not take advantage of faster/smoother 3rd order point to point straight line Rapids.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;Tests&amp;lt;/span&amp;gt; to find and verify optimal settings for both types of moves should be made using the Step Response Screen.  Optimal settings are usually determined by experimentation.  Although it might be possible to calculate the settings based on motor torque gains, back-emf, amplifier voltage/current, mass, moments of inertia, friction, encoder resolution, leadscrew pitch, required following accuracy, etc... It is often too complicated and with too many unknowns to be practical.  So experimental moves can be tested at ever increasing Velocities, Accelerations, and Jerks until the system is unable to follow the trajectory without having too much error or shock to the system.  After absolute limits of the system are determined then the settings should be backed off by some amount to provide operating margins (ie 20%).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;It is usually best to first determine max possible velocity using a relatively low acceleration. Maximum power is usually required at the point of the trajectory where velocity is high and still accelerating.  Supply Voltage limitations tend to limit velocity.  Current limitations tend to limit acceleration.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[File:MaxVelAccelPower.png|none|link=|485x361px]]&amp;lt;br /&amp;gt;The Step Response Screen always performs 3rd order motion but 2nd order motion can be simulated by temporarily setting the Jerk to a huge value (1000X the acceleration value).  In general reducing the Jerk value will result in longer times to perform motions, but often the improved smoothness will permit higher maximum accelerations and velocities to be used resulting in overall shorter motion times.  An analogy might be how you might stop more quickly in a car, without skidding or spilling your coffee, by applying the brakes harder in a more gradual manner rather than slamming on the brakes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;Make&amp;lt;/span&amp;gt; sure when testing the size of move is long enough for full acceleration and velocity are achieved.  A common mistake is to have Acceleration or Velocity Settings set to too high for your system but when testing a short move there is no indication of a problem.  The plot mode of Velocity Output  vs Time can be helpful to verify full Velocity is being achieved.&amp;lt;span id=&amp;quot;.C2.A0&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt; &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;The idea is that a motor axis has torque and speed limitations and you should determine and understand what they both are for your system. Available motor torque drops off with higher speed. At some speed the motor will not even be able to generate any torque at all. Motor torque is required to accelerate the axis. We need to make sure that no combination of velocity and acceleration will ever cause the axis to fault/stall/fail. So there is often a complex set of speeds and accelerations that will work ok that form an envelope of workable speed and acceleration. So one nice thing to know is top speed possible. It is like taking your car out on a long straight highway and gradually accelerating to find the max speed is 100MPH. You will then know that ever attempting a speed over 100MPH will always fail. Also speed should probably be limited to something like 80MPH to allow for margin and to allow reasonable acceleration up to that speed. The reason for performing the top speed test at low acceleration is to avoid a failure because of not being able to accelerate at the specified rate. So we want to set the acceleration to a low value so it will not be a limiting factor when determining top speed. However if we set the acceleration so low with a short trip distance we will never go very fast and the speed test will be meaningless. This should be avoided. Change the Plot type to Velocity, Output, vs Time to clearly see if this is the case.  You may want to turn off Measured Velocity if it obscures viewing the Commanded Velocity&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;For example to accelerate to 700,000 counts/sec at an acceleration rate of 700,000 counts/sec^2 would take 1 second. And then to slow back down would take 1 more second. So at least 2 seconds of motion would be required to get to full speed. A 100,000 count move (2 inches for a system with 50,000 counts/inch) takes much less time than that. Furthermore with a relatively low Jerk setting (1e6). This means the acceleration will be applied gradually over 0.7 seconds. This means an even much longer time and distance would be required to achieve top speed.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Here is the method to follow to find 2nd/3rd order motion profile limits:&amp;lt;br /&amp;gt;(note every system is different and will vary based on resolution, motor size/type, mass, etc...)&lt;br /&gt;
&lt;br /&gt;
'''1 - Find Max Velocity at low Acceleration and infinite Jerk'''&lt;br /&gt;
&lt;br /&gt;
Choose a Velocity to test (ie V=100000 counts/sec)&amp;lt;br /&amp;gt;Set a moderately low Acceleration Time of 1 second (A = V/1sec = 100000 counts/sec^2)&amp;lt;br /&amp;gt;Set very high Jerk so Acceleration is applied almost instantaneously in 0.001 sec (J = A/0.001sec = 1e8 counst/sec^3)&amp;lt;br /&amp;gt;Test a very long move 20 inches if possible (for resolution 50000 counts/inch, 1,000,000 counts)&amp;lt;br /&amp;gt;Plot Velocity, Output, vs time to see if V is actually obtained&amp;lt;br /&amp;gt;If the motion was successful repeat all above with higher V, if not try lower V&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Once Max V is found reduce by some margin (ie 20-50%)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Note you may decide on lower speed for other reasons (safety, vibration, noise, wobble, shock, etc....)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;'''2 - Find Max Acceleration for your system for the chosen Velocity'''&lt;br /&gt;
&lt;br /&gt;
Using the V found above increase A (keeping Jerk high in the same manner) until the system fails/faults/excessive shock, etc...&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Once Max A is found reduce by some margin (ie 20-50%)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;These V and A Values are now known good values for your system and can be used for 2nd order motions such as KMotionCNC Trajectory Planner or Mach3 Motor tuning. Note units will need to be converted (counts to inches or mm, time from seconds to minutes depending on the App)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3 - Find optimal 3rd order Jerk limited motions.'''&lt;br /&gt;
&lt;br /&gt;
The previous result from Step #1 and #2 used nearly infinite Jerk where Acceleration forces were applied nearly instantaneously. By reducing Jerk smoother motion should be possible. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Set Jerk so it is applied over 20ms (ie for A=200000 J = A/0.020 = 1e7&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Test to see if motions are smoother. With closed loop systems the Position Error Plot can be used to see if the motion has less error and is smoother. Open loop system will require you to hear the difference.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Increase/decrease Jerk to find the optimal value. Note reducing Jerk a lot will of course make the system very smooth, but will also be much slower using less acceleration and velocity which is undesirable. So the highest Jerk possible should be found that still provides some smoothness.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Reducing Jerk only will always make the system slower with less performance (but hopefully significantly smoother). It is usually then possible to increase Acceleration and Velocity somewhat to achieve even higher performance than what was possible with infinite Jerk while being as smooth or smoother.&lt;br /&gt;
&lt;br /&gt;
'''4 - Reduce Max Following Error Limit to small value'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;Now that the system is properly tuned and reasonable Acceleration, Velocity, and Jerk are set the motor Position should always follow the commanded Destinations accurately with only small errors.  By Plotting Position Errors under various conditions (Distances) you can get an idea of the worst case following errors under normal conditions.  The Max Following Error Parameter should be set to a value slightly larger than the worst case following error (ie 20~50% larger).  In this case if anything abnormal occurs: ie. The axis hits an obstacle, commanded at too high of a speed, servo goes unstable, hardware/electronics failure, a Following Error will be immediately detected and the axes disabled.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axis Resolution - counts/inch (or counts/mm)&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Its important to understand the resolution of your Axis which is the number of fundamental raw motor/driver encoder counts or motor steps per standard unit of distance (inch or mm).  Although tuning in KMotion.exe Step Response Screen and motions within KFLOP typically use units of raw counts or steps it is important to know how these translate to real-world distances, speeds, etc...  Later, applications such as KMotionCNC or Mach3 will need this information to scale motions properly.&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;There are usually a number of factors that combine together to determine the Axis Resolution.  These might include:&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;counts or steps per motor revolution&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;any gearing or belts and pulleys involved between motor and drive mechanisms&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;lead screw pitch, rack and pinion tooth pitch, drive belt radius, etc.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For example consider a Stepper Drive with:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;3200 steps per motor rev&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;2:1 gear reduction from motor to lead screw&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;0.2 inch lead screw pitch&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axis Resolution = 3200 step/motor rev x (2 motor rev/ screw rev)  / (0.2 inch / screw rev) = 32000 steps/inch&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;To determine whether your assumptions and calculations are correct perform a test.  Command as large of a move as convenient and measure the actual distance moved with a ruler.   For example in the axis described above you might command a move of 320000 steps.  This should result in a motion of:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;320000 steps / (32000 steps/inch) = 10 inches.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For KMotionCNC set the Axis Resolution in the [http://dynomotion.com/Help/KMotionCNC/ToolSetupScreenTP.htm#Axis_Motion_Parameters Tool Setup | Trajectory Planner Screen | Axis Parameters | cnts/inch].  Note units must be in units of inches.  If your resolution is in mm units multiply by 25.4.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For Mach3 enter the Axis Resolution in the Configuration | Motor Tuning Screen.  Make sure the setup units (not GCode units) match the mode of your values.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Servo Dither/Hunting - (oscillation around zero error)===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;Servos have high accuracy because they are always actively trying to make corrections and drive the error to zero.  Unfortunately this can sometimes cause annoying dither or position hunting around zero when not moving.  This is a very complex non-linear effect dependent on the dynamics of the mechanics.  Because of the highly non-linear quantization effects of single &amp;quot;steps&amp;quot; in the encoder position, stiction, backlash, etc. it follows different rules and is harder to analyze than normal servo tuning/stability in the larger magnitude more linear regime.  For example attempting to apply &amp;quot;Damping&amp;quot; is unlikely to work.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Lowering gains will usually help at the expense of performance.  However in many cases more than acceptable performance can be achieved with lower gains so one should consider if the higher gains are really needed.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;KFLOP has a Deadband Gain and Range feature that can basically be used to tell the servo to not attempt to correct small errors (treat the errors as zero), or to try to correct them less aggressively (with a Gain less than 1.0).  See [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Dead_Band here for more information]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Unfortunately adding Deadband doesn't always help the servo &amp;quot;sit still&amp;quot; and may actually increase the size of the dither depending on the dynamics.&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that when the servo is commanded to a non integer position ie 999999.7 encoder counts without deadband the servo will always be making corrections.  The best the servo can do is dither between encoder positions 999999.0 and 1000000.0.  With an error of either -0.7 or +0.3.  A servo with Integrator gain will guarantee the average is 999999.7&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;If dither is still a major problem a C Program might be used to monitor things and change settings under certain conditions to reduce dither.  See the example AntiServoDither__ALL.c which monitors for small errors for a period of time and if so reduces or turns off Integrator gain.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
===Noisy GCode - Trajectory Planner Smoothing===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;An analysis of Quantization Noise in GCode and Trajectory Planner Settings to generate smooth motion.&amp;lt;br /&amp;gt;[[File:GCode_Noisy_Path.png|none|link=|432x432px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[Trajectory Planner Smoothing Noisy GCode|See Analysis and Solution]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===Arc &amp;quot;faceting&amp;quot; - Trajectory Planner - Collinear Tolerance===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[File:ArcsTrajectoryZoomXTol.0005.png|none|link=|526x460px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[ArcFacetingColinearTol|See Analysis and Solution]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===I Gain/Max Limit Integrator===&lt;br /&gt;
I (Integrator) Gain can be used to eliminate persistent errors.  In fact any Integrator Gain at all guarantees the average error over infinite time is zero.  Without I Gain a system might have a small error that does not create enough output to overcome stiction to make a correction.  In such a case the error could persist forever.  Not so with any Integrator Gain.  Any error will be integrated and ramp the output higher and higher until eventually there will be a correction.  That assumes the Integrator or Output doesn't saturate or reach their programmed limits.  The rate the output ramps (or sums) is dependent on the size of the error and the I Gain value.  The Error x I Gain is summed every servo sample (90us).  This is why I Gain values are often small numbers (0.0001 - 0.01 typical range).  There is no guarantee that the position doesn't over shoot the target Destination.  In fact it is likely as as any error (area) under the trajectory will always be balanced by an equal area over the trajectory.  Too high of I Gain will make the system unstable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another case where I Gain is useful is when moving at high speed with a Velocity Amplifier.  To move at high speed a significant amount of output is required.  Without I Gain a significant amount of error could be required to provide this Output (ie Error x P Gain = Output).    With I Gain the Integrator will eventually ramp up to provide any Output necessary to move at the desired speed driving the error to zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Integrators have an issue often referred to as &amp;quot;Integrator Wind Up&amp;quot;.  This issue usually doesn't arise under normal conditions.  However if something is preventing the servo from making a correction such as forcing the position away from the target for a sustained amount of time, or disabling the amplifier, the Integrator will integrate to a huge unlimited value.  When the force is removed or amplifier re-enabled, the Integrator will likely cause a violent motion and overshoot.  Max Limit Integrator can help to minimize this issue by limiting the amount the Integrator can ramp up to.  So the Max Limit Integrator Value should be set at the minimum value that can still allow the Integrator to function in normal circumstances.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Typically there are two cases that should be considered when determining the Max Limit Integrator. &lt;br /&gt;
&lt;br /&gt;
# The amount of output expected to be required to overcome any stiction, friction, or other forces (cutting, gravity, etc...).  This is often not a large value and can be estimated or can be observed from the Step Response Screen (green plot right side scale is the output) when making a move.&lt;br /&gt;
# The amount of output required to provide the output needed to move at speed.  It is important to note that D Gain provides a damping or drag effect on the Output.  So the Integrator must be able to ramp up to a sufficient level to overcome the damping or drag effect and still provide enough output to move at the commanded speed.  For example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assume:&lt;br /&gt;
&lt;br /&gt;
# Commanded speed of 500,000 counts/sec&lt;br /&gt;
# D Gain of 35&lt;br /&gt;
# Output required to move at speed is 1800 DAC Counts&lt;br /&gt;
# Servo Sample Time of 90us&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Damping effect = Speed x D Gain x Sample Time = 500000 x 35 x 90e-6 = 1575 counts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Required Integrator Value = 1800 + 1575 = 3375&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So to provide some margin an Max Limit Integrator Value of 3500 might be used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Max Limits - Error===&lt;br /&gt;
Max limits error can be helpful to have your system respond less violently in the abnormal event where an excessively large error occurs.  Normally with a properly tuned system following errors should be small.   Setting a Max limits error can cause the servo to treat errors beyond a specified limit as if they were only the size of the limit and therefore respond less so than they would otherwise.  The max limits error is normally set to a value so it is not limiting under normal circumstances.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Plot below shows a situation where a small max limits error combined with a low P gain severely limits the Output.  In the plot below a large move (10000 counts) at a high speed (40000 counts/sec) is commanded.  Only P Gain (0.2) is used to provide the Output (green).  The max error limit of 200 combined with the low gain (0.2) limits the output to only 40 DAC counts.  Even as the true error increases to many thousands of counts, the servo is told to ignore the amount over 200.  So the output can never exceed 40 DAC counts.  The 40 DAC count limit means that the Axis is therefor not capable of providing the output necessary to keep up with the commanded motion.  The axis does the best it can with the limited output, and only does a fraction of the desired motion.&lt;br /&gt;
&lt;br /&gt;
[[File:Move10000.png|none|link=|665x431px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After increasing the max limits error the Output (green - right scale) now goes to a much higher value (900), and the Position (red) follows the Command (blue) to a much better degree.&lt;br /&gt;
&lt;br /&gt;
[[File:Move10000_nolimit.png|none|link=|667x430px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Increasing the P Gain to 1.6 also applies more Output sooner and the Position follows the command still better.&lt;br /&gt;
&lt;br /&gt;
[[File:Move1000_p1.6.png|none|link=|667x432px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Lead Compensator vs Derivative Gain===&lt;br /&gt;
Derivative (D) Gain is often used to help stabilize a system.&amp;amp;nbsp; It helps to think in the Frequency Domain to help understand how the two forms of compensation help.&amp;amp;nbsp; Please read below and [http://dynomotion.com/Help/BodeScreen/BodeScreen.htm this] for more information on the Frequency Domain.&amp;amp;nbsp; Both Compensation methods add positive phase to help stabilize the system.&amp;amp;nbsp; Unfortunately both methods increase gain at higher frequencies possibly causing the system to go unstable at higher frequency.&amp;amp;nbsp; A Lead Compensator provides the benefit of positive phase but without as much gain increase at higher frequencies.&amp;amp;nbsp; This figure shows a simplified Gain Plot comparison:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:DGainvsLead.png|none|link=|593x593px]]&lt;br /&gt;
&lt;br /&gt;
Here is a Bode Plot of a P=0.5 D=20 Compensator.   Note the KMotion.exe Bode Plot Screen has the capability of plotting the Frequency Domain Response of the PID+Filters Compensation.  Assume we desire positive phase to be added at 40Hz.  Notice the positive phase of 40 degrees at 40Hz which is good.  However the Gain increase in the 1KHz region of about 21db which is bad.&lt;br /&gt;
&lt;br /&gt;
[[File:P.5D20Annotate.png|none|link=|621x460px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a Bode Plot of a P=0.5 N1=N2=25Hz D1=D2=70Hz Compensator.   Assume we desire positive phase to be added at 40Hz.  We choose N1 N2 and D1 D2 to surround the frequency where the positive phase is desired.  Moving them further apart will increase the amount of positive phase but also increase the added Gain.  Notice the positive phase of 60 degrees at 40Hz which is good.  However the Gain increase in the 1KHz region of about 12db which is bad.  However both are improvements over the D Gain compensator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:PoleZeroFilter.png|none|link=|210x319px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:P.5D0N25D70Annotate.png|none|link=|644x478px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Tuning Master/Slave Configurations===&lt;br /&gt;
Master/Slave [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Master/Slave_Settings Configurations] allow two (or more) motors to drive the same axis.  Slaves are configured to follow a Master Axis.  For example two lead screws on both sides of a gantry.&lt;br /&gt;
&lt;br /&gt;
Tuning slaved axes is kind of a catch 22.  In order to tune one axis the other axis must be tuned well enough to follow and vice versa.  If possible, disconnect any mechanical linkage between the Master and Slave and test them separately without Slaving the Axes together to verify each axis Servos (can hold a position), moves at least somewhat properly, and moves in the same direction (assuming a positive [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Master/Slave_Settings Slave Gain] will be used).&lt;br /&gt;
&lt;br /&gt;
It is usually possible to incrementally tune each axis, at first moving slowly, then later at higher speeds, accelerations, and gains.  Only the Master Axis can be tested with the [http://dynomotion.com/Help/StepScreen/StepScreen.htm Step Response Screen].  This is because the Slave will follow any movement of the Master, but the Master will not follow movement of the Slave.  So if the Master Axis is moved all is well as both axes will move together, but if you try to move the Slave axis the two axes will fight.  The Master fighting to stay where it is, and the Slave fighting to move.&lt;br /&gt;
&lt;br /&gt;
To test/tune the Slave axis temporarily reverse the Master/Slave roles to make it the Master and then test it as the Master.&lt;br /&gt;
&lt;br /&gt;
Note: only the Master Axis should be included into the Coordinated Motion System.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Bode Plots===&lt;br /&gt;
A Bode Plot is a powerful tool for characterizing and providing insight into a dynamic system. It can help determine closed loop stability, bandwidth/performance, resonant frequencies, and more. It is entirely based on the system being linear. Linear in the sense that if the amplitude of some input signal is changed then the output signal will change proportionally as well. Unfortunately most systems are not entirely linear. Stiction, backlash, encoder quantization, amplifier saturation, and other effects are non-linear. For example driving a system with a signal too small to overcome stiction will result in no output at all whereas a larger signal will result in some output. This is clearly non-linear behavior. It would be nice to use a technique that handles non-linear systems but basically none are known.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;A Bode Plot is made injecting a stimulus to the system and observing how the system responds. For the reasons of non-linearity it is very important to perform a Bode Plot measurement using a representative level of stimulus similar to what the system will actually have during normal operation. If the Stimulus is not adjusted properly the result is likely to be completely invalid. Additionally the system should be reasonably tuned and stable so that it is responding in a reasonable way to the stimulus. If the system is unstable or very poorly tuned the result is likely to be completely invalid.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;You might think of it somewhat like shaking a box to determine what is in it. You should shake it with enough intensity and at frequencies to get some reaction, but not so high of intensity to break or distort the object inside.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;To create a Bode Plot use the KMotion.exe Bode Plot Screen. First select Plot: Time domain - Command, Position, Output vs Time and adjust the Amplitude and cutoff Freq until there is small but significant Position (red) changes (ie 50 encoder counts), at a frequency low enough that the Position at least somewhat attempts to follow the Command (blue), and where the Output (green) is not near saturation for the Drive being used.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;After the Stimulus/Noise Injection settings are set switch to Plot: Open Loop - Magnitude and Phase vs Frequency. Set the number of Samples to average (ie 20) and perform a Measurement.&amp;amp;nbsp; [http://dynomotion.com/Help/BodeScreen/BodeScreen.htm See here for more information].&lt;br /&gt;
&lt;br /&gt;
===Links to other Information on Tuning and Bode Plots===&lt;br /&gt;
[http://ctms.engin.umich.edu/CTMS/index.php?example=Introduction&amp;amp;section=ControlFrequency umich.edu Introduction section Control Frequency]&lt;br /&gt;
&lt;br /&gt;
[http://www.motiontech.com.au/assets/pdf/Kollmorgen%20Use%20Control%20Theory%20to%20Improve%20Servo%20Performance%20230712.pdf  Kollmorgen Use Control Theory to Improve Servo Performance 230712.pdf]&lt;br /&gt;
&lt;br /&gt;
==Problems and Resolutions==&lt;br /&gt;
====General====&lt;br /&gt;
:* [[Noise - Typical Problems and Resolutions|Dealing with noise on inputs]].  If you experience issues with inputs misreading, the issue may be noise.  This page provides examples on what might be causing noise issues and examples of how to possibly deal with noise.&lt;br /&gt;
:* Other&lt;br /&gt;
===Software-Specific Problems and Resolutions===&lt;br /&gt;
:* Place links to pages explaining resolutions to problems that are largely software-related here&lt;br /&gt;
[[KFLOP User C Programs Compiling/Launching Slowly because of Windows Defender]]&lt;br /&gt;
&lt;br /&gt;
===Hardware-Specific Problems and Resolutions===&lt;br /&gt;
:* Place links to pages explaining resolutions to problems that are largely hardware-related&lt;br /&gt;
====[[Step/Dir Drives lose 2 Steps for each pair of Direction Reversals]]====&lt;br /&gt;
&lt;br /&gt;
==Applications and Projects==&lt;br /&gt;
:* Place links to pages that explain how you accomplished your particular project.  Write clear explanations that provide background on what you did and how you did it.&lt;br /&gt;
====[[Tool Changer - router linear 4 Tools - C Program]]====&lt;br /&gt;
[[File:LINEAT+ATC.jpg|none|link=|246x178px]]&lt;br /&gt;
More linear milling tools: https://www.ichome.com/&lt;br /&gt;
&lt;br /&gt;
====[[Part Zero &amp;amp; Tool Height Touch Plate|Part Zero &amp;amp; Tool Height Touch Plate]]====&lt;br /&gt;
====[[Driving Hobby Servos]]====&lt;br /&gt;
[[File:HobbyServo.png|left|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
HiTec Type&lt;br /&gt;
&lt;br /&gt;
==Electrical Discharge Machining==&lt;br /&gt;
[https://en.wikipedia.org/wiki/Electrical_discharge_machining EDM (wikipedia)] is a method of cutting materials with high precision and detail.  Dynomotion Motion Controllers work well for EDM because of the ability for feedrate to be dynamically controlled including reversal along cutting path.&lt;br /&gt;
&lt;br /&gt;
[[Information on BAXEDM Arc Generators used with KFLOP]]&lt;br /&gt;
&lt;br /&gt;
Applied Science video that shows how to build an BAXEDM drilling machine using KFLOP and describes how it works:&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|https://youtu.be/rpHYBz7ToII|||||start=980}}&lt;br /&gt;
&lt;br /&gt;
==How to convert a milling machine to a 3D printer in 3 easy steps==&lt;br /&gt;
[[File:CNCto3DPrinter.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
More information [[How to convert a milling machine to a 3D printer in 3 easy steps|here]].&lt;br /&gt;
&lt;br /&gt;
==International and other Languages==&lt;br /&gt;
[[Russian]]&lt;br /&gt;
&lt;br /&gt;
[[Spanish]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/Known_KMotionCNC_CAD/CAM_Post_Processors</id>
		<title>Known KMotionCNC CAD/CAM Post Processors</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/Known_KMotionCNC_CAD/CAM_Post_Processors"/>
				<updated>2024-03-25T16:46:41Z</updated>
		
		<summary type="html">&lt;p&gt;TK: /* Dolphin CAD/CAM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;Mechsoft&amp;lt;/span&amp;gt;==&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;http://mecsoft.com/freemill/&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;Hi Tom,&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;  &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt; After much digging, I did find a post processor file in the Freemill site and it seems to work!  &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot; style=&amp;quot;text-indent: .5in;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;  &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot; style=&amp;quot;text-indent: .5in;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;Just an FYI:&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot; style=&amp;quot;text-indent: .5in;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;color: #000000;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif';&amp;quot;&amp;gt;The &amp;lt;/span&amp;gt;(freemill) instructions installing it were not accurate so if you run into this in the future the processor is downloaded at :&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot; style=&amp;quot;text-indent: .5in;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;[http://mecsoft.com/PostProcessors/MILL/kmotion.spm http://mecsoft.com/PostProcessors/MILL/kmotion.spm]&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot; style=&amp;quot;text-indent: .5in;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;  &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot; style=&amp;quot;text-indent: .5in;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;And then the file is installed into&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot; style=&amp;quot;text-indent: .5in;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;C:\ProgramData\MecSoft Corporation\VisualCAM 2014\Posts\MILL&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;  &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;Thanks for your rapid reply!&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;  &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;Troy&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
==&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;AutoDesk Fusion 360&amp;lt;/span&amp;gt;==&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
See this post&lt;br /&gt;
&lt;br /&gt;
https://forums.autodesk.com/t5/fusion-360-computer-aided/tool-parameters/td-p/5711808&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also this post&lt;br /&gt;
&lt;br /&gt;
http://www.cnczone.com/forums/dynomotion-kflop-kanalog/343726-posprocessor-fusion360-kflop.html#post2086576&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Alexander (Александр Украинец)''' contributed two Posts.  One for Mill and one for Lathe (the .txt extension should be removed)&lt;br /&gt;
&lt;br /&gt;
[[Media:Fusion_360_KFLOP_Mill.cps.txt|Fusion_360_KFLOP_Mill.cps.txt]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Fusion360_KFLOP_Turning.cps.txt|Fusion360_KFLOP_Turning.cps.txt]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Fusion360_KFLOP_Turning_Rev2.cps.txt|Fusion360_KFLOP_Turning_Rev2.cps.txt]] (Added thread cutting G32)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''mirocha''' posted this file on [https://www.cnczone.com/forums/dynomotion-kflop-kanalog/394550-fusion-360-post-processor-post2345608.html#post2345608 cnczone]&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/wiki/index.php?action=ajax&amp;amp;title=-&amp;amp;rs=SecureFileStore::getFile&amp;amp;f=/7/73/KmotionCNC_fusion_post_processor.pdf KMotionCNC Fusion Post Processor]&lt;br /&gt;
&lt;br /&gt;
Post Processor for Fusion 360, I built a DIY 3 axia router, built to mill aluminum, 40 mm anti backlash ball screws, 3 hp spindle, stout machine. My programing computer hard drive crashed, new hard drive and reloaded Fusion 360 took hours to find the post processor file I was using and has worked for a few years with no problems. Below is the post processor for fusion 360 that I use. In my case I zero the XYZ to the piece, I do not have a tool changer, when I create the g code in Fusion 360 I create the g code for each tool separately, run the program, manually change the tool and run the next program for the next tool. This has worked great for me.&lt;br /&gt;
&lt;br /&gt;
If your a DIY and need a post processor for fusion 360 this one works for Kflop/Kmotion, What I did was made a copy of one of the fusion 360 stock .cps files that are in fusion 360, open the KmotionCNC.pdf in notepad copy what is in the pdf over the stock .cps file and renamed it KmotionCNC&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;BobCAD&amp;lt;/span&amp;gt;==&lt;br /&gt;
See Forum Thread [https://www.dynomotion.com/forum/viewtopic.php?f=10&amp;amp;t=1230 here].&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;Dolphin CAD/CAM&amp;lt;/span&amp;gt;==&lt;br /&gt;
See Forum Thread [https://www.dynomotion.com/forum/viewtopic.php?f=10&amp;amp;t=1743#p7413 here].&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/Known_KMotionCNC_CAD/CAM_Post_Processors</id>
		<title>Known KMotionCNC CAD/CAM Post Processors</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/Known_KMotionCNC_CAD/CAM_Post_Processors"/>
				<updated>2024-03-25T16:42:07Z</updated>
		
		<summary type="html">&lt;p&gt;TK: /* Dolphin CAD/CAM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;Mechsoft&amp;lt;/span&amp;gt;==&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;http://mecsoft.com/freemill/&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;Hi Tom,&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;  &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt; After much digging, I did find a post processor file in the Freemill site and it seems to work!  &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot; style=&amp;quot;text-indent: .5in;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;  &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot; style=&amp;quot;text-indent: .5in;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;Just an FYI:&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot; style=&amp;quot;text-indent: .5in;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;color: #000000;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif';&amp;quot;&amp;gt;The &amp;lt;/span&amp;gt;(freemill) instructions installing it were not accurate so if you run into this in the future the processor is downloaded at :&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot; style=&amp;quot;text-indent: .5in;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;[http://mecsoft.com/PostProcessors/MILL/kmotion.spm http://mecsoft.com/PostProcessors/MILL/kmotion.spm]&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot; style=&amp;quot;text-indent: .5in;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;  &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot; style=&amp;quot;text-indent: .5in;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;And then the file is installed into&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot; style=&amp;quot;text-indent: .5in;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;C:\ProgramData\MecSoft Corporation\VisualCAM 2014\Posts\MILL&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;  &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;Thanks for your rapid reply!&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;  &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;Troy&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
==&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;AutoDesk Fusion 360&amp;lt;/span&amp;gt;==&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv354472887MsoNormal&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
See this post&lt;br /&gt;
&lt;br /&gt;
https://forums.autodesk.com/t5/fusion-360-computer-aided/tool-parameters/td-p/5711808&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also this post&lt;br /&gt;
&lt;br /&gt;
http://www.cnczone.com/forums/dynomotion-kflop-kanalog/343726-posprocessor-fusion360-kflop.html#post2086576&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Alexander (Александр Украинец)''' contributed two Posts.  One for Mill and one for Lathe (the .txt extension should be removed)&lt;br /&gt;
&lt;br /&gt;
[[Media:Fusion_360_KFLOP_Mill.cps.txt|Fusion_360_KFLOP_Mill.cps.txt]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Fusion360_KFLOP_Turning.cps.txt|Fusion360_KFLOP_Turning.cps.txt]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Fusion360_KFLOP_Turning_Rev2.cps.txt|Fusion360_KFLOP_Turning_Rev2.cps.txt]] (Added thread cutting G32)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''mirocha''' posted this file on [https://www.cnczone.com/forums/dynomotion-kflop-kanalog/394550-fusion-360-post-processor-post2345608.html#post2345608 cnczone]&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/wiki/index.php?action=ajax&amp;amp;title=-&amp;amp;rs=SecureFileStore::getFile&amp;amp;f=/7/73/KmotionCNC_fusion_post_processor.pdf KMotionCNC Fusion Post Processor]&lt;br /&gt;
&lt;br /&gt;
Post Processor for Fusion 360, I built a DIY 3 axia router, built to mill aluminum, 40 mm anti backlash ball screws, 3 hp spindle, stout machine. My programing computer hard drive crashed, new hard drive and reloaded Fusion 360 took hours to find the post processor file I was using and has worked for a few years with no problems. Below is the post processor for fusion 360 that I use. In my case I zero the XYZ to the piece, I do not have a tool changer, when I create the g code in Fusion 360 I create the g code for each tool separately, run the program, manually change the tool and run the next program for the next tool. This has worked great for me.&lt;br /&gt;
&lt;br /&gt;
If your a DIY and need a post processor for fusion 360 this one works for Kflop/Kmotion, What I did was made a copy of one of the fusion 360 stock .cps files that are in fusion 360, open the KmotionCNC.pdf in notepad copy what is in the pdf over the stock .cps file and renamed it KmotionCNC&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;BobCAD&amp;lt;/span&amp;gt;==&lt;br /&gt;
See Forum Thread [https://www.dynomotion.com/forum/viewtopic.php?f=10&amp;amp;t=1230 here].&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #000000;&amp;quot;&amp;gt;Dolphin CAD/CAM&amp;lt;/span&amp;gt;==&lt;br /&gt;
See Forum Thread [https://www.dynomotion.com/forum/viewtopic.php?f=10&amp;amp;t=1743#p7371 here].&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor</id>
		<title>KMotionCNC Screen Editor</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/KMotionCNC_Screen_Editor"/>
				<updated>2024-03-21T16:27:11Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Using Resizeable/Floating GViewer Control with Custom Screen&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' '''&lt;br /&gt;
&lt;br /&gt;
=====Introduction=====&lt;br /&gt;
&lt;br /&gt;
 Video: [https://www.youtube.com/watch?v=uQWDttzKuDA https://www.youtube.com/watch?v=uQWDttzKuDA]&lt;br /&gt;
'''Features include:'''&lt;br /&gt;
&lt;br /&gt;
* Show/Hide Controls&lt;br /&gt;
* Change Size and Position of Controls&lt;br /&gt;
* Change Label/Button Text&lt;br /&gt;
* International Character Support&lt;br /&gt;
* Change Font/Text Size&lt;br /&gt;
* Bitmap Buttons and Labels&lt;br /&gt;
* JPG, BMP, PNG Bitmaps&lt;br /&gt;
* Toggle Bitmap Labels (LEDs)&lt;br /&gt;
* Customizable Keyboard Hotkeys&lt;br /&gt;
* Customizable Button Tool Tips&lt;br /&gt;
* Programmable DRO (Digital Read Output) Labels&lt;br /&gt;
* Custom User Entry Controls&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 6-axes default screen is changed to a 5-axes screen by deleting the z-axis. We start by installing KMotion 4.34b or later. Note that if you don’t already have Dot Net version 4.62 or Visual Studio 2015 libraries installed, you will be prompted to load those. Create desktop icons for KMotion, KMotionCNC and KMotionCNC Screen Editor. Run KMotion and observe the default 3-axes resizable screen.&lt;br /&gt;
&lt;br /&gt;
[[File:3axes-resizable-screen.png|none|link=|504x286px]]&lt;br /&gt;
&lt;br /&gt;
Close the G Viewer window and change the dialog face to Default Custom Screen with no screen script specified. (Tool Setup):&lt;br /&gt;
&lt;br /&gt;
[[File:Default-custom-screen.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Now run the KMotionCNC Screen Editor. It automatically syncs to KMotionCNC’s controls and they are graphically displayed.&lt;br /&gt;
&lt;br /&gt;
This graphical representation allows you to select which controls you want to modify.&lt;br /&gt;
&lt;br /&gt;
Notice we can select a control and immediately hide or show it over at KMotionCNC. The controls can be moved or resized. There is also unlimited undo/redo. Multiple controls can be selected by dragging the mouse over the graphical display. Click SHIFT to add more controls, or CTRL to remove from the selection.&lt;br /&gt;
&lt;br /&gt;
'''Examples: '''&lt;br /&gt;
&lt;br /&gt;
* Select multiple controls for hiding and moving.&lt;br /&gt;
* Change main dialog screen dimensions.&lt;br /&gt;
* Change label text. Push SET key and KMotion CNC screen updates the text.&lt;br /&gt;
* Increase the size of the controls.&lt;br /&gt;
&lt;br /&gt;
The screen editor features international text support. Note that only certain fonts are capable of displaying international text. In our example, we selected Arial.&lt;br /&gt;
&lt;br /&gt;
Labels can show or toggle bitmaps based on an IO bit. As an example, we first we select bitmap 1, then bitmap 2. Increase the size of the label, so the bitmap shows properly. Then assign an IO bit number that will control the bitmap displayed. Notice the bitmap turns green, because the bit is currently on. Open KMotion and look at the state of IO bit #46 and see that it is on. Toggling the bit affects the bitmap on the screen:&lt;br /&gt;
&lt;br /&gt;
[[File:Toggle-IO-bit.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Users can configure push buttons for text, font, size, color, and tool tip. Select two sample labels and change them to type: button. Select both buttons and modify their fonts as well as their size. Four colors are available for text and background, each in normal and depressed button state. You can then change the name of each button individually, one to say “On” and the other“Off”. You can assign tool tips to each of the buttons, so when the operator hovers over the buttons, they will be prompted with a tool tip notification.&lt;br /&gt;
&lt;br /&gt;
Buttons can be assigned to perform actions. Select a script that can either be a screen script or an action. We select an action type to set bit 46 to 1. Notice that this is the script that indicated that. For the other button, we select an action which sets bit 46 to 0. Now pushing the buttons will perform these actions. Save your new screen as a screen script file. Screen script is under the KMotionCNC directory and the sub-directory“Screens”. Configure KMotionCNC to use this new screen at every new startup.Notice that tool setup screen can be accessed by right-mouse clicking on the KMotionCNC title (in “Tools/Setup files”). Select the screen you just created.&lt;br /&gt;
&lt;br /&gt;
Some more advanced features include input fields, C program actions, label DROs. Load the addition example in the screen editor. Example contains two user input controls and one DRO label control. The input edit controls are associated with KFLOP persist variables 160 and 161. The DRO label is associated with KFLOP persist variable 162. The Add button is configured for screen script action to run a C program in KFLOP. The C program is contained in the file “Add.c”. Test it by entering two values and pushing the Add button. Now open KMotion and look at the simple C code that is behind the function. (Open the file “Add.c”).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Momentary and Toggle button types in KMotion CNC Screen Editor=====&lt;br /&gt;
[https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
&lt;br /&gt;
Start KMotion CNC Screen Editor, and click on the “Main” tab, then on “Read Script” and choose the file named MomentaryToggle.scr&lt;br /&gt;
&lt;br /&gt;
You will see two buttons, a Momentary button assigned to bit46 and a Toggle button assigned to bit 47. You will also see two labels to display the status of bits 46 and 47 as LED bitmaps. We also have KMotion displaying the status of bits 46 and 47.&lt;br /&gt;
&lt;br /&gt;
[[File:Momentary-button-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Clicking the Momentary button activates the bit; releasing it,deactivates it. Clicking the Toggle button once sets the bit; clicking it again releases it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Instantaneous Feed Rate Display=====&lt;br /&gt;
[https://youtu.be/w-bKvqXCd0Q https://youtu.be/w-bKvqXCd0Q]&lt;br /&gt;
&lt;br /&gt;
Normally the feed rate indication in KMotionCNC shows ''average'' feed rate over 100ms, assuming straight line motion. Here we use a C program to calculate a more instantaneous rate and display it on the KMotionCNC screen using the KMotionCNC screen editor. Here the C program samples two positions and times, computes the delta position and the delta time, formats it to a string and displays it onto DRO label 162 in KMotionCNC and it performs this action roughly every one ½ seconds. Here is the screen script for the screen shown on the left, we’ve added a type DRO label in the screen editor, edited colors and it is connected to persist variable 162. This job consist of a rapid helix bore at a rate of about 6 revolutions per second. It shows the instant feed rate being more correct.&lt;br /&gt;
&lt;br /&gt;
There is a newer example which also displays the feed rate as a vertical bar graph.  See:&lt;br /&gt;
&lt;br /&gt;
ShowInstantFeedRate3AxisBar.scr and related C Program ShowInstantVelocityDROBar.c&lt;br /&gt;
&lt;br /&gt;
=====Split/Full/Hidden GViewer Display on Main Dialog Face=====&lt;br /&gt;
[https://youtu.be/VkBhYpyGpNU https://youtu.be/VkBhYpyGpNU]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Using Resizeable/Floating GViewer Control with Custom Screen=====&lt;br /&gt;
Normally with a Custom Screen the GViewer Plotting is sent to the GViewer Control on the Main Dialog Face and the floating/re-sizable GViewer window is not used.  It is normally closed and the GViwer Button to open it is hidden.  However if it is desired to use the floating/re-sizable GViewer window rather than the Control on the Main Screen (which is hidden), this can be accomplished by setting the Var parameter for the Main Screen GViewer Control (IDC_viewctrl) to 0.  Non-zero values will direct the Plotting to the GViewer Control on the Main Dialog Face.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Main Screen Style=====&lt;br /&gt;
KMotionCNC Screen Editor supports changing main screen style. See the Main Dialog Screen Option under the Main Tab.  Boolean Screen Script Options: &amp;quot;Caption:&amp;quot; &amp;quot;MaxBox:&amp;quot; &amp;quot;MinBox:&amp;quot; &amp;quot;ResizeFrame:&amp;quot; &amp;quot;Maximize:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Maximized Captionless KMotionCNC Screens=====&lt;br /&gt;
[https://youtu.be/R44F0_upIoA https://youtu.be/R44F0_upIoA]&lt;br /&gt;
&lt;br /&gt;
New option in KMotionCNC Screen Editor V4.34e allows screens to be maximized to full screen and with or without Window Frame/Title. New options in Screen Editor: turn minimum box on or off, maximum box on or off, resizing frame on or off. Caption on top can be present or absent.&lt;br /&gt;
&lt;br /&gt;
Available viewing options (three buttons on the top-right hand side of the screen: “Split”: Split screen mode, “View”: G Code Viewer or “Code”: G Code.&lt;br /&gt;
&lt;br /&gt;
=====Control styles=====&lt;br /&gt;
'''&amp;lt;br /&amp;gt; '''Available style options:&amp;lt;br /&amp;gt; [[File:Style-options.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Label''' &amp;lt;br /&amp;gt; Can be text or bitmap. The background is determined by the main dialog background.&lt;br /&gt;
* '''Button''' &amp;lt;br /&amp;gt; Buttons can have all 4 options (foreground and background colors in on- and off-state) or they can also be bitmaps. Labels can load actions/scripts when the main screen is loaded.&lt;br /&gt;
* '''MotionButton''' &amp;lt;br /&amp;gt; Motion buttons are strictly for jog button use only.&lt;br /&gt;
* '''ToggleButton''' &amp;lt;br /&amp;gt; See description above and [https://www.youtube.com/watch?v=eE2mSUXxN2M video].&lt;br /&gt;
* '''DROLabel &amp;lt;br /&amp;gt; '''('''D'''igital '''R'''ead '''O'''ut) runs a program in KFLOP, e.g. reads two edit cells in the “Add” example and passes back the result. X, Y, and Z are other examples of DRO labels.&lt;br /&gt;
* '''VertBar''' &amp;lt;br /&amp;gt; Plots a vertical graph from 0 to 100% and is read by KFLOP like DRO labels. See also the [https://youtu.be/w-bKvqXCd0Q Instant Feed Rate Display video].&lt;br /&gt;
* '''Radio''' button&lt;br /&gt;
* '''Momentary''' '''button''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]&lt;br /&gt;
* '''DualButton''' &amp;lt;br /&amp;gt; See description above and video:&amp;lt;br /&amp;gt; [https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]&lt;br /&gt;
* '''Checkbox&amp;lt;br /&amp;gt; '''&lt;br /&gt;
* '''DualLabel&amp;lt;br /&amp;gt; '''F for feed rate and S for spindle are example of dual labels. They display the state (one or another). They are fixed and cannot be edited.&lt;br /&gt;
&lt;br /&gt;
=====Control attributes=====&lt;br /&gt;
'''[[File:Control-attributes.png|none|link=]]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Select ID'''&amp;lt;br /&amp;gt; Defines the name of the control on the screen.&lt;br /&gt;
* '''Type'''&amp;lt;br /&amp;gt; Defines the type of control, e.g.: CONTROL, PUSHBUTTON, COMBOBOX.&lt;br /&gt;
* '''Font'''&amp;lt;br /&amp;gt; Set the font type, size and normal, bold, or italic.&lt;br /&gt;
* '''BitmapFile1, BitMapFile2&amp;lt;br /&amp;gt; '''Select a bitmap image (.bmp, .gif or .png) for your buttons. BitMapFile1 will show the selected file when the button is in normal state, BitMapFile2 when the button pressed.&lt;br /&gt;
* '''Colors''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (text).&lt;br /&gt;
* '''Highlight''' &amp;lt;br /&amp;gt; Select two colors for on- and off-state (background).&lt;br /&gt;
* '''Tool Tip''' &amp;lt;br /&amp;gt; Compose text to describe the button action. This text will be visible when the user hovers over the button.&lt;br /&gt;
* '''HotKey''' &amp;lt;br /&amp;gt; Assigns a keyboard key to perform an action. This field is by default set to “-1”. For example, select a control like “mm” and type “CTRL M” or select “in” and type “CTRL I” and click “Set”. The “x” button next to the field will restore the value back to “-1”.&lt;br /&gt;
* '''Var&amp;lt;br /&amp;gt; '''Numeric variable attribute. Assigning a number toggles the corresponding bit in KFLOP (from 0 to 2047).&lt;br /&gt;
* '''X, Y&amp;lt;br /&amp;gt; '''Changes the horizontal and vertical position of the control.&lt;br /&gt;
* '''Width, Height'''&amp;lt;br /&amp;gt; Changes the size of the control.&lt;br /&gt;
* '''Script'''&amp;lt;br /&amp;gt; Using this field, the user has three options:&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a) Selecting a screen script file from the library:&lt;br /&gt;
&lt;br /&gt;
[[File:Script-Option-1.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
b) Selecting an Action:&amp;lt;br /&amp;gt;[[File:Script-Option-2.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
c) Selecting a Windows Message:&amp;lt;br /&amp;gt; [[File:Script-Option-3.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
* '''Show/Hide'''&amp;lt;br /&amp;gt; Select a control and immediately show or hide it.&lt;br /&gt;
&lt;br /&gt;
* '''Move/Resize'''&amp;lt;br /&amp;gt; Move the position of the control or change its size.&lt;br /&gt;
* '''Undo/Redo &amp;lt;br /&amp;gt; '''An unlimited number of undoes and redoes is available.&lt;br /&gt;
* '''Copy/Paste &amp;lt;br /&amp;gt; '''The user can edit all three screens (Split, View, and Code) by clicking “Copy” after making an edit such as moving a button, then loading the next screen, clicking outside the editable area and selecting “Paste”.&lt;br /&gt;
* '''General &amp;lt;br /&amp;gt; '''When selecting multiple controls, white fields are shown when all settings are the same, and grey fields when the values are different. In the example below note that we have selected the radio buttons labeled 1 through 7. While they all share the same font type, size, width and horizontal (x) position etc., “text” and “y-position” are grayed-out, since the radio buttons’ text labels and their vertical position are unique to each field. To override this, just click into the grayed-out field(s) and start editing.&amp;lt;br /&amp;gt;[[File:General.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Main Window attributes=====&lt;br /&gt;
* '''Main Dialog Screen&amp;lt;br /&amp;gt; '''Defines the look and feel as well as the size of your KMotionCNC screen. You can choose a background color, or select a bitmap file as your background. Choose the size of the window, or whether the window should be resizable or fixed and so on. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
* '''Script File'''&amp;lt;br /&amp;gt;Select a screen script file from the library or set an action. A screen script file defines the look of a page. You can assign an action to a button to load a screen script file.&amp;lt;br /&amp;gt;[[File:Style-file.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
=====Bitmap types, Alpha, and locations=====&lt;br /&gt;
&amp;lt;br /&amp;gt;The following bitmap types are supported: .bmp, .gif, and.png. Out of these, only the png file type supports alpha channels, i.e. background transparency.&amp;lt;br /&amp;gt;Images are stored in the following “Resources” location:&amp;lt;br /&amp;gt;\KMotion434i\PC VC Examples\KMotionCNC\res&lt;br /&gt;
&lt;br /&gt;
=====Motion Buttons (for Jogging)=====&lt;br /&gt;
Special Buttons for Jogging exist with Style MotionButton. Although these buttons can be customized with regard to Bitmap images, size, positions, Font, ToolTips, Show/Hide, and Hotkeys they have fixed functionality for the 6 GCode Axes XYZABC.  They support momentary Hotkey and combined mouse operation with the ability to have multiple Hotkeys pushed simultaneously and dynamically change speed using the SHIFT key.  Additional MotionButtons can not be currently added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:MotionButtons.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Jog Buttons are grouped into 6 buttons per axis.  3 of the 6 buttons are used for moving one direction and 3 for the other direction.  The 3 buttons correspond to Stepping a fixed distance, Jogging slow, and Jogging Fast.   The Resource IDs corresponding to each axis are:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''X + = IDC_RightStep, IDC_Right, IDC_Right2'''&lt;br /&gt;
&lt;br /&gt;
'''X - = IDC_LeftStep, IDC_Left, IDC_Left2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Y + = IDC_UpStep, IDC_Up, IDC_Up2'''&lt;br /&gt;
&lt;br /&gt;
'''Y - = IDC_DownStep, IDC_Down, IDC_Down2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''Z + = IDC_ZplusStep, IDC_Zplus, IDC_Zplus2'''&lt;br /&gt;
&lt;br /&gt;
'''Z - = IDC_ZminusStep, IDC_Zminus, IDC_Zminus2'''&lt;br /&gt;
&lt;br /&gt;
''' '''&lt;br /&gt;
&lt;br /&gt;
'''A + = IDC_AplusStep, IDC_Aplus, IDC_Aplus2'''&lt;br /&gt;
&lt;br /&gt;
'''A - = IDC_AminusStep, IDC_Aminus, IDC_Aminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''B + = IDC_BplusStep, IDC_Bplus, IDC_Bplus2'''&lt;br /&gt;
&lt;br /&gt;
'''B - = IDC_BminusStep, IDC_Bminus, IDC_Bminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''C + = IDC_CplusStep, IDC_Cplus, IDC_Cplus2'''&lt;br /&gt;
&lt;br /&gt;
'''C - = IDC_CminusStep, IDC_Cminus, IDC_Cminus2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note the HotKeys for all 3 Motion Buttons for each axis/direction must be set to the same value.''' This is because the same HotKey combined with CTRL and SHIFT alter the behavior to Step and Fast respectively.  If not all 3 buttons are desired for the screen the others may be hidden but should be all defined to the same HotKey for the HotKey functionality to work correctly.  Furthermore no other buttons should be defined with the same HotKeys.  The Screen Editor has a special feature to test for Duplicate HotKey assignments called &amp;quot;check dup hotkey&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also one associated IDC_StopStep button which will stop any Step Movement currently in progress.&lt;br /&gt;
&lt;br /&gt;
=====Performing an action Immediately within Screen Script=====&lt;br /&gt;
Normally when processing a Screen Script, the &amp;quot;Script&amp;quot; Parameter defines for a Push Button Control what should happen when the Push Button is pushed. However when a &amp;quot;Script&amp;quot; Parameter is specified for a static Label the Action will occur immediately after the Screen Script is processed.&lt;br /&gt;
&lt;br /&gt;
For example: when loading a screen intended for Simulation we might want to have the Simulation mode automatically selected on. So the Script for the IDC_SimulateStatic Label might be set to check the simulate checkbox with:&lt;br /&gt;
&lt;br /&gt;
WinMsg:DlgName;IDC_Simulate;BM_SETCHECK;BST_CHECKED&lt;br /&gt;
&lt;br /&gt;
=====Scaling an Entire Screen or Portion of a Screen=====&lt;br /&gt;
A new Screen Editor feature has been added to stretch/shrink a number of selected screen controls by a specified percentage.  The height and width of the controls can be stretched as with their XY positions.  The horizontal and vertical directions can be Stretched/Shrunk independently.  Scaling the Vertical direction will also scale any Font point settings.  The Width and Height of the entire dialog will also be scaled accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To Scale a Screen:&lt;br /&gt;
&lt;br /&gt;
# Select the controls to be scaled - usually all controls (drag a box to select multiple controls)&lt;br /&gt;
# Select mode: Screen Scale&lt;br /&gt;
# Select the desired Size Change as a percentage 1-100% (ie 60% corresponds to a stretch/shrink factor of 1.6)&lt;br /&gt;
# Push Increase/Decrease Width button&lt;br /&gt;
# Push Increase/Decrease Height button&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: it is best to scale in one step vs multiple steps as control widths and font sizes are integers and may have rounding after each step.&lt;br /&gt;
&lt;br /&gt;
Note: any bitmap images will be unchanged and remain the same size.  They can be manually scaled with a graphics app if necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If not in the current Version a Version with scaling added can be downloaded here (place in \KMotion\Release Directory):&lt;br /&gt;
&lt;br /&gt;
[http://dynomotion.com/Software/Patch/ScreenEditorWithScaling_V434j/KMotionCNCScreenEditor.exe KMotionCNC Screen Editor with Scaling]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen Editor with Screen Scale of 60% and all controls selected:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale.png|none|link=|710x627px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Original Screen:&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale100.png|none|link=|639x471px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Scaled up 60%&lt;br /&gt;
&lt;br /&gt;
[[File:ScreenScale160.png|none|link=|879x641px]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/Main_Page"/>
				<updated>2024-03-02T00:44:36Z</updated>
		
		<summary type="html">&lt;p&gt;TK: Board Terminal DXF/DWG files&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Dynomotion wiki'''&amp;lt;span style=&amp;quot;color: #999999;&amp;quot;&amp;gt;'''&amp;lt;br /&amp;gt;'''&amp;lt;/span&amp;gt;==&lt;br /&gt;
Welcome to our wiki where you can find and share knowledge on Dynomotion's systems.  To begin adding information to this wiki, simply create an account, verify your email, and start editing (click pencil icon). To make editing pages easier for everyone, we have installed a [https://help.bluespice.com/index.php/VisualEditor visual editor] by default.  This visual editor allows you to edit a wiki page much like you would a standard word processing document.&amp;amp;nbsp; For the seasoned wiki editors, standard [https://www.mediawiki.org/wiki/Help:Editing MediaWiki editing] may also be used.&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Warning: Use at your own risk.&amp;amp;nbsp; Information is for example purposes only and may contain errors.&amp;amp;nbsp; It is up to the User to verify the information is correct and is safe to use. In no case will any contributor or Dynomotion be liable for incorrect information.  Dynomotion reserves the right to modify or delete any contributions.&amp;lt;br /&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Thanks for Contributing!&lt;br /&gt;
&lt;br /&gt;
[http://dynomotion.com Official Dynomotion Site]&lt;br /&gt;
&lt;br /&gt;
==Editing and Creating Wiki Pages==&lt;br /&gt;
Unintuitively, you first create a link to the page you want to make before you can make the page.  To make a new page: while editing, right-click where you want your link to be, insert a link with a descriptive title and link text, save the page, click on the link you created, then click on &amp;quot;Empty Page&amp;quot; to begin editing your new page.&lt;br /&gt;
&lt;br /&gt;
Here are a few other quick tips:&lt;br /&gt;
&lt;br /&gt;
* You can insert links or images by Right-Clicking with the mouse on the line where you want the link or image to appear.&lt;br /&gt;
* For Spell Correction you can use Ctrl-Right-Click. &lt;br /&gt;
* To insert a YouTube Video use an EmbedVideo command such as &amp;lt;nowiki&amp;gt; {{#ev:youtube|xxxxx}}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;with xxxxx changed to the Video ID.&lt;br /&gt;
* Choose a descriptive page name and link text when creating a new page: e.g. Not &amp;quot;My Machine&amp;quot;, but rather &amp;quot;Brand X Three Axis Milling Machine Retrofit&amp;quot;&lt;br /&gt;
* Create pages in an organized manner: Describe what the page is about, create clear sections that flow&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
[[Help:New Page Creation|How to create a new wiki page]]&lt;br /&gt;
&lt;br /&gt;
[[Help:Editing Pages|How to Edit and insert Media into your wiki pages]]&lt;br /&gt;
&lt;br /&gt;
==Dynomotion Software Topics==&lt;br /&gt;
===Installation Topics===&lt;br /&gt;
* Announcement of our Latest Release (5.3.2) on the [https://www.dynomotion.com/forum/viewtopic.php?f=4&amp;amp;t=1725 Dynomotion Forum]&lt;br /&gt;
* [https://dynomotion.com/Software/Download.html Latest Release] Note: For Windows 7 64bit signed Drivers to work, all Windows Updates should be performed.&lt;br /&gt;
* [[Upgrading from previous KMotion Versions]]&lt;br /&gt;
&lt;br /&gt;
Archive of Test Releases:&lt;br /&gt;
&lt;br /&gt;
* Previous Test Release: 11/20/2023: [https://dynomotion.com/Software/KMotion5.3.1.exe KMotion.exe 5.3.1], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.1%20Changes.pdf 5.3.1 release notes (pdf)]* Previous Test Release: 09/19/2023: [https://dynomotion.com/Software/KMotion5.3.0.exe KMotion.exe 5.3.0], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.3.0%20Changes.pdf 5.3.0 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 06/30/2023: [https://dynomotion.com/Software/KMotion5.1.0.exe KMotion.exe 5.1.0], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.1.0%20Changes.pdf 5.1.0 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 05/01/2023: [https://dynomotion.com/Software/KMotion5.0.7.exe KMotion.exe 5.0.7], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%205.0.7%20Changes.pdf 5.0.7 release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/21/2022: [https://dynomotion.com/Software/KMotion435h.exe KMotion.exe V4.35h], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35h%20Changes.pdf V4.35h release notes (pdf)]&lt;br /&gt;
* Previous Version 4.35g was not released, but see the change notes for this version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35g%20Changes.pdf V4.35g change notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/28/2020: [https://dynomotion.com/Software/KMotion435f.exe KMotion.exe V4.35f], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35f%20Changes.pdf V4.35f release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 11/18/2019: [https://dynomotion.com/Software/KMotion435e.exe KMotion.exe V4.35e], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35e%20Changes.pdf V4.35e release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/10/2019: [https://dynomotion.com/Software/KMotion435d.exe KMotion.exe V4.35d], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35d%20Changes.pdf V4.35d release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 01/28/2019: [https://dynomotion.com/Software/KMotion435b.exe KMotion.exe V4.35b], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35b%20Changes.pdf V4.35b release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/21/2018: [https://dynomotion.com/Software/KMotion435a.exe KMotion.exe V4.35a], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.35a%20Changes.pdf V4.35a release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 09/28/2017: [https://dynomotion.com/Software/KMotion434j.exe KMotion.exe V4.34j], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34j%20Changes.pdf V4.34j release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 05/07/2017: [https://dynomotion.com/Software/KMotion434i.exe KMotion.exe V4.34i], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34i%20Changes.pdf V4.34i release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/14/2016: [https://dynomotion.com/Software/KMotion434h.exe KMotion.exe V4.34h], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34h%20Changes.pdf V4.34h release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/13/2016: [https://dynomotion.com/Software/KMotion434g.exe KMotion.exe V4.34g], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34g%20Changes.pdf V4.34g release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 12/05/2016: [https://dynomotion.com/Software/KMotion434f.exe KMotion.exe V4.34f], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34f%20Changes.pdf V4.34f release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 11/07/2016: [https://dynomotion.com/Software/KMotion434e.exe KMotion.exe V4.34e], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34e%20Changes.pdf V4.34e release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/32/2016: [https://dynomotion.com/Software/KMotion434d.exe KMotion.exe V4.34d], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34d%20Changes.pdf V4.34d release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/23/2016: [https://dynomotion.com/Software/KMotion434c.exe KMotion.exe V4.34c], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34c%20Changes.pdf V4.34c release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 10/03/2016: [https://dynomotion.com/Software/KMotion434b.exe KMotion.exe V4.34b], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34b%20Changes.pdf V4.34b release notes (pdf)]&lt;br /&gt;
* Previous Test Release: 03/09/2016: [https://dynomotion.com/Software/KMotion434a.exe KMotion.exe V4.34a], See the release notes for this test version here: [https://dynomotion.com/Software/KMotion%20Released%20Version%204.34a%20Changes.pdf V4.34a release notes (pdf)]&lt;br /&gt;
* [https://dynomotion.com/Help/KFLOPQuickStart/KFLOPQuickStart.htm How to install KMotion.exe and KMotionCNC]&lt;br /&gt;
* [[How to install KMotion.exe and KMotion in Windows 10|Preparing Windows 10 for driver installation]] (no longer required)&lt;br /&gt;
* [[Special Case for Windows 8.1 Industry Embedded Enterprise]]&lt;br /&gt;
* [[Updating KFLOP Firmware|How to update KFLOP Firmware]] - whenever a new version of software is installed, the firmware within KFLOP must be updated to match the new version&lt;br /&gt;
&lt;br /&gt;
===KMotion.exe Executive Software Topics===&lt;br /&gt;
KMotion.exe is the main program that is used to configure settings in KFLOP, initialize axes, and to write C programs to configure and setup KFLOP to control your system. In this program you can plot step response, test movement, view Bode plots, monitor I/O, set filter parameters, and generally set the pertinent parameters.&lt;br /&gt;
&lt;br /&gt;
* [http://www.dynomotion.com/Help/index.htm General software information] from the manuals&lt;br /&gt;
* Insert pages for other KMotion.exe-related topics here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Configuration Topics===&lt;br /&gt;
====Channels, Channels, Channels what are they?====&lt;br /&gt;
[[Channels Channels Channels|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====How to Setup Backlash Compensation====&lt;br /&gt;
[[Backlash Compensation|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====PWM Output Mode====&lt;br /&gt;
[[PWM Output Mode|Read Article Here]]&lt;br /&gt;
&lt;br /&gt;
===KMotionCNC Software Topics===&lt;br /&gt;
KMotionCNC is Dynomotion's CNC program used as a graphical user interface to your KFLOP-enabled machine tool. KMotionCNC has all of the basic functionality you need to run a machine of up to 6 axes, in addition to spindle control.&lt;br /&gt;
&lt;br /&gt;
* Insert pages for other KMotionCNC-related general topics here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;Using KMotionCNC&amp;lt;/span&amp;gt;====&lt;br /&gt;
* Homing discussion - page to be created&lt;br /&gt;
* Insert other KMotionCNC use pages here&lt;br /&gt;
&lt;br /&gt;
[[Internal/concave Path Tool Radius Compensation Example G41/G42]]&lt;br /&gt;
&lt;br /&gt;
[[Known KMotionCNC CAD/CAM Post Processors]]&lt;br /&gt;
&lt;br /&gt;
[[Invoking C Programs with Execute Only for previously Downloaded Programs]]&lt;br /&gt;
&lt;br /&gt;
[[Rigid Tapping G84 Setup and Use]]&lt;br /&gt;
&lt;br /&gt;
[[Tool Length/Offsets G43Hn G49]]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;Customize KMotionCNC&amp;lt;/span&amp;gt;====&lt;br /&gt;
KMotionCNC is written as a Windows C++ MFC (Microsoft Foundation Classes) program developed in Visual Studio.  Source code is provided and may be customized using Visual Studio.  MFC Support is a requirement. &lt;br /&gt;
&lt;br /&gt;
: '''General Information'''&lt;br /&gt;
: Compiling KMotionCNC&lt;br /&gt;
:: The KMotionCNC's Visual Studio Project Solution (\PC VC Programs\KMotionCNC\KMotionCNC.sln) is currently written for Visual Studio 2015 Standard.  This version can be used for the simplest compatibility.  Projects can be upgraded to newer version of VS with minimal effort.  Including Microsoft's Free Visual Studio 2013 Community.  [[PC Example Applications|More info on PC Example Applications.]]&lt;br /&gt;
:: Note Test Versions 4.34a and later have project solutions targeted for Visual Studio 2015 Community which is free for most Users.&lt;br /&gt;
: '''KMotionCNC Customization Examples and Applications'''&lt;br /&gt;
:: Links to examples of projects that explain KMotionCNC customizations. Troy (tmday7) created some helpful documents (PDF format):&lt;br /&gt;
: &lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/How%20to%20Edit%20KMotionCNC%20Faces.pdf How to edit KMotionCNC faces]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20External%20Buttons.pdf Adding external buttons]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20More%20User%20Buttons.pdf Adding more user buttons]&lt;br /&gt;
:* [https://www.dynomotion.com/forum/archive/attachments/Adding%20Jog%20Percent%20Cell%20to%20Main%20Dialog%20Face.pdf Adding Jog Percent Cell to Main Dialog Face]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;KMotionCNC Screen Editor&amp;lt;/span&amp;gt;====&lt;br /&gt;
Introduces the capability of using Screen Script files to modify the look and function of KMotionCNC.&amp;lt;br /&amp;gt;[[KMotionCNC Screen Editor|More information.]]&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;KMotionCNC Geometric Correction&amp;lt;/span&amp;gt;====&lt;br /&gt;
Information regarding the powerful [https://dynomotion.com/Help/KMotionCNC/GeoCorrection.htm Geometric Correction capability] which allows calibration and distortion correction of the XY CAD space to Machine/Actuator Space as well as flatness in Z.  Simple 4 point correction tables can apply XY Scale, Rotation, skew, offset, tilt.  Larger tables can apply more non-linear corrections.&lt;br /&gt;
&lt;br /&gt;
Note the Geometric Correction is built into the KMotion Libraries and can be utilized by Custom Programs as well as with KMotionCNC&amp;lt;br /&amp;gt;[[Geometric Correction|More information and Examples.]]&lt;br /&gt;
&lt;br /&gt;
===PC Example Applications===&lt;br /&gt;
A number of PC Applications using the KMotion Libraries are available in the Software download.&amp;amp;nbsp; Visual Studio should be used to modify/compile the applications.&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note All the projects in KMotion Versions 4.34a and later have now been updated and should work out-of-the-box with VS2015.'''&lt;br /&gt;
&lt;br /&gt;
[[PC Example Applications|More information.]]&lt;br /&gt;
&lt;br /&gt;
===KMotion Libraries - GCode Interpreter - Trajectory Planner - Coordinated Motion - .NET===&lt;br /&gt;
The KMotion Libraries are a series of DLLs (Dynamic Link Libraries) that reside on the PC that contain the common core motion control, I/O, and communication functionality for KFLOP.  These libraries permit PC Applications to be built using high level control without being concerned with the underlying details of Interpreting GCode, Trajectory Planning, Coordinated Motion, Motion Buffering, USB Communication, etc.&lt;br /&gt;
&lt;br /&gt;
[[KMotion Libraries - GCode Interpreter - Trajectory Planner - Coordinated Motion - .NET|More information]].&lt;br /&gt;
&lt;br /&gt;
===Kinematics===&lt;br /&gt;
The KMotion Libraries contain a Kinematics Layer where Users can add their own non-linear Kinematics&lt;br /&gt;
&lt;br /&gt;
[[Kinematics|More information]].&lt;br /&gt;
&lt;br /&gt;
===KFLOP C Programs===&lt;br /&gt;
C Programs provide a powerful and flexible capability to perform almost any sequence of operations within KFLOP.   In most cases after you have tested and tuned all your hardware using the KMotion.exe setup program all the settings and initialization steps required for your system can be placed into an Initialization C Program so that your system can be fully initialized simply by executing the Initialization program.&lt;br /&gt;
&lt;br /&gt;
[[KFLOP C Programs|More Information]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ModBus===&lt;br /&gt;
Modbus can be connected to the PC or directly to KFLOP.  A PC connection will not be deterministically real-time but may work for basic speed control and on/off.  Here is a related Thread for interfacing KMotionCNC to Modbus using a [http://www.modbusdriver.com/modpoll.html free utility]:&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/sending%20ModBus%20msgs%20from%20KmotionCNC%20to%20a%20RS485%20port.html Sending ModBus msgs from KmotionCNC to a RS485 port]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To connect Modbus directly to KFLOP's [http://www.dynomotion.com/Help/RS232/RS232.htm UART] see the C Examples in \C Programs\RS232\ModBus\&lt;br /&gt;
&lt;br /&gt;
===Linux Support===&lt;br /&gt;
KMotion Motion Libraries are fully supported under Microsoft Windows. Some Users have ported the KMotion Libraries to Linux.  Dynomotion will offer support where possible but can't offer full support under Linux.  Special Thanks to [https://github.com/parhansson/KMotionX Par Hansson] for the initial Linux Port.&lt;br /&gt;
&lt;br /&gt;
See [[Linux|here]] for more info.&lt;br /&gt;
&lt;br /&gt;
==Dynomotion Hardware Topics==&lt;br /&gt;
===General Hardware Information===&lt;br /&gt;
====[[KFLOP Hardware Info|KFLOP specific Hardware Info]]====&lt;br /&gt;
====[[KStep Hardware Info|KStep specific Hardware Info]]====&lt;br /&gt;
====[[Kanalog Hardware Info|Kanalog specific Hardware Info]]====&lt;br /&gt;
====[[SnapAmp Info|SnapAmp specific Hardware Info]]====&lt;br /&gt;
====[[Konnect Hardware Info|Konnect specific Hardware Info]]====&lt;br /&gt;
&lt;br /&gt;
===Wiring Diagrams===&lt;br /&gt;
[[Media:Kanalog_Connections.pdf|Basic Kanalog DAC and Encoder Connections 3 Axis]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KanalogSchematic3Axis.pdf|Basic Kanalog DAC and Encoder Connections 3 Axis #2]]&lt;br /&gt;
&lt;br /&gt;
[[Media:dyn4 kanalog KE1524 V1.1.png|Basic Kanalog DAC and DMM DYN4 Drive 1 Axis]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Kflop-Kanalog_wiring_11-19-2018.pdf|Kanalog with Geckos G210 updated 11-19-2018]] (Thanks to &amp;lt;span style=&amp;quot;color: windowtext;&amp;quot;&amp;gt;Joseph Mirocha&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog_to_Tree_Journeyman_325_by_Rick_B.pdf|Kanalog to Tree Journeyman 325.pdf]] (Thanks to &amp;lt;span style=&amp;quot;color: windowtext;&amp;quot;&amp;gt;Rick_B&amp;lt;/span&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Media:KFlopSnapBrushMPG.pdf|KFLOP+SnapAmp DC Brush Motors with MPG]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Stepper_Wiring_Diagram_Step-Dir_on_JP5.pdf|KFLOP JP5 Open Collector Step/Dir Connections to Power Step PSD5042-2P Drives ]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Matrika_V1_wiring_diagram_Rev1.pdf|KFLOP+KStep with VFD and NPN Limit Switches for Matrika Rev1]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KonnectTouchPlate.png|Touch Plate Wiring to Konnect]]&lt;br /&gt;
&lt;br /&gt;
[https://easyeda.com/350banshee/BreakoutBoard-93bdd16e3c3d48b98ae66c34f2436c40 User Created KFLOP JP7 Breakout/OptoIsolation Board] Schematic, Gerbers, PCBs Publicly available (thanks 350banshee)&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/wiki/index.php?action=ajax&amp;amp;title=-&amp;amp;rs=SecureFileStore::getFile&amp;amp;f=/b/bb/RotarySwitchToKanalog.png Rotary Switch Connected to Kanalog Opto Inputs]&lt;br /&gt;
&lt;br /&gt;
===3D Board Models===&lt;br /&gt;
[[Media:kflop-kstep-3d-models-1.snapshot.3.zip.txt|kflop-kstep-3d-models-1.snapshot.3.zip.txt]]  STEP file format - Thanks to Curtis&lt;br /&gt;
&lt;br /&gt;
[[File:kflop_kstep_render.JPG|none|link=|329x329px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:KFLOP3D_Step_IGS_Chris.zip.txt|KFLOP3D_Step_IGS_Chris.zip.txt]] STEP and IGS models - Thanks to Chris&lt;br /&gt;
&lt;br /&gt;
[[File:KFLOP_3D.png|none|link=|413x296px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:KONNECT_BOARD_MODEL.zip.txt|KONNECT_BOARD_MODEL.zip.txt]] STEP model - Thanks to Jeff Redington&lt;br /&gt;
&lt;br /&gt;
(Component locations may be off one way or another by .5mm)&lt;br /&gt;
&lt;br /&gt;
[[File:Konnect_Board.png|none|link=|339x292px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Konnect Basic Step file showing hole locations&lt;br /&gt;
&lt;br /&gt;
[[Media:KonnectHoles.stp.txt|KonnectHoles.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KonnectHoles.png|none|link=|352x323px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kanalog Step Model with Mechanical hole and Pin locations&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog.stp.txt|Kanalog.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KanalogFromStep.png|none|link=|304x279px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kanalog Step Model with Mechanical hole and Connectors (Thanks to&lt;br /&gt;
&lt;br /&gt;
Roberto Gotti of Powertech)'''&amp;lt;br /&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
[[Media:KANALOG_BOARD.stp.txt|KANALOG_BOARD.stp.txt]]&lt;br /&gt;
&lt;br /&gt;
[[File:KanalogWithConnectors.png|none|link=|311x286px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Board Terminal DXF/DWG files===&lt;br /&gt;
[[Media:KFLOP_Terminals.dxf|KFLOP_Terminals.dxf]] [[Media:KFLOP_Terminals.dwg|KFLOP_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Kanalog_Terminals.dxf|Kanalog_Terminals.dxf]] [[Media:Kanalog_Terminals.dwg|Kanalog_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:Konnect_Terminals.dxf|Konnect_Terminals.dxf]] [[Media:Konnect_Terminals.dwg|Konnect_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
[[Media:KStep_Terminals.dxf|KStep_Terminals.dxf]] [[Media:KStep_Terminals.dwg|KStep_Terminals.dwg]]&lt;br /&gt;
&lt;br /&gt;
===Wiring Topics===&lt;br /&gt;
Place links to pages on wiring inputs and&lt;br /&gt;
&lt;br /&gt;
outputs specific to your experiences and projects.  Be descriptive with page titles and links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====KFLOP IDC Connectors and Cables====&lt;br /&gt;
Cables that connect between Dynomotion boards are normally included when purchasing the boards together. They are also very common and easy to make. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Use '''16-conductor or 26-conductor ribbon cable''' (0.05 inch pitch 26 AWG preferrably or 28AWG) and IDC sockets.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;[[File:RibbonCable.png|none|link=]]&lt;br /&gt;
16 conductor ribbon cable 3M part number 3801/16 100 &amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/3m/3801-16-100/3M156105-100-ND/1107501&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;26 conductor ribbon cable 3M part number C3801/26 100 &amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/3m/C3801-26-100/C3801-26-100-ND/1107648&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Winford also sells ribbon cable (although only the thinner 28 AWG):&amp;lt;br /&amp;gt;http://www.winford.com/products/rib.php&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Note you can usually tear off wires to reduce the number of conductors. For example from 26 down to 16. Tear off the conductors away from the red stripe that marks pin 1.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;The '''crimp tools''' are common:&amp;lt;br /&amp;gt;https://www.amazon.com/Accessories-Crimp-Ribbon-Cable-Connectors/dp/B007R2JEM4/&amp;lt;br /&amp;gt;[[File:RibbonCrimp.png|none|link=]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;'''IDC Sockets 16-pin '''(pin pitch 0.1 inch)&amp;lt;br /&amp;gt;https://www.digikey.com/product-detail/en/assmann-wsw-components/AWP-16-7240-T/HHKC16H-ND/5031953&amp;lt;br /&amp;gt;Assman Part number AWP 16-7240-T&lt;br /&gt;
[[File:16pinIDC.png|none|link=]]&lt;br /&gt;
https://www.digikey.com/product-detail/en/assmann-wsw-components/AWP-26-7240-T/HHKC26H-ND/5011313&lt;br /&gt;
[[File:26pinIDC.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
====KFLOP KStep JR1 Molex Power Connectors====&lt;br /&gt;
KFLOP and KStep JR1 are standard Disk Drive Power Connectors. Possibly one of the most common connectors. Originally used on PC ATX Power Supplies. Sometimes referred to as Molex Connectors. They have 4 pins with 0.2 inch pitch with 0.083~0.084 inch socket pins. The mating cable will have female socket pins as shown here:&lt;br /&gt;
&lt;br /&gt;
[[File:Molex_female_connector.jpg|none|link=|251x168px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Molex Series 8981 P# [https://www.digikey.com/short/zjp329 0015244048]  using Molex Series 8980 Crimp Pins P# [https://www.digikey.com/short/zjp3ff 0002081201]&lt;br /&gt;
&lt;br /&gt;
Also AMP Series MATE-N-LOK P# [https://www.digikey.com/short/zjpq3n 1-480424-0] using AMP Series MATE-N-LOK Crimp Pins P# [https://www.digikey.com/short/zjpqqw 60619-1]&lt;br /&gt;
&lt;br /&gt;
====MPG Wiring and Interface====&lt;br /&gt;
MPGs (Manual Pulse Generators) should be connected directly to KFLOP for guaranteed real-time response (not USB based or connected to the PC).  MPGs are handled by a C Program that monitors the MPG and creates motion based on the MPG Encoder changes and switch selections for axis, speed, and so forth.  See the MPG C Program Examples.  Here is a Discussion with other links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/Jogging%20Pendant.html Jogging Pendant]&lt;br /&gt;
&lt;br /&gt;
[https://www.dynomotion.com/forum/archive/Connecting%20Keling%20MPG2%20pendant.html Connecting Keling MPG2 Pendant]&lt;br /&gt;
&lt;br /&gt;
[https://www.cnczone.com/forums/dynomotion-kflop-kanalog/349740-applying-acceleration-mpg-target-possible.html#post2119732 CNCZone Thread] on obtaining smooth filtered motion.&lt;br /&gt;
&lt;br /&gt;
[[File:MPG4_from_cnc4pc.jpg|none|link=|83x169px]]&lt;br /&gt;
&lt;br /&gt;
====Interfacing NPN Devices to KFLOP IO====&lt;br /&gt;
NPN devices (open collector)operate as a switch to GND and can be interfaced to KFLOP using a pull up resistor as shown below. When the transistor switches to 0V the KFLOP IO Pin is driven low. The transistor will need to sink ~3ma. When the transistor is off (open circuit) the resistor pulls the IO Pin to 3.3V. Note even though some KFLOP IO Pins can tolerate 5V pulling them above 3.8V should be avoided when possible so the 3.3V supply is used. This technique will only work with KFLOP IO Pins that do not have pull down resistors (JP7 and JP5). In some cases a 0.1uF Ceramic capacitor connected close to KFLOP might be added in parallel with the resistor to filter noise.  Cable shielding connected to KFLOP GND on the KFLOP end only is recommended.  Note that in noisy environments this technique may couple noise into KFLOP so opto isolation should be used instead.&lt;br /&gt;
&lt;br /&gt;
[[File:NPN_Interface_to_KFLOP.png|none|link=|544x544px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Multiplexing Encoder Inputs to KFLOP JP4 and JP6====&lt;br /&gt;
If KFLOP JP7 and JP5 are used for other purposes the encoder inputs can be multiplexed to KFLOP JP4 and JP6. There is an option to multiplex encoders 0-3 from JP7 to JP4 and another option to multiplex encoders 4-7 from JP5 to JP6. See the MuxEncoders.c for an example.&lt;br /&gt;
&lt;br /&gt;
Note the JP4 and JP6 IO are 3.3V inputs and shouldn't be driven hard (more than 10ma) above 3.8V. This is not usually an issue as most encoders or RS422 drivers don't do this. The inputs also have 150 ohm termination.&lt;br /&gt;
&lt;br /&gt;
The following line of code might be added to your Initialization C Program. It needs to be executed once to multiplex the encoders after any power cycle. Encoders 0-3 will then be input on JP4 and 4-7 will be on JP6. Both JP4 and Jp6 have 10 IO bits. The 4 encoders will appear on the first 8 IO bits. 2 bits for each encoder's A B channels in order. So for example Encoder #0 will appear on JP4 IO16 (Pin5) and IO17 (Pin6)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt; &lt;br /&gt;
// Mux encoder inputs from KFLOP JP7 &amp;amp; JP5 to JP4 and JP6&lt;br /&gt;
FPGAW(ENC_NOISE_FILTER_ADD) = ENC_0_3_JP4 + ENC_4_7_JP6 + ENC_NOISE_FILTER_DEFAULT_VAL; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JP4 and JP6 have +5V available on Pin1 and GND on Pins 8 and 9 that might be used to power 5V encoders.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span id=&amp;quot;Axes_Servo_Tuning_and_Trajectory_Planner&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axes Servo Tuning and Trajectory Planner&amp;lt;/span&amp;gt;==&lt;br /&gt;
===Basic Servo Tuning Overview===&lt;br /&gt;
Once an axis is configured and proved capable of holding a position it is ready to be tuned and optimized. Most often a small value of P Gain only is used to show the servo is functional and can hold position. The Servo may be very weak and inaccurate but will be functional.&lt;br /&gt;
&lt;br /&gt;
Every system is different and the tuning parameters are interactive in a manner that usually doesn't allow parameters to be determined one at a time. Rather after one parameter is changed it may be necessary to revisit the other parameters.&lt;br /&gt;
&lt;br /&gt;
In general higher gains will reduce errors and improve accuracy, but tend to make the system more unstable.  So the general idea is to increase gains to reduce errors as much as possible but still have a stable system.&lt;br /&gt;
&lt;br /&gt;
Often during tuning the system may go unstable. In fact, it is normally intentionally driven to instability to find its limits for a certain parameter. This can result in a violent oscillation or worse so one should be prepared to quickly disable the Servo. If an appropriate [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Max_Following_Error Max Following Error] is used the axis can be automatically disabled before the oscillation becomes too violent, yet not disable when performing a normal test.&lt;br /&gt;
&lt;br /&gt;
KMotion.exe allows you to change any axis parameter on the Step/Response, Config, or Filters Screens then simply push &amp;quot;Move&amp;quot; to see the effect of the change.  Note that as performance improves the errors will become small and difficult to see on the Position Plot without Zooming in (Left click drag) so changing the plot type to plot the error is useful.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The overall process normally goes something like this:&lt;br /&gt;
&lt;br /&gt;
# Select a Test [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Measurement Move Size] and [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Motion_Profile Motion Profile].  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Velocity.2C_Acceleration.2C_and_Jerk See Also]&lt;br /&gt;
# Select [http://dynomotion.com/Help/StepScreen/StepScreen.htm#max_limits Max Limits] to allow for the Test.  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Max_Limits_-_Error See Also]&lt;br /&gt;
# Determine maximum level of [http://dynomotion.com/Help/StepScreen/StepScreen.htm#PID P Gain]&lt;br /&gt;
# Determine maximum level of [http://dynomotion.com/Help/StepScreen/StepScreen.htm#PID D Gain] (with Low Pass Filtering)  See Also [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Torque_Servos_vs_Velocity_Servos here] and [http://www.dynomotion.com/wiki/index.php?title=Main_Page#Lead_Compensator_vs_Derivative_Gain here].&lt;br /&gt;
# Determine new maximum level of P Gain now that D Gain increased stability&lt;br /&gt;
# Add I Gain to improve accuracy and remove steady state errors.  [http://www.dynomotion.com/wiki/index.php?title=Main_Page#I_Gain.2FMax_Limit_Integrator See Also]&lt;br /&gt;
# Add [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Feed_Forward Feed Forward] to reduce errors&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Torque Servos vs Velocity Servos===&lt;br /&gt;
+/-10V Analog Amplifiers usually come in one of two varieties: '''Torque''' or '''Velocity'''. Torque mode amplifiers consider the input command as a Torque Command and work to generate the commanded Motor Torque. Velocity mode amplifiers consider the input command as a Velocity Command and work to generate the commanded Velocity.  Its important to understand what type of Amplifiers you have.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Velocity Mode Amplifiers''' need some form of feedback going to the Amplifier in order for the drive to know the current velocity. This might be a digital encoder or an analog tachometer.&lt;br /&gt;
&lt;br /&gt;
Its easy to tell if you have a Velocity Mode Amplifier by looking at a plot of a move on the Step Response Screen.  The Output (green plot with right scale) will be proportion to the motor velocity.  When moving at constant speed the output will be relatively constant.  See in the plot below the output (green) remains at a relatively constant ~1100 DAC counts while the position (red) ramps at a constant slope of the 90000 count/sec rate:&lt;br /&gt;
&lt;br /&gt;
[[File:VelocityAmp.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
Velocity mode amplifiers can be relatively easy to tune using only P (Proportional) Gain.  Additional Gains and filters can be used for best performance but using only P Gain will often result in reasonable performance and a stable system (unlike Torque Mode Amplifiers). &lt;br /&gt;
&lt;br /&gt;
As an example consider controlling the speed of a car using only Proportional Gain as it approaches a target (Stop sign).  Consider a P Gain of 0.1 where at 1000ft from the stop sign we command 1000 x 0.1 = 100MPH.  Then at 100ft we command 10MPH.  Then at 10ft we command 1MPH.  This results in a nice, smooth, exponential approach, without overshoot.&lt;br /&gt;
&lt;br /&gt;
Contrast this with controlling the acceleration (torque) of a car using only Proportional Gain as it approaches a target (Stop sign).  At large distance we apply maximum acceleration.  Although as we approach the stop sign we reduce acceleration, we continue to accelerate and speed continues to increase until we pass the stop sign.  Torque mode servos are inherently unstable.  P only gain only works at all if there is some friction (the car is dragging a sled which slows us down with less torque).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Acceleration Mode Servos''' may or may not have any feedback.  If they have feedback it is usually used only to commutate a brushless motor.  In the plots the Output (green) will have large magnitude when the Position (red) is accelerating, where the plot has curvature (changing slope).&lt;br /&gt;
&lt;br /&gt;
Acceleration mode Servos are unlikely to work well or at all with only P Gain.  Some form of damping or lead compensation will usually be required to get a stable system.   D (derivative) Gain (or a lead compensator) should be included with the P Gain to help stabilize the system.  D Gain can be increased to make the system more stable up to a point.  After some point the additional D Gain will make the system more unstable. and should be reduced.&lt;br /&gt;
&lt;br /&gt;
When using D Gain (or lead compensation) the quantization noise (steps) in the encoder position can cause spikes in the output.  For example a D Gain of 100 will cause a spike of 100 counts in the output whenever the input changes suddenly by 1 count.  If the spikes are very high amplitude and short duration, the Amplifier may not handle them in the expected manner.  A low pass filter can be used to widen and reduce their amplitude allowing the amplifier to handle them more effectively.  Typically a 2nd order low pass filter of 500Hz Q=1.4 is used.  The last filter is normally used so it is applied to any Feed Forward. Such as:&lt;br /&gt;
&lt;br /&gt;
[[File:LowPass400Q1p4.png|none|link=|680x439px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span id=&amp;quot;Velocity.2C_Acceleration.2C_and_Jerk&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt;Velocity, Acceleration, and Jerk&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;div id=&amp;quot;yui_3_16_0_1_1445622719616_3315&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;The Velocity, Acceleration, and Jerk in the Step Response Screen (KFLOP parameter settings) and the Acceleration and Velocity in the KMotionCNC | Tool Setup | Trajectory Planner | Axis Parameters are both used for different things.  The two sets of parameters are independent. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;yui_3_16_0_1_1445622719616_3313&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;The&amp;lt;/span&amp;gt; KFLOP parameters are used for 3rd order motions.   These include things like:  Jogging, Homing, and GCode Rapids (G0).  The units in KFLOP are in counts or steps.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span id=&amp;quot;yui_3_16_0_1_1445622719616_3320&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;The KMotionCNC parameters are used for 2nd order (&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;yui_3_16_0_1_1445622719616_3321&amp;quot; class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;infinite &amp;lt;/span&amp;gt;Jerk) coordinated motion paths.  These are GCode G1,G2,G3 continuous paths.  The units are in Inches (or in some cases degrees).   Note there is an Option in KMotionCNC &amp;quot;Rapids as Feeds&amp;quot; where these parameters will also be used for Rapids.  But this option should only be used for highly non-linear Kinematic Systems which can not take advantage of faster/smoother 3rd order point to point straight line Rapids.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;Tests&amp;lt;/span&amp;gt; to find and verify optimal settings for both types of moves should be made using the Step Response Screen.  Optimal settings are usually determined by experimentation.  Although it might be possible to calculate the settings based on motor torque gains, back-emf, amplifier voltage/current, mass, moments of inertia, friction, encoder resolution, leadscrew pitch, required following accuracy, etc... It is often too complicated and with too many unknowns to be practical.  So experimental moves can be tested at ever increasing Velocities, Accelerations, and Jerks until the system is unable to follow the trajectory without having too much error or shock to the system.  After absolute limits of the system are determined then the settings should be backed off by some amount to provide operating margins (ie 20%).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;It is usually best to first determine max possible velocity using a relatively low acceleration. Maximum power is usually required at the point of the trajectory where velocity is high and still accelerating.  Supply Voltage limitations tend to limit velocity.  Current limitations tend to limit acceleration.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[File:MaxVelAccelPower.png|none|link=|485x361px]]&amp;lt;br /&amp;gt;The Step Response Screen always performs 3rd order motion but 2nd order motion can be simulated by temporarily setting the Jerk to a huge value (1000X the acceleration value).  In general reducing the Jerk value will result in longer times to perform motions, but often the improved smoothness will permit higher maximum accelerations and velocities to be used resulting in overall shorter motion times.  An analogy might be how you might stop more quickly in a car, without skidding or spilling your coffee, by applying the brakes harder in a more gradual manner rather than slamming on the brakes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;yiv2818182665class&amp;quot;&amp;gt;Make&amp;lt;/span&amp;gt; sure when testing the size of move is long enough for full acceleration and velocity are achieved.  A common mistake is to have Acceleration or Velocity Settings set to too high for your system but when testing a short move there is no indication of a problem.  The plot mode of Velocity Output  vs Time can be helpful to verify full Velocity is being achieved.&amp;lt;span id=&amp;quot;.C2.A0&amp;quot; class=&amp;quot;mw-headline&amp;quot;&amp;gt; &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;The idea is that a motor axis has torque and speed limitations and you should determine and understand what they both are for your system. Available motor torque drops off with higher speed. At some speed the motor will not even be able to generate any torque at all. Motor torque is required to accelerate the axis. We need to make sure that no combination of velocity and acceleration will ever cause the axis to fault/stall/fail. So there is often a complex set of speeds and accelerations that will work ok that form an envelope of workable speed and acceleration. So one nice thing to know is top speed possible. It is like taking your car out on a long straight highway and gradually accelerating to find the max speed is 100MPH. You will then know that ever attempting a speed over 100MPH will always fail. Also speed should probably be limited to something like 80MPH to allow for margin and to allow reasonable acceleration up to that speed. The reason for performing the top speed test at low acceleration is to avoid a failure because of not being able to accelerate at the specified rate. So we want to set the acceleration to a low value so it will not be a limiting factor when determining top speed. However if we set the acceleration so low with a short trip distance we will never go very fast and the speed test will be meaningless. This should be avoided. Change the Plot type to Velocity, Output, vs Time to clearly see if this is the case.  You may want to turn off Measured Velocity if it obscures viewing the Commanded Velocity&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;For example to accelerate to 700,000 counts/sec at an acceleration rate of 700,000 counts/sec^2 would take 1 second. And then to slow back down would take 1 more second. So at least 2 seconds of motion would be required to get to full speed. A 100,000 count move (2 inches for a system with 50,000 counts/inch) takes much less time than that. Furthermore with a relatively low Jerk setting (1e6). This means the acceleration will be applied gradually over 0.7 seconds. This means an even much longer time and distance would be required to achieve top speed.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Here is the method to follow to find 2nd/3rd order motion profile limits:&amp;lt;br /&amp;gt;(note every system is different and will vary based on resolution, motor size/type, mass, etc...)&lt;br /&gt;
&lt;br /&gt;
'''1 - Find Max Velocity at low Acceleration and infinite Jerk'''&lt;br /&gt;
&lt;br /&gt;
Choose a Velocity to test (ie V=100000 counts/sec)&amp;lt;br /&amp;gt;Set a moderately low Acceleration Time of 1 second (A = V/1sec = 100000 counts/sec^2)&amp;lt;br /&amp;gt;Set very high Jerk so Acceleration is applied almost instantaneously in 0.001 sec (J = A/0.001sec = 1e8 counst/sec^3)&amp;lt;br /&amp;gt;Test a very long move 20 inches if possible (for resolution 50000 counts/inch, 1,000,000 counts)&amp;lt;br /&amp;gt;Plot Velocity, Output, vs time to see if V is actually obtained&amp;lt;br /&amp;gt;If the motion was successful repeat all above with higher V, if not try lower V&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Once Max V is found reduce by some margin (ie 20-50%)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Note you may decide on lower speed for other reasons (safety, vibration, noise, wobble, shock, etc....)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;'''2 - Find Max Acceleration for your system for the chosen Velocity'''&lt;br /&gt;
&lt;br /&gt;
Using the V found above increase A (keeping Jerk high in the same manner) until the system fails/faults/excessive shock, etc...&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Once Max A is found reduce by some margin (ie 20-50%)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;These V and A Values are now known good values for your system and can be used for 2nd order motions such as KMotionCNC Trajectory Planner or Mach3 Motor tuning. Note units will need to be converted (counts to inches or mm, time from seconds to minutes depending on the App)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3 - Find optimal 3rd order Jerk limited motions.'''&lt;br /&gt;
&lt;br /&gt;
The previous result from Step #1 and #2 used nearly infinite Jerk where Acceleration forces were applied nearly instantaneously. By reducing Jerk smoother motion should be possible. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Set Jerk so it is applied over 20ms (ie for A=200000 J = A/0.020 = 1e7&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Test to see if motions are smoother. With closed loop systems the Position Error Plot can be used to see if the motion has less error and is smoother. Open loop system will require you to hear the difference.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Increase/decrease Jerk to find the optimal value. Note reducing Jerk a lot will of course make the system very smooth, but will also be much slower using less acceleration and velocity which is undesirable. So the highest Jerk possible should be found that still provides some smoothness.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Reducing Jerk only will always make the system slower with less performance (but hopefully significantly smoother). It is usually then possible to increase Acceleration and Velocity somewhat to achieve even higher performance than what was possible with infinite Jerk while being as smooth or smoother.&lt;br /&gt;
&lt;br /&gt;
'''4 - Reduce Max Following Error Limit to small value'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;Now that the system is properly tuned and reasonable Acceleration, Velocity, and Jerk are set the motor Position should always follow the commanded Destinations accurately with only small errors.  By Plotting Position Errors under various conditions (Distances) you can get an idea of the worst case following errors under normal conditions.  The Max Following Error Parameter should be set to a value slightly larger than the worst case following error (ie 20~50% larger).  In this case if anything abnormal occurs: ie. The axis hits an obstacle, commanded at too high of a speed, servo goes unstable, hardware/electronics failure, a Following Error will be immediately detected and the axes disabled.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axis Resolution - counts/inch (or counts/mm)&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Its important to understand the resolution of your Axis which is the number of fundamental raw motor/driver encoder counts or motor steps per standard unit of distance (inch or mm).  Although tuning in KMotion.exe Step Response Screen and motions within KFLOP typically use units of raw counts or steps it is important to know how these translate to real-world distances, speeds, etc...  Later, applications such as KMotionCNC or Mach3 will need this information to scale motions properly.&amp;lt;br /&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;There are usually a number of factors that combine together to determine the Axis Resolution.  These might include:&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;counts or steps per motor revolution&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;any gearing or belts and pulleys involved between motor and drive mechanisms&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;lead screw pitch, rack and pinion tooth pitch, drive belt radius, etc.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For example consider a Stepper Drive with:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;3200 steps per motor rev&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;2:1 gear reduction from motor to lead screw&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;0.2 inch lead screw pitch&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;Axis Resolution = 3200 step/motor rev x (2 motor rev/ screw rev)  / (0.2 inch / screw rev) = 32000 steps/inch&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;To determine whether your assumptions and calculations are correct perform a test.  Command as large of a move as convenient and measure the actual distance moved with a ruler.   For example in the axis described above you might command a move of 320000 steps.  This should result in a motion of:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;320000 steps / (32000 steps/inch) = 10 inches.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For KMotionCNC set the Axis Resolution in the [http://dynomotion.com/Help/KMotionCNC/ToolSetupScreenTP.htm#Axis_Motion_Parameters Tool Setup | Trajectory Planner Screen | Axis Parameters | cnts/inch].  Note units must be in units of inches.  If your resolution is in mm units multiply by 25.4.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;mw-headline&amp;quot;&amp;gt;For Mach3 enter the Axis Resolution in the Configuration | Motor Tuning Screen.  Make sure the setup units (not GCode units) match the mode of your values.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Servo Dither/Hunting - (oscillation around zero error)===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;Servos have high accuracy because they are always actively trying to make corrections and drive the error to zero.  Unfortunately this can sometimes cause annoying dither or position hunting around zero when not moving.  This is a very complex non-linear effect dependent on the dynamics of the mechanics.  Because of the highly non-linear quantization effects of single &amp;quot;steps&amp;quot; in the encoder position, stiction, backlash, etc. it follows different rules and is harder to analyze than normal servo tuning/stability in the larger magnitude more linear regime.  For example attempting to apply &amp;quot;Damping&amp;quot; is unlikely to work.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Lowering gains will usually help at the expense of performance.  However in many cases more than acceptable performance can be achieved with lower gains so one should consider if the higher gains are really needed.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;KFLOP has a Deadband Gain and Range feature that can basically be used to tell the servo to not attempt to correct small errors (treat the errors as zero), or to try to correct them less aggressively (with a Gain less than 1.0).  See [http://dynomotion.com/Help/StepScreen/StepScreen.htm#Dead_Band here for more information]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Unfortunately adding Deadband doesn't always help the servo &amp;quot;sit still&amp;quot; and may actually increase the size of the dither depending on the dynamics.&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that when the servo is commanded to a non integer position ie 999999.7 encoder counts without deadband the servo will always be making corrections.  The best the servo can do is dither between encoder positions 999999.0 and 1000000.0.  With an error of either -0.7 or +0.3.  A servo with Integrator gain will guarantee the average is 999999.7&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;If dither is still a major problem a C Program might be used to monitor things and change settings under certain conditions to reduce dither.  See the example AntiServoDither__ALL.c which monitors for small errors for a period of time and if so reduces or turns off Integrator gain.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
===Noisy GCode - Trajectory Planner Smoothing===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;An analysis of Quantization Noise in GCode and Trajectory Planner Settings to generate smooth motion.&amp;lt;br /&amp;gt;[[File:GCode_Noisy_Path.png|none|link=|432x432px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[Trajectory Planner Smoothing Noisy GCode|See Analysis and Solution]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===Arc &amp;quot;faceting&amp;quot; - Trajectory Planner - Collinear Tolerance===&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[File:ArcsTrajectoryZoomXTol.0005.png|none|link=|526x460px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;[[ArcFacetingColinearTol|See Analysis and Solution]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;yiv2818182665class&amp;quot; style=&amp;quot;color: #000000; font-size: 13.3333px; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; background-color: transparent; font-style: normal;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===I Gain/Max Limit Integrator===&lt;br /&gt;
I (Integrator) Gain can be used to eliminate persistent errors.  In fact any Integrator Gain at all guarantees the average error over infinite time is zero.  Without I Gain a system might have a small error that does not create enough output to overcome stiction to make a correction.  In such a case the error could persist forever.  Not so with any Integrator Gain.  Any error will be integrated and ramp the output higher and higher until eventually there will be a correction.  That assumes the Integrator or Output doesn't saturate or reach their programmed limits.  The rate the output ramps (or sums) is dependent on the size of the error and the I Gain value.  The Error x I Gain is summed every servo sample (90us).  This is why I Gain values are often small numbers (0.0001 - 0.01 typical range).  There is no guarantee that the position doesn't over shoot the target Destination.  In fact it is likely as as any error (area) under the trajectory will always be balanced by an equal area over the trajectory.  Too high of I Gain will make the system unstable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another case where I Gain is useful is when moving at high speed with a Velocity Amplifier.  To move at high speed a significant amount of output is required.  Without I Gain a significant amount of error could be required to provide this Output (ie Error x P Gain = Output).    With I Gain the Integrator will eventually ramp up to provide any Output necessary to move at the desired speed driving the error to zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Integrators have an issue often referred to as &amp;quot;Integrator Wind Up&amp;quot;.  This issue usually doesn't arise under normal conditions.  However if something is preventing the servo from making a correction such as forcing the position away from the target for a sustained amount of time, or disabling the amplifier, the Integrator will integrate to a huge unlimited value.  When the force is removed or amplifier re-enabled, the Integrator will likely cause a violent motion and overshoot.  Max Limit Integrator can help to minimize this issue by limiting the amount the Integrator can ramp up to.  So the Max Limit Integrator Value should be set at the minimum value that can still allow the Integrator to function in normal circumstances.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Typically there are two cases that should be considered when determining the Max Limit Integrator. &lt;br /&gt;
&lt;br /&gt;
# The amount of output expected to be required to overcome any stiction, friction, or other forces (cutting, gravity, etc...).  This is often not a large value and can be estimated or can be observed from the Step Response Screen (green plot right side scale is the output) when making a move.&lt;br /&gt;
# The amount of output required to provide the output needed to move at speed.  It is important to note that D Gain provides a damping or drag effect on the Output.  So the Integrator must be able to ramp up to a sufficient level to overcome the damping or drag effect and still provide enough output to move at the commanded speed.  For example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assume:&lt;br /&gt;
&lt;br /&gt;
# Commanded speed of 500,000 counts/sec&lt;br /&gt;
# D Gain of 35&lt;br /&gt;
# Output required to move at speed is 1800 DAC Counts&lt;br /&gt;
# Servo Sample Time of 90us&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Damping effect = Speed x D Gain x Sample Time = 500000 x 35 x 90e-6 = 1575 counts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Required Integrator Value = 1800 + 1575 = 3375&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So to provide some margin an Max Limit Integrator Value of 3500 might be used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Max Limits - Error===&lt;br /&gt;
Max limits error can be helpful to have your system respond less violently in the abnormal event where an excessively large error occurs.  Normally with a properly tuned system following errors should be small.   Setting a Max limits error can cause the servo to treat errors beyond a specified limit as if they were only the size of the limit and therefore respond less so than they would otherwise.  The max limits error is normally set to a value so it is not limiting under normal circumstances.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Plot below shows a situation where a small max limits error combined with a low P gain severely limits the Output.  In the plot below a large move (10000 counts) at a high speed (40000 counts/sec) is commanded.  Only P Gain (0.2) is used to provide the Output (green).  The max error limit of 200 combined with the low gain (0.2) limits the output to only 40 DAC counts.  Even as the true error increases to many thousands of counts, the servo is told to ignore the amount over 200.  So the output can never exceed 40 DAC counts.  The 40 DAC count limit means that the Axis is therefor not capable of providing the output necessary to keep up with the commanded motion.  The axis does the best it can with the limited output, and only does a fraction of the desired motion.&lt;br /&gt;
&lt;br /&gt;
[[File:Move10000.png|none|link=|665x431px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After increasing the max limits error the Output (green - right scale) now goes to a much higher value (900), and the Position (red) follows the Command (blue) to a much better degree.&lt;br /&gt;
&lt;br /&gt;
[[File:Move10000_nolimit.png|none|link=|667x430px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Increasing the P Gain to 1.6 also applies more Output sooner and the Position follows the command still better.&lt;br /&gt;
&lt;br /&gt;
[[File:Move1000_p1.6.png|none|link=|667x432px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Lead Compensator vs Derivative Gain===&lt;br /&gt;
Derivative (D) Gain is often used to help stabilize a system.&amp;amp;nbsp; It helps to think in the Frequency Domain to help understand how the two forms of compensation help.&amp;amp;nbsp; Please read below and [http://dynomotion.com/Help/BodeScreen/BodeScreen.htm this] for more information on the Frequency Domain.&amp;amp;nbsp; Both Compensation methods add positive phase to help stabilize the system.&amp;amp;nbsp; Unfortunately both methods increase gain at higher frequencies possibly causing the system to go unstable at higher frequency.&amp;amp;nbsp; A Lead Compensator provides the benefit of positive phase but without as much gain increase at higher frequencies.&amp;amp;nbsp; This figure shows a simplified Gain Plot comparison:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:DGainvsLead.png|none|link=|593x593px]]&lt;br /&gt;
&lt;br /&gt;
Here is a Bode Plot of a P=0.5 D=20 Compensator.   Note the KMotion.exe Bode Plot Screen has the capability of plotting the Frequency Domain Response of the PID+Filters Compensation.  Assume we desire positive phase to be added at 40Hz.  Notice the positive phase of 40 degrees at 40Hz which is good.  However the Gain increase in the 1KHz region of about 21db which is bad.&lt;br /&gt;
&lt;br /&gt;
[[File:P.5D20Annotate.png|none|link=|621x460px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a Bode Plot of a P=0.5 N1=N2=25Hz D1=D2=70Hz Compensator.   Assume we desire positive phase to be added at 40Hz.  We choose N1 N2 and D1 D2 to surround the frequency where the positive phase is desired.  Moving them further apart will increase the amount of positive phase but also increase the added Gain.  Notice the positive phase of 60 degrees at 40Hz which is good.  However the Gain increase in the 1KHz region of about 12db which is bad.  However both are improvements over the D Gain compensator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:PoleZeroFilter.png|none|link=|210x319px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:P.5D0N25D70Annotate.png|none|link=|644x478px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Tuning Master/Slave Configurations===&lt;br /&gt;
Master/Slave [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Master/Slave_Settings Configurations] allow two (or more) motors to drive the same axis.  Slaves are configured to follow a Master Axis.  For example two lead screws on both sides of a gantry.&lt;br /&gt;
&lt;br /&gt;
Tuning slaved axes is kind of a catch 22.  In order to tune one axis the other axis must be tuned well enough to follow and vice versa.  If possible, disconnect any mechanical linkage between the Master and Slave and test them separately without Slaving the Axes together to verify each axis Servos (can hold a position), moves at least somewhat properly, and moves in the same direction (assuming a positive [http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#Master/Slave_Settings Slave Gain] will be used).&lt;br /&gt;
&lt;br /&gt;
It is usually possible to incrementally tune each axis, at first moving slowly, then later at higher speeds, accelerations, and gains.  Only the Master Axis can be tested with the [http://dynomotion.com/Help/StepScreen/StepScreen.htm Step Response Screen].  This is because the Slave will follow any movement of the Master, but the Master will not follow movement of the Slave.  So if the Master Axis is moved all is well as both axes will move together, but if you try to move the Slave axis the two axes will fight.  The Master fighting to stay where it is, and the Slave fighting to move.&lt;br /&gt;
&lt;br /&gt;
To test/tune the Slave axis temporarily reverse the Master/Slave roles to make it the Master and then test it as the Master.&lt;br /&gt;
&lt;br /&gt;
Note: only the Master Axis should be included into the Coordinated Motion System.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Bode Plots===&lt;br /&gt;
A Bode Plot is a powerful tool for characterizing and providing insight into a dynamic system. It can help determine closed loop stability, bandwidth/performance, resonant frequencies, and more. It is entirely based on the system being linear. Linear in the sense that if the amplitude of some input signal is changed then the output signal will change proportionally as well. Unfortunately most systems are not entirely linear. Stiction, backlash, encoder quantization, amplifier saturation, and other effects are non-linear. For example driving a system with a signal too small to overcome stiction will result in no output at all whereas a larger signal will result in some output. This is clearly non-linear behavior. It would be nice to use a technique that handles non-linear systems but basically none are known.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;A Bode Plot is made injecting a stimulus to the system and observing how the system responds. For the reasons of non-linearity it is very important to perform a Bode Plot measurement using a representative level of stimulus similar to what the system will actually have during normal operation. If the Stimulus is not adjusted properly the result is likely to be completely invalid. Additionally the system should be reasonably tuned and stable so that it is responding in a reasonable way to the stimulus. If the system is unstable or very poorly tuned the result is likely to be completely invalid.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;You might think of it somewhat like shaking a box to determine what is in it. You should shake it with enough intensity and at frequencies to get some reaction, but not so high of intensity to break or distort the object inside.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;To create a Bode Plot use the KMotion.exe Bode Plot Screen. First select Plot: Time domain - Command, Position, Output vs Time and adjust the Amplitude and cutoff Freq until there is small but significant Position (red) changes (ie 50 encoder counts), at a frequency low enough that the Position at least somewhat attempts to follow the Command (blue), and where the Output (green) is not near saturation for the Drive being used.&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;&amp;lt;br data-attributes=&amp;quot;%20/&amp;quot;&amp;gt;After the Stimulus/Noise Injection settings are set switch to Plot: Open Loop - Magnitude and Phase vs Frequency. Set the number of Samples to average (ie 20) and perform a Measurement.&amp;amp;nbsp; [http://dynomotion.com/Help/BodeScreen/BodeScreen.htm See here for more information].&lt;br /&gt;
&lt;br /&gt;
===Links to other Information on Tuning and Bode Plots===&lt;br /&gt;
[http://ctms.engin.umich.edu/CTMS/index.php?example=Introduction&amp;amp;section=ControlFrequency umich.edu Introduction section Control Frequency]&lt;br /&gt;
&lt;br /&gt;
[http://www.motiontech.com.au/assets/pdf/Kollmorgen%20Use%20Control%20Theory%20to%20Improve%20Servo%20Performance%20230712.pdf  Kollmorgen Use Control Theory to Improve Servo Performance 230712.pdf]&lt;br /&gt;
&lt;br /&gt;
==Problems and Resolutions==&lt;br /&gt;
====General====&lt;br /&gt;
:* [[Noise - Typical Problems and Resolutions|Dealing with noise on inputs]].  If you experience issues with inputs misreading, the issue may be noise.  This page provides examples on what might be causing noise issues and examples of how to possibly deal with noise.&lt;br /&gt;
:* Other&lt;br /&gt;
===Software-Specific Problems and Resolutions===&lt;br /&gt;
:* Place links to pages explaining resolutions to problems that are largely software-related here&lt;br /&gt;
[[KFLOP User C Programs Compiling/Launching Slowly because of Windows Defender]]&lt;br /&gt;
&lt;br /&gt;
===Hardware-Specific Problems and Resolutions===&lt;br /&gt;
:* Place links to pages explaining resolutions to problems that are largely hardware-related&lt;br /&gt;
====[[Step/Dir Drives lose 2 Steps for each pair of Direction Reversals]]====&lt;br /&gt;
&lt;br /&gt;
==Applications and Projects==&lt;br /&gt;
:* Place links to pages that explain how you accomplished your particular project.  Write clear explanations that provide background on what you did and how you did it.&lt;br /&gt;
====[[Tool Changer - router linear 4 Tools - C Program]]====&lt;br /&gt;
[[File:LINEAT+ATC.jpg|none|link=|246x178px]]&lt;br /&gt;
More linear milling tools: https://www.ichome.com/&lt;br /&gt;
&lt;br /&gt;
====[[Part Zero &amp;amp; Tool Height Touch Plate|Part Zero &amp;amp; Tool Height Touch Plate]]====&lt;br /&gt;
====[[Driving Hobby Servos]]====&lt;br /&gt;
[[File:HobbyServo.png|left|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
HiTec Type&lt;br /&gt;
&lt;br /&gt;
==Electrical Discharge Machining==&lt;br /&gt;
[https://en.wikipedia.org/wiki/Electrical_discharge_machining EDM (wikipedia)] is a method of cutting materials with high precision and detail.  Dynomotion Motion Controllers work well for EDM because of the ability for feedrate to be dynamically controlled including reversal along cutting path.&lt;br /&gt;
&lt;br /&gt;
[[Information on BAXEDM Arc Generators used with KFLOP]]&lt;br /&gt;
&lt;br /&gt;
Applied Science video that shows how to build an BAXEDM drilling machine using KFLOP and describes how it works:&lt;br /&gt;
&lt;br /&gt;
 {{#ev:youtube|https://youtu.be/rpHYBz7ToII|||||start=980}}&lt;br /&gt;
&lt;br /&gt;
==How to convert a milling machine to a 3D printer in 3 easy steps==&lt;br /&gt;
[[File:CNCto3DPrinter.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
More information [[How to convert a milling machine to a 3D printer in 3 easy steps|here]].&lt;br /&gt;
&lt;br /&gt;
==International and other Languages==&lt;br /&gt;
[[Russian]]&lt;br /&gt;
&lt;br /&gt;
[[Spanish]]&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:KStep_Terminals.dwg</id>
		<title>File:KStep Terminals.dwg</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:KStep_Terminals.dwg"/>
				<updated>2024-03-02T00:43:39Z</updated>
		
		<summary type="html">&lt;p&gt;TK: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:KStep_Terminals.dxf</id>
		<title>File:KStep Terminals.dxf</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:KStep_Terminals.dxf"/>
				<updated>2024-03-02T00:43:16Z</updated>
		
		<summary type="html">&lt;p&gt;TK: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:Konnect_Terminals.dwg</id>
		<title>File:Konnect Terminals.dwg</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:Konnect_Terminals.dwg"/>
				<updated>2024-03-02T00:42:37Z</updated>
		
		<summary type="html">&lt;p&gt;TK: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:Konnect_Terminals.dxf</id>
		<title>File:Konnect Terminals.dxf</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:Konnect_Terminals.dxf"/>
				<updated>2024-03-02T00:42:05Z</updated>
		
		<summary type="html">&lt;p&gt;TK: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php/File:Kanalog_Terminals.dwg</id>
		<title>File:Kanalog Terminals.dwg</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php/File:Kanalog_Terminals.dwg"/>
				<updated>2024-03-02T00:41:24Z</updated>
		
		<summary type="html">&lt;p&gt;TK: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	</feed>