G-code structure
According to ISO 6983-1, G-code is defined by sets, which in turn consist of one or more words. A set 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 an expression (e.g. X200, F=1000). Each word is assigned a function, whereby the address letters G for path conditions, M for additional functions, and N for the set number have a special meaning in the G-code program. Depending on the function to be executed, one or more address letters must be present in a set.
The address letters define the function associated with a letter. The initial syntax of the address letters can be customized in the Configuration of address characters configuration menu. An explanation of the functions included in ISO 6983-1 can be found in 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 that start or stop an action of the machine or control, such as "cooling water on/off". The set numbers define which position is assigned to a G-code set in the program. In modern numerical controls, the set 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 set
Examples of typical set structures:
N10 G1 X200 Y300 ; Comment
N20 X300 Y300 F=1000 ; Comment