1 local parameter assignments – Rockwell Automation 8520-GUM 9/Series CNC Grinder Operation and Programming Manual Documentation Set User Manual

Page 657

Advertising
background image

Paramacros

Chapter 20

20-13

The following subsections cover these different types of parameters
independently. This does not mean that they are not interchangeable in the
same macro program. Mixing the different types of parameters in the same
paramacro is acceptable.

Local parameters are #1 - #33. There are 5 sets of local parameters. The
first set is reserved for use in the main program and any subprogram called
by that main program with an M98. The remaining four sets are for each
nested level of macro (4 levels of nesting maximum).

Assigned parameter values are specific to the individual macro nesting
levels. Local parameters are assigned as described on page 20-39.

Local parameters are used in a specific macro to perform calculations and
axis motions. After their initial assignment, these parameters can be
modified within any macro at the same nesting level. For example macro
O11111 called from a main program has 33 local parameter values to work
with (#1 to #33). All macros called from the main program, and nested at
the same level, use the same local parameters with the same values unless
they are initialized in that macro.

For example macro O11111 called from a main program assigns a value to
#1 = 1 and the macro returns execution to the main program with an M98.
Later in the same main program (before executing an M99, M02, or M30)
macro O11111 is called from the main program again. The value assigned
to #1 (=1) remains from the previous macro that executed at that nesting
level.

Important: Any local variables you intend to use in a macro we
recommend you initialize them before you start using them unless you
require values passed from a macro at the same nesting level. In our
example above where macro O11111 assigns #1=1. The value of #1 is
carried to any macro that is nested at the same nesting level. If for
example after macro O11111 returns control to the main program a
different macro O22222 is called, the same set of local variables is
assigned to O11111 and O22222 because they are both nested at level 1.
Confusion could be prevented if before macro O22222 uses #1 it initializes
that variable using #1 = 0. All local variables are reset to zero when the
control executes an end of program block (M99, M02, or M30).

20.3.1
Local Parameter
Assignments

Advertising