[Home]User Defined Gcodes

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Showing revision 8
(see also: CannedCycleProposal)

User Defined Gcode (by lerman)

This page contains a proposed mechanism for user/integrator defined gcodes (and mcodes). The term user and integrator are used interchangeably for now as are gcode and mcode.

A user defined gcode is declared in the .ini file by a stanza like (subject to change)

[gcode]
G31
G1
G2.2
G2
M10
AJ: maybe have it like "G31=/path/to/g31.ngc"
Each of the above lines declares that the corresponding gcode will be handled by a subroutine of the same name (times ten); eg, O<G310>, O<G10>, O<G22>, etc. If there is already a "hardwired" gcode with that number, it may be accessed by adding 1000 to the gcode time ten. So, the original G1 will be accessed as G1010, the original M10 will be accessed as M1100, etc.

A Subroutine For User Defined Gcode

Within a user defined gcode subroutine, special named parameters are accessible.

Consider adding:

This would let the programmer write things like [#<__A> OR #<__X>] to create a mask indicating that A and X are required.

AJ: I suggest a different approach:

Additional commodity functions would be present:


Order Of Execution

Gcodes (and mcodes) are executed in the same order as they would have been executed if they were hard implemented gcodes or mcodes. The same rules concerning modal groups, etc are enforced.


Some Infrastructure

After a user defined gcode routine determines that some parameters are missing, it should call:

O<GmissingWord> call [10] [#<missing>] [#<extra>]

In this case, 10 is ten times the gcode number (1) and missing is a parameter with mask bits for the missing parameters. This subroutine will print messages describing the problem and then exit. A similar routine MmissingWord? should be called from mcode subroutines detecting errors.


LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions | View current revision
Edited May 26, 2008 8:20 pm by Alex Joni (diff)
Search:
Published under a Creative Commons License