NAMED PARAMETERS REFERENCE

NAMED PARAMETERS REFERENCE

Named parameters work like numbered parameters, but are easier to read and remember. All parameter names are converted to lowercase and have spaces and tabs removed. Named parameters must be enclosed with < > marks.

# is a local named parameter. By default, a named parameter is local to the scope in which it is assigned.

You can’t access a local parameter outside of its subroutine. This is so two subroutines can use the same parameter names without fear of one subroutine overwriting the values in another.

#<_global named parameter here> (i.e., name starting with an underscore) is a global named parameter. They are accessible from within called subroutines and may set values within subroutines that are accessible to the caller. As far as scope is concerned, they act just like regular numeric parameters. They are not made persistent by storage in a file.

The global parameters _a, _b, _c, . . . _z are reserved for special use. Do not use these parameters.

EXAMPLES

  • #<_endmill_dia> = 0.049 is a declaration of named global variable.
  • #<_endmill_rad> = [#<_endmill_dia>/2.0] is a reference to previously declared global variable.
  • o100 call [0.0] [0.0] [#<_inside_cutout>-#<_endmill_dia>] [#<_Zcut>] [#<_feedrate>] is mixed literal and named parameters.

SUBROUTINE PARAMETERS REFERENCE

SUBROUTINE PARAMETERS REFERENCE

Subroutine parameters are specifically reserved for call arguments. By definition, these are parameters #1-#30 and are local to the subroutine.

NUMBERED PARAMETERS REFERENCE

NUMBERED PARAMETERS REFERENCE

A numbered parameter is recognized by the pound symbol (#) followed by an integer between 1 and 5399. The parameter is referred to by this integer, and its value is whatever number is stored in the parameter. A value is stored in a parameter with the (=) operator.

Example: #3 = 15 (set parameter 3 to 15)

A parameter setting does not take effect until after all parameter values on the same line have been found. For example, if parameter 3 has been previously set to 15 and the line: #3=6 G01 X#3 is interpreted, a straight move to a point where X = 15 occurs before the value of parameter 3 is set to 6.

The # symbol takes precedence over other operations. For example, #1+2 means the number found by adding 2 to the value of parameter 1, not the value found in parameter 3. Of course, #[1+2] does mean the value found in parameter 3.

The # character may be repeated; for example ##2 means the value of parameter whose index is the (integer) value of parameter 2. PathPilot maintains a number of read-only parameters. Only parameters for the relevant axes are maintained: (X Y Z A) for mill and (X Z) for mill. The remaining parameters for unused axes are undefined.

READ-ONLY PARAMETERS

  • 1-30: Subroutine local parameters of call arguments. These parameters are local to the subroutine. For further information, see Programming with Subroutines later in this chapter
  • 31-5000: G-code operator parameters. These parameters are global in G-code file
  • 5061-5070: Result of G38.2 probe (X Y Z A B C U V W)
  • 5161-5169: G28 home for (X Y Z A B C U V W)
  • 5181-5189: G30 home for (X Y Z A B C U V W)
  • 5210: 1 if G92 offsets are active, 0 if not
  • 5211-5219: G92 offset (X Y Z A B C U V W)
  • 5220: Current coordinate system number 1-9 for G54 – G59.3
  • 5221-5230: Coordinate System 1, G54 (X Y Z A B C U V W R) – R denotes XY rotation angle around Z-axis
  • 5241-5250: Coordinate System 2, G55 (X Y Z A B C U V W R)
  • 5261-5270: Coordinate System 3, G56 (X Y Z A B C U V W R)
  • 5281-5290: Coordinate System 4, G57 (X Y Z A B C U V W R)
  • 5301-5310: Coordinate System 5, G58 (X Y Z A B C U V W R)
  • 5321-5330: Coordinate System 6, G59 (X Y Z A B C U V W R)
  • 5341-5350: Coordinate System 7, G59.1 (X Y Z A B C U V W R)
  • 5361-5370: Coordinate System 8, G59.2 (X Y Z A B C U V W R)
  • 5381-5390: Coordinate System 9, G59.3 (X Y Z A B C U V W R)
  • 5399: Result of M66 – check or wait for input
  • 5400: Current tool number
  • 5401-5409: Tool offset (X Y Z A B C U V W)
  • 5410: Current tool diameter
  • 5411: Current tool front angle
  • 5412: Current tool back angle
  • 5413: Current tool orientation
  • 5420-5428: Current position including offsets in current program units (X Y Z A B C U V W)

PARAMETERS REFERENCE

PARAMETERS REFERENCE

The RS274/NGC language supports parameters. Parameters are analogous to variables in other programming languages. PathPilot maintains an array of 10,320 numerical parameters. Many of them have specific uses. The parameters that are associated with fixtures are persistent over time. Other parameters are undefined when the operating system is loaded. The parameters are preserved when the interpreter is reset. Parameters 1 to 1000 can be used by the code of part-programs.

There are several types of parameters of different purpose and appearance. The only value type supported by parameters is floating-point; there are no string, Boolean or integer types in G-code like in other programming languages. However, logic expressions can be formulated with Boolean operators (AND, OR, XOR, and the comparison operators EQ, NE, GT, GE ,LT, LE), and the MOD, ROUND, FUP and FIX operators support integer arithmetic.

PARAMETER SYNTAX

There are three types of parameters, numbered, named local, and named global. The type of the parameter is defined by its syntax:

  • Numbered – #4711
  • Named local – #
  • Named global – #<_globalvalue>

PARAMETER SCOPE

The scope of a parameter is either global or local within a subroutine. The scope of each parameter is inferred from its syntax. Subroutine parameters and named local parameters have local scope. Named global parameters and all numbered parameters starting from #31 are global in scope. RS274/NGC uses lexical scoping. In a subroutine, only the local parameters defined therein and any global parameters are visible. The local parameters of a calling procedure are not visible in a called procedure.

BEHAVIOR OF UNINITIALIZED PARAMETERS

Uninitialized global parameters and unused subroutine parameters return the value zero when used in an expression. Uninitialized named parameters signal an error when used in an expression.

PARAMETER MODE

The mode of a parameter can either be read/write or read-only. Read/write parameters may be assigned values within an assignment statement. Read-only parameters cannot be assigned values. They may appear in expressions, but not on the left-hand side of an assignment statement.

PERSISTENCE AND VOLATILITY

Parameters can either be persistent or volatile. When the operating system is powered off, volatile parameters lose their values and are reset to zero. The values of persistent parameters are saved in a disc file and restored to their previous values when the operating system is powered on again. All parameters except numbered parameters in the current persistent range (5163 to 5390) are volatile.

INTENDED USAGE

Numbered parameters in the range #31-#5000, named global, and local parameters are available for general-purpose storage of floating-point values, like intermediate results, flags, etc., throughout program execution. They are read/write (can be assigned a value). Subroutine parameters, numbered parameters #1-#30, and system parameters are read-only and not available for general use. Subroutine parameters are used to hold the actual parameters passed to a subroutine. Numbered parameters in the range of #1-#30 are used to access offsets of coordinate systems. System parameters are used to determine the current running version and are read-only.

ADVANCED PROGRAMMING

ADVANCED PROGRAMMING

Parameter and expression programming language features are not used in common G-code application (hand coding), G-code created by PathPilot conversational programming, or the majority of third-party CAM-programming systems.

There are significant differences between controls in the way parameters work. Do not assume that code from another control works in the same way with the operating system. We don’t recommend writing parametric G-code — i’ts difficult to debug, and difficult for another operator to understand. Modern CAM virtually eliminates the need for it.

Read the following sections for reference:

CHANGE TOOL NUMBER (T)

CHANGE TOOL NUMBER (T)

It’s your responsibility to make sure that the carriage is in a safe place for changing tools (for example, by using G30). This allows optimization of motion which can save time. A pause for manual intervention can always be provided by an M00 or M01 before the tool change.

TROUBLESHOOTING

It’s an error if:

  • A negative T number is used
  • A T number larger than 54 is used

SPINDLE SPEED (S)

SPINDLE SPEED (S)

To set the speed in revolutions per minute (rpm) of the spindle, program: S~

The spindle turns at the commanded speed when it has been programmed to start turning. It’s okay to program an S word whether the spindle is turning or not. If the speed override switch is enabled and not set at 100 percent, the speed is different from what is programmed. It’s okay to program S0, but the spindle does turn if that is done.

TROUBLESHOOTING

It’s an error if:

  • The S number is negative

FEED RATE (F)

FEED RATE (F)

To set the feed rate, program: F~

Depending on the setting of the feed mode toggle, the rate may be in units-per-minute or units-per-rev of the spindle. The units are those defined by the G20/G21 mode. The feed rate may sometimes be overridden.