beautypg.com

Smithy CNC Mills User Manual

Page 9

background image

1.3.1 Number

The following rules are used for (explicit) numbers. In these rules a digit is a single

character between 0 and 9.

* A number consists of (1) an optional plus or minus sign, followed by (2) zero to

many digits, followed, possibly, by (3) one decimal point, followed by (4) zero to

many digits - provided that there is at least one digit somewhere in the number.

* There are two kinds of numbers: integers and decimals. An integer does not have

a decimal point in it; a decimal does.

* Numbers may have any number of digits, subject to the limitation on line length.

Only about seventeen significant figures will be retained, however (enough for all

known applications).

* A non-zero number with no sign as the first character is assumed to be positive.

Notice that initial (before the decimal point and the first non-zero digit) and trailing

(after the decimal point and the last non-zero digit) zeros are allowed but not

required. A number written with initial or trailing zeros will have the same value

when it is read as if the extra zeros were not there.

Numbers used for specific purposes in RS274/NGC are often restricted to some

finite set of values or some to some range of values. In many uses, decimal num-

bers must be close to integers; this includes the values of indexes (for parameters

and carousel slot numbers, for example), M codes, and G codes multiplied by ten. A

decimal number which is supposed be close to an integer is considered close

enough if it is within 0.0001 of an integer.

1.3.2 Parameter Value

A parameter value is the pound character # followed by a real value. The real value

must evaluate to an integer between 1 and 5399. The integer is a parameter

number, and the value of the parameter value is whatever number is stored in the

numbered parameter.

The # character takes precedence over other operations, so that, 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 the parameter whose index is the (integer) value of parameter 2.

SmithyCNC Programmer’s Reference Manual: Language Overview

1-5