Errors in G-Code

Error reporting is also performed for G-Code. This reporting includes compile-time errors and runtime errors. Runtime error reporting includes invalid use of G-Code, e.g. like a bad definition for a circle.

Example:

In the following example the value of a string variable str is assigned to the address letter X of the G-Code block. As before the position of the error is precisely identified at ‘=str’ in the code. In addition, the programmed type and the expected type are reported.

FILE aaa.nc:

{
VAR
    str : string := 'Hello World';
END_VAR
}

G01 X=str F6000
G01 Y100
M02

Error message:

7.5-7.9: Invalid implicit conversion from type 'string[255]'
to 'lreal'

Example:

In the following example a sequence of circular arcs is processed by a FOR-loop. The radius of the arc is 4. The distance between the starting-point and endpoint of the arc is successively increased within each iteration. During the 9th iteration the distance exceeds the circle diameter of 8. The reported error message identifies the origin G2 X=i*10+i U4 and gives information about the diameter and distance between starting-point and endpoint.

FILE aaa.nc:

{
VAR
    i : INT;
END_VAR

!G00 X0 Y0 Z0
FOR i := 1 TO 10 DO
    !G01 X=i*10 F6000
    !G02 X=i*10+i U4
END_FOR;
}
M02

Error Message:

aaa.nc: 9.4-10.1: Invalid definition of circle. Distance
between start-point and end-point (=9.000000) is larger than
diameter (=8.000000).