Synchronous IO Commands Embedded in Coordinated Motion

KMotionCNC allows I/O operations to be embedded into the Coordinated Motion Buffer such that the IO commands are output synchronously (within 90us Servo Sample) with motion.  (Buffered IO operations can also be inserted with Library calls from custom applications).

This example shows two MCodes configured to set bits I/O bits 46 and 47 high and also MCode M6 configured to wait for I/O bit 46 to be low.

A simple GCode Fragment shows the MCodes embedded within a continuous straight motion right at the point the motion reaches X=1.0.

The Trajectory Planner normally combines very collinear motion blocks together for smoothing and so forth.  But in this case it is careful to not combine segments that cross a buffered I/O boundary.

Executing the GCode we can observe the IO bits 46 and 67 set high as the motion crosses X=1.0

The GCode below demonstrates a right-triangle motion path with the I/O commands inserted at a corner.

With Trajectory Planner Break Angle set to 10 degrees (which is less then 90 degrees) a full stop will occur at the corners.

In this case the IO switches where the instantaneous stop occurs at a corner.

To demonstrate what happens with corner rounding an exaggerated corner rounding example is shown below.  With a Break Angle greater than 90 degrees a stop will not occur at the corner.  Also a large radius (0.1 inches) and large facet angle (20 degrees) corner rounding is configured.

To observe exactly what happens we use the KFLOP C Program shown below to real-time capture the XY position when the IO occurs (XY resolution is 10000 counts per inch).

#include "KMotionDef.h"

main()

{

for (;;)

{

if (New != Last)

{

Last=New;

printf("X=%f Y=%f\n",ch0->Dest/10000.0,ch1->Dest/10000.0);  // send message to console

}

}

}

The captured position is printed as:

X=0.929315 Y=0.070748

In addition to embedding outputs into the motion stream, waits for inputs can be embedded.  This is inserted as a buffered WaitBitBuf command.  When executed if the specified bit is false the motion will stall at that point until the input becomes true.  There is a similar command WaitNotBitBuf that will stall until the input becomes false.  MCodes can be configure to insert these commands,  Although Wait commands can be inserted anywhere in a motion path it normally is only useful to place them at locations where the motion stops.  Such as the very beginning of a path or at a corner where motion comes to a stop.  Otherwise an instantaneous stop will occur without any acceleration.  Wait commands are useful when motion must proceed instantly on command.  This is possible because the motion has already been Interpreted, planned, downloaded, and commanded to execute ahead of time.  See the example GCode below where a wait has been inserted at a corner.

The plot below shows where the wait will stall execution if the specified bit is false.