Adding A Decelerated Stop To A Standard G1 G-Code

Photo of Ruben Ordonez

Written by Ruben

The main standardized version of G01 defines a cutting move with no automatic velocity change or deceleration based on a look ahead algorithm. However, many extensions and variations have been added independently by control manufacturers and machine tool manufacturers. The methods and algorithms implemented by other commercial organizations are often proprietary.

Camsoft’s CNC Professional PC Based controller software implements the standard G01.  Extensions and variations in the CNC Professional controller software are available through customization by the end user thus allowing the implementation of any desired functionality.

The following sample for adding a very basic feature for a look ahead algorithm that would automatically add a decelerated stop to a G01 based on an angle is just a taste of what can be implemented with a little programming. Because of its simplicity, there are formatting rules that must be followed.

  1. All blocks must have the G1 in the block.
  2. All G1 blocks must call an X and a Y coordinate even if its the same as previous.
  3. Z axis is not considered for automatic deceleration.
  4. There can be no space between the axis call out letter and the position value.
  5. There must be at least one space between words.
  6. The use of offsets, G41, G42, G92, etc. is not supported.
  7. Position must be in absolute coordinate system.
  8. Incremental programming is not supported.
  9. G2 & G3 not considered for automatic deceleration.

With these rules in mind, here is the sample logic for a G01.  This logic is provided as is and holds no guarantee.  It should not be used for production purposes.  It is provided here for the sole purpose of demonstration and and a sample that may used for further development.

Additional logic for G1 in GCODE.FIL file


IF\64<>1THEN GOTO :SKIP
LOADING \55:IF\55=0THEN GOTO :SKIP
LOOKAHEAD 1;\55
LENSTR \55;\54
INSTR \55;G1;\56
IF\56=0THEN GOTO :SKIP
\101=
\102=
INSTR \55;X;\56
:GETX
\56={\56+1}
IF\56={\54+1}THEN GOTO :GETNEXT
MIDSTR \55;\56;1;\57
DISPVARB \55
DISPVARB \57
IF\57="-"THEN GOTO :JUMP1
IF\57="+"THEN GOTO :JUMP1
IF\57="."THEN GOTO :JUMP1
IF\57= THEN GOTO :GETNEXT
:JUMP1
\101=\101\57
GOTO :GETX
:GETNEXT
INSTR \55;Y;\56
:GETY
\56={\56+1}
IF\56={\54+1}THEN GOTO :NEXT
MIDSTR \55;\56;1;\57
IF\57="-"THEN GOTO :JUMP2
IF\57="+"THEN GOTO :JUMP2
IF\57="."THEN GOTO :JUMP2
IF\57= THEN GOTO :NEXT
:JUMP2
\102=\102\57
GOTO :GETY
:NEXT
\111={x-\801}
\112={y-\802}
ANGLE 0;0;0;\111;0;\112;\61
\101={\101-x}
\102={\102-y}
ANGLE 0;0;0;\101;0;\102;\62
\60={ABS(\61) + ABS(\62)}
DISPVARB \60
IF\60>\63THEN DECELSTOP
:SKIP
\801=x
\802=y
GO x;y;z
-----G1

 

Additional logic for G0 in GCODE.FIL file


\801=x
\802=y
-----G0

Additional logic for STARTUP.FIL file.

\63=60
BLEND -100

 

Here is a properly formatted sample NC G-code program.

T1
G0 X-2 Y2
G1 X2 Y2 F300
G1 X2 Y-2
G1 X-2 Y-2
G1 X-2 Y2
G0 X0 Y0
M2

You may also like…

Camsoft Hosts Ayce Training

%%wppa%% %%slideonly=6%% %%size=300%% %%align=center%% This week Camsoft hosts CNC Professional training for Ayce...