Fanuc controls allow the use of null (undefined) variables. They evaluate to 0 (zero) in some situations and, in others, to nothing. We find this behavior unsafe and confusing, and therefore we ask our users to always give variables a defined value before using them.
Example:
#100 = 10
G00 X#100 Y#101
This will make a Fanuc ignore the Y value as #101 has not been defined (is NULL). In the simulator, you will see the following alarm message.
To fix this, just make sure to assign a value to any variable you are using in the program.
The only time we allow uninitialized variables in the simulator is when comparing them to #0 (see Conditional Expressions). In this way, as #0 always is NULL, you can check if a variable is initialized or not before using it.
Example of allowed use of a NULL variable:
IF[#501EQ#0] THEN #501=0
This block will set variable number 501 to 0 if it is not already initialized. This is useful with permanent variables to see if they have been initialized by a previous program or manually.
Please note that the #0 variable has to be the last variable in the expression. This will not work:
IF[#0EQ#501] THEN #501=0