EasyManua.ls Logo

Tormach 1500MX - Programming Overview; About G-Code Programming Language; G-Code Formatting Reference; Line Numbers

Tormach 1500MX
288 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
9.1 PROGRAMMING OVERVIEW
Read the following sections for a G-code overview:
9.1.1 About G-Code Programming Language 172
9.1.2 G-Code Formatting Reference 172
9.1.3 Supported G-Codes Reference 176
9.1.1 About G-Code Programming Language
A G-code program is made up of one or more lines of code.
Each line of code is called a block, and can include commands
to the machine. Blocks are collected into a file, which makes a
program.
A block is normally made up of an optional line number at the
beginning, followed by one or more words, which groups the
elements together into a single statement.
A word is a letter followed by a number (or, something that
evaluates to a number). A word can either give a command or
provide an argument to a command.
A program is one or more blocks, each separated by a line
break. Blocks in a program are executed either:
l Sequentially (from the top of the program to the
bottom)
l Until an end command (M02 or M30) is encountered
E X A M P L E :
G01 X3 is a valid line of code with two words:
l G01 is a command: the machine should move in a
straight line at the programmed feed rate.
l X3 provides an argument value: the value of X
should be 3 at the end of the move.
Most commands start with either G (general) or M
(miscellaneous) — G-codes and M-codes.
There are two commands (M02 and M30) that end a program.
A program can end before the end of a file. If there are lines in
a file after the end of a program, they're not meant to be
executed in the normal flow (they're generally parts of
subroutines).
9.1.2 G-Code Formatting Reference
A permissible block of input code is made up of the following
programming elements, in order, with the restriction that
there is a maximum of 256 characters allowed on a line:
1. (Optional) Block delete character (/)
2. (Optional) Line number
3. Any number of words, parameter settings, and
comments
4. End of line marker (carriage return or line break)
Programs are limited to 999,999 lines of code.
Spaces and tabs are allowed anywhere on a line of code and
do not change the meaning of the line, except inside
comments. Blank lines are allowed in the input, but they're
ignored. Input is not case sensitive (except in comments), so
any letter outside a comment may be in uppercase or
lowercase without changing the meaning of a line.
E X A M P L E
G00 x +0. 12 34y 7 is equal to G00 x+0.1234
y7
A line may have:
l Any number of G words, but two G words from the same
modal group may not appear on the same line.
l Zero to four M words, but two M words from the same
modal group may not appear on the same line.
l For all other legal letters, a line may have only one word
beginning with that letter.
Any input not explicitly allowed is illegal, and causes the
interpreter to either signal an error or ignore the line.
PathPilot omits blocks of code that are prefixed with a block
delete character (/).
PathPilot sometimes ignores things it doesn't understand. If a
command doesn't work as expected, or does nothing, make
sure that it's correctly typed. PathPilot doesn't check for
excessively high machining feeds or speeds, and it doesn't
detect situations where a legal command will do something
unfortunate (like machining a fixture).
Line Numbers
A line number is indicated by the following, in the order listed:
1. The letter N
2. An integer (with no sign) between 0 and 99,999,999
(which must be written without commas)
Line numbers may be repeated, or used out of order, but that's
rare in normal practice. A line number isn't required, and is
often omitted.
Words
A word is indicated by the following, in the order listed:
©Tormach® 2024
Specifications subject to change without notice.
Page 172 UM10811: 1500MX Operator's Manual (Version 0424A)
For the most recent version, see tormach.com/support
9: PROGRAMMING

Table of Contents