Safety commands – by our definition here – are a series of commands placed at the beginning of all programs that confirm that the machine is in the appropriate states. When you first power up the machine, certain G codes are initialized. And in most cases, the safety commands will ensure that the machine is in its initialized states.
For example, when you turn on the machine it will automatically instate your measurement system of choice. If you work in the Imperial measurement system, G20 will be automatically instated (initialized). If you work in the Metric measurement system, the machine will automatically instate G21.
Even so, it is wise to include the appropriate measurement-system-mode instating G code at the beginning of all programs. Doing so will ensure that the machine is still in this measurement system mode when the program is run.
Consider, for example, not including a G21 at the beginning of a Metric program. The programmer is assuming that the machine is in the Metric mode when the program is run. But maybe someone went into manual data input [MDI] and switched to the inch mode to make some manual movements. And they forgot to reselect the metric mode. Oops.
In this case the machine will interpret the very large Metric values as inch values (a fixture offset setting of -185.234 mm will be taken as -185.234 inches). This will cause the machine to make a much longer approach movement than is intended – and could will cause a crash if the operator doesn’t catch it. This is but one example of when the machine could behave badly if no safety commands are present in the program.
Here is our recommended set of safety commands for machining centers (inch mode). Note that we have included only three G codes per command because many (especially older) controls do not allow more than three per command.
O0001 (Safety commands example for machining centers)
N001 G17 G20 G23
N002 G40 G64 G67
N003 G80 G90 G98
Here are the safety commands for turning centers:
O0001 (Safety commands example for turning centers)
N001 G20 G23 G40