Rockwell Automation 8520 9/Series CNC Lathe User Manual

Page 687

Advertising
background image

Paramacros

Chapter 28

28-13

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 M99.

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 (M02 or M30) or a program

restart code (M99 in a main program).

Considerations for Local Parameters

When assigning values to local parameters, remember:

All local variable assignments are reset to zero any time the control
reads an M02 or M30 in a part program or an M99 in a main program.

All local variable assignments are reset to zero any time that power is
turned on, the control is reset, or an E-STOP reset operation is executed.

If more than one I,J, or K set is programmed in an argument, use
NO TAG (B) on page 28-35 for the parameter assignment.

Advertising