Storing result of computation – ACU-RITE CNC 3500i User Manual

Page 430

Advertising
background image

404

11 G-Code Edit, Help, & Advanced Features

1

1

.4 A

d

v

a

nced Pr

ogr

a

mming

Example 2 contains two levels of indirection (N219) and shows how
the contents from multiple variables can be assigned to a command or
expression.

At Block N215, variable #119 is set to constant 100.

At Block N217 one is added to the contents of variable #119.

At Block N218 variable #120 is set to constant 119.

Block N219 moves the X-axis to the position contained in variable
#120 via two levels of indirection. The first level is the content of
variable #119. The second level is the content of variable #101,
which is incremental in the loop at Block N217 to introduce the
contents of variables #102, #103 and #104.

The X-axis moves to X1; X2; X3; and X4.

Storing Result of Computation

When a mathematical expression is programmed, variables on the left
side of an equation store the computed result.

N250 #110 = #20 + #35

N260 #120 = #18 / 2

At N250, #110 contains the sum of the contents of #20 and #35. At
N260, #120 contains the result of the contents of #18 divided by 2.

Parentheses establish an order of operations or denote special
functions.

N300 #140 = (#11 * #115) / 2

N310 #141 = sin (45)

N320 #142 = (#141 * #140) ; * #142 is shortest side

Multiplication operations must be in parentheses or the
3500i treats the multiply command (*) as a comment sign
and disregards the rest of the line following the sign (*).

Advertising