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.

PARAMETERS REFERENCE