Syntax

According to ISO 6983-1, the structure of the G-code is defined by blocks, which in turn consist of one or more words. A block is ended by a line break. Words consist of an address letter (e.g. X, Y, Z, G, M, N) and a key number (e.g. G4) or expression (e.g. X200, F=1000). Each word is assigned a function, with the address letters G for path conditions, M for additional functions and N for the block number taking on special significance in the G-code program. Depending on the function to be executed, one or more address letters must be in a block.

The address letters define the function associated with a letter. The initial syntax of the address letters can be customized in the configuration menu Configuration address characters for the specific user. An explanation of the functions included in ISO 6983-1 can be found in the chapter Supported address letters. The path conditions define the operating mode of a machine or controller, such as interpolation mode or path control mode. The additional functions are switching functions which start or stop an action of the machine or control, such as "cooling water on/off". The block numbers define which position is assigned to a G-code block in the program. In modern numerical controls, the block numbers usually no longer have the function of determining the execution sequence and are used more for clarity and structuring of a G-code program. The interpretation of address letters, especially path conditions and additional functions, can change depending on the G-code dialect used. Comments are introduced by a character defined for each G-code dialect and are usually placed at the end of a block

Examples of typical block structures:

N10 G1 X200 Y300 ; Comment

N20 X300 Y300 F=1000 ; Comment