G-codes Info
Sections:
Description of the code structure
G-code - conditional naming of the programming language of devices with numerical program control (CNC), consisting of lines in which various control commands are written.
A program consists of lines called frames. One line is one frame. Each block contains one or more commands and can have an explicitly specified number starting with the letter N. The program ends with the M30
command, after which execution stops and all subsequent lines are ignored.
Comments on the program are placed in parentheses. A comment can be placed both on a separate line, and after program codes. It is not permissible to write as a comment several lines covered by a pair of parentheses.
Commands in each frame are executed simultaneously, so the order of commands in the frame is not strictly specified, but it is traditionally assumed that preparatory commands are indicated first (for example, choosing a work plane, movement speeds along axes, etc.), then setting movement coordinates, then choosing processing modes and technology teams.
Coordinates are specified by specifying an axis followed by a numerical value for the coordinate. The integer and fractional parts of the coordinate number are separated by a decimal point, for example: Y0.5 and Y.5, Y77, Y77. and Y077.0.
There are so-called modal and non-modal commands. Modal commands change some parameter/setting and this setting affects all subsequent program blocks until they are replaced by the next modal command. Modal commands, for example, include tool movement speeds (F), spindle speed control (S), coolant supply, and many G-commands (G0, G1, G90 etc.). Non-modal commands, for example, G53, operate only inside their containing frame.
The code interpreter remembers the value of the entered parameters and settings until they are changed by the next modal command or the previously entered modal command is canceled, so it is not necessary to indicate, for example, the speed of the tool in each frame.