RS274NGC makes provision for the inclusion of variables in the numeric part of program words. Variables can be named with any number up to 5399. You can access the value of a variable in a gcode program by placing a hash (#) sign before the number/name of the variable that you want to reference. Often in the EMC literature the terms variables and parameters are used to refer to the same thing.
For those who learned part programming on older machine tool controls, the inclusion of variables makes for some strange looking program blocks. But variables can be very useful programming tools. This unit develops the concepts of variables as a gcode programming tool and applies them to five common milling tasks.
Before we begin, you need to understand that the NGC development defined a lot of variables and how they should be used in machine control. But the EMC and its interpreter only takes advantage of a few of these variables and those only for its built in coordinate system. You can see which ones, all in the 5000 + range if you view the emc.var or generic.var files shipped with EMC. A typical variable file is listed below. We will add and use several variables that do not have predefined functions in the EMC.
Format is:
<variable> <value>
<variable> runs from 1 to 5399 inclusive, <value> is a number.
Units for <value> are INCHES, the default units for RS-274-NGC.
Lines not of that form, or blank lines, are considered comments. Don't
enter a line beginning with two numbers unless you mean it.
You can put whatever you want in here as user variables, but some
are reserved. See the RS-274-NGC manual for the reserved variables.
This file is loaded into the interpreter at the beginning, and dumped
from the controller at the end.
Only variables you put explicitly in here will be dumped out from
the interpreter.
Axes offsets for G92
5211 0.000000 5212 0.000000 5213 0.000000
Coordinate system for G54 - the default used at start
Coordinate system for G55
Coordinate system for G56
Coordinate system for G57
Coordinate system for G58
Coordinate system for G59
Coordinate system for G59.1
Coordinate system for G59.2
Coordinate system for G59.3
|