114
2 Variable Techniques Understanding variable s Variables in custom ma cro B Presentation links page for lesson two Argument s Local variab les Common variable s Permanent common varia bles System variab les

2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Embed Size (px)

Citation preview

Page 1: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

2 Variable Techniques

Understanding variablesVariables in custom macro B

Presentation links page for lesson two

Arguments Local variables Common variablesPermanent common variables System variables

Page 2: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Introduction To Variables

25 31 56Jar A Jar CJar B

Jar C = Jar A + Jar B

Jar A = 25 Jar B = 31

Variables are like storage containers for numbers

Page 3: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Introduction To Variables

Provide storage for numbersHave no meaning until usedAre used in arithmetic expressionsCan represent just about anything

Of course, we’re not storing values in jars!

Variables:

Page 4: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Introduction To Variables

Tool 4

?

Offsets:1234567

00.000000.000000.000000.000000.000000.000000.0000

5.48765.4876

G43 H04 Z0.1

Offsets are a kind of variable…

Tool length is unknown while programmingDuring setup, length is measuredOffset value is entered after measurementCommand in program invokes offset value

Tool lengthCutter radiusWear offsetTool nose radius

Offsets can only represent:

Offsets usage is rather limitedBy comparison, variables can be used to represent just about anything!

Page 5: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Introduction To VariablesSay you must mill a slot in several workpieces

Page 6: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Introduction To VariablesBut the width of each workpiece varies

Page 7: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Introduction To VariablesBut the width of each workpiece varies

As does the position and depth

With parametric programming,

variables can be used to represent

these workpiece attributes

Page 8: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Variable Types

ArgumentsLocal variablesCommon variablesPermanent common variablesSystem variables

There are five kinds of variables in custom macro B

Let’s begin with arguments

Page 9: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Custom Macro B Arguments

What is an argument?Definition:

An argument is a piece of data needed by the custom macro

program (input data)

Arguments allow you to get data in to the custom macro

Page 10: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Custom Macro B Arguments

G65 P1000 A45. R2. H8. D.75

Call custom macro

Input data (arguments)

One form of argument in custom macro includes letters of the alphabet

Page 11: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

For reasons we’ll describe later, avoid I, J, & K

Custom Macro B Arguments

A B C D E F H

I J K M Q R S

T U V W X Y Z

Argument assignment number one:

Not allowed: G, L, N, O, & P

Allowable letters of the alphabet

Page 12: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Custom Macro B Arguments

X

Y

ZD

H

An example: Choose logical representations:

H for holeD for depthX for X positionY for Y positionZ for Z position

Page 13: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Custom Macro B Arguments

X

Y

ZD

H

An example: Choose logical representations:

H for holeD for depthX for X positionY for Y positionZ for Z position

G65 P1000 X2.0 Y2.0 Z0 D0.25 H2.5Call custom macro

ArgumentsArgument assignment number

one is, by far, the more popular

form of argument assignment

Page 14: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Custom Macro B Arguments

Argument assignment number two:

A B C I J K I J K I J K

I J K I J K I J K I J K

I J K I J K I J K

This form of argument

assignment is seldom used

A, B, C, and ten sets of I, J, and K are allowed

Page 15: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Custom Macro B Arguments

O1000G00 XX ???

G65 P1000 X2.0 Y2.0 Z0 D0.25 H2.5

Arguments within a custom macro cannot be referenced by their letters

The control would confuse many letters

with their normal CNC functions

Within the custom macro, arguments

must be referenced with pre-

determined local variables…

Page 16: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Variable Types

ArgumentsLocal variablesCommon variablesPermanent common variablesSystem variables

Page 17: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Custom Macro B Local Variables

##1 : Variable number 1#100 : Variable number 100#500 : Variable number 500

In custom macros, all variables are specified with a pound sign

Page 18: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Custom Macro B Local Variables

Represent arguments

Reference temporary valuesThe primary application for local variables

is to reference the values of arguments

coming from a G65 command

Local variables are used to:

Primary use

Page 19: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Custom Macro B Local Variables

#1:#2:#3:#4:#5:#6:#7:#8:#9:

#10:#11:#12:#13:#14:#15:#16:#17:#18:

#19:#20:#21:#22:#23:#24:#25:#26:

Local variables range through #33

The default state of local variables

is vacant (having no value)

Local variables are set back to

vacant as the custom macro

ends (with M99)

Page 20: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Custom Macro B Local Variables

A:#1 B:#2 C:#3 D:#7 E:#8 F:#9 H:#11

I:#4 J:#5 K:#6 M:#13 Q:#17 R:#18 S:#19

T:#20 U:#21 V:#22 W:#23 X:#24 Y:#25 Z:#26

Argument assignment number one:

Each argument letter has a

pre-assigned local variable!

A chart for arguments and local variables is in the lesson text

Page 21: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Custom Macro B Local Variables

G65 P1000 X2. Y2.5 Z0 D.25 H3.

1) Set values of local variables

A G65 command does two things:

Example of argument assignment…

X:#24, Y:#25, Z:#26, D:#7, H:#11

Page 22: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Custom Macro B Local Variables

#1:#2:#3:#4:#5:#6:#7:#8:#9:

#10:#11:#12:#13:#14:#15:#16:#17:#18:

#19:#20:#21:#22:#23:#24:#25:#26:

02.000002.500000.0000

03.0000

00.2500

Page 23: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Custom Macro B Local Variables

G65 P1000 X2. Y2.5 Z0 D.25 H3.

1) Set values of local variables2) Execute program 01000

Example of argument assignment…

Page 24: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Custom Macro B Local Variables

Nesting:Main:

O0001..G65P1001 X2. Y2.5..M30

Level 1:O1001..G65P1002 X5. Y7...M99

Level 2:O1002...M99.

You can call one custom macro from another

Page 25: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

#1:#2:#3:#4:#5:#6:#7:#8:#9:

#10:#11:#12:#13:#14:#15:#16:#17:#18:

#19:#20:#21:#22:#23:#24:#25:#26:

02.000002.5000

Custom Macro B Local VariablesLocal variables #24 & #25 set from program O0001

Page 26: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Nesting:Main:

O0001..G65P1001 X2. Y2.5..M30

Level 1:O1001..G65P1002 X5. Y7...M99

Level 2:O1002...M99.

Custom Macro B Local Variables

Page 27: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

#1:#2:#3:#4:#5:#6:#7:#8:#9:

#10:#11:#12:#13:#14:#15:#16:#17:#18:

#19:#20:#21:#22:#23:#24:#25:#26:

05.000007.0000

Custom Macro B Local VariablesLocal variables #24 & #25 set from program O1001

Page 28: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Nesting:Main:

O0001..G65P1001 X2. Y2.5..M30

Level 1:O1001..G65P1002 X5. Y7...M99

Level 2:O1002...M99.

Custom Macro B Local Variables

Page 29: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

#1:#2:#3:#4:#5:#6:#7:#8:#9:

#10:#11:#12:#13:#14:#15:#16:#17:#18:

#19:#20:#21:#22:#23:#24:#25:#26:

02.000002.5000

Custom Macro B Local VariablesLocal variables #24 & #25 set from program O0001

Page 30: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Nesting:Main:

O0001..G65P1001 X2. Y2.5..M30

Level 1:O1001..G65P1002 X5. Y7...M99

Level 2:O1002...M99.

Custom Macro B Local Variables

Page 31: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

#1:#2:#3:#4:#5:#6:#7:#8:#9:

#10:#11:#12:#13:#14:#15:#16:#17:#18:

#19:#20:#21:#22:#23:#24:#25:#26:

Custom Macro B Local VariablesLocal variables #24 & #25 set back to vacant

Page 32: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Nesting:Main:

O0001..G65P1001 X2. Y2.5..M30

Level 1:O1001..G65P1002 X5. Y7...M99

Level 2:O1002...M99.

Custom Macro B Local Variables

Page 33: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment ExampleMill left side of any workpiece

Full example

Page 34: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment ExampleMill left side of any workpiece

Full example

Page 35: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment ExampleMill left side of any workpiece

Full example

Page 36: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

Z

H

Y

T

D

O0001N005 G54 G90 S300 M03N010 G00 X0 Y0N015 G43 H01 Z0.1N020 G65 P1000 X0 Y0 Z0 H2. T1. D1.0 F4.N025 G91 G28 Z0 M19N030 M01..

X

F - Feedrate

Mill left side of any workpiece

Full example

Page 37: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

Z

H

T

O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99

Y

D

#11

#26

#9

#25

#7

#20

F - FeedrateX#24

Mill left side of any workpiece

Full example

Page 38: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Z

H

T

O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99

Y

D

#11

#26

#9

#25

#7

#20

#24

F - FeedrateX

Argument Assignment ExampleMill left side of any workpiece

Full example

Page 39: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

Z

H

T

O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99

Y

D

#11

#26

#9

#25

#7

#20

#24

F - FeedrateX

Mill left side of any workpiece

Full example

Page 40: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

Z

H

T

O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99

X

Y

D

#11

#26

#9

#25

#7

#20

#24

F - Feedrate

Mill left side of any workpiece

Full example

Page 41: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

Z

H

T

O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99

X

Y

D

#11

#26

#9

#25

#7

#20

#24

F - Feedrate

Mill left side of any workpiece

Full example

Page 42: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

Z

H

T

O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99

Y

D

#11

#26

#9

#25

#7

#20

#24

F - FeedrateX

Mill left side of any workpiece

Full example

Page 43: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

Z

H

T

O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99

Y

D

#11

#26

#9

#25

#7

#20

#24

F - FeedrateX

Mill left side of any workpiece

Full example

Page 44: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

Z

H

T

Y

D

O0001N005 G54 G90 S300 M03N010 G00 X0 Y0N015 G43 H01 Z0.1N020 G65 P1000 X0 Y0 Z0 H2. T1. D1.0 F4.N025 G91 G28 Z0 M19N030 M01..

#11

#26

#9

#25

#7

#20

#24

F - FeedrateX

Mill left side of any workpiece

Full example

Page 45: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

Z

H

T

O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99Y

D

#11

#26

#9

#25

#7

#20

#24

F - FeedrateX

Minimizing redundant calculations

Full example

Page 46: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

Z

H

T

O1000#27 = #7/2G00 X[#24- #27] Y[#25- #27 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #27] F#9G00 Z[#26 + 0.1]M99

Y

D

#11

#26

#9

#25

#7

#20

#24

F - FeedrateX

Minimizing redundant calculations

If you wish to use local variables for

temporary calculations, use those

from #26-#33 to keep from

overwriting a needed variable!

Full example

Page 47: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment ExampleTapping on a turning center

Another example

Page 48: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment ExampleTapping on a turning center

Another example

Page 49: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment ExampleTapping on a turning center

Another example

Page 50: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

F

Z R

O0001N005 G00 T0101N010 G97 S500 M03N015 G65 P1001 R.2 Z-1. F.0625N020 G00 X6.0 X5.0N025 M01..

Tapping on a turning center

Another example

Page 51: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

F

Z R

#9

#26 #18

O1001G00 X0 Z#18G32 Z#26 F#9M04G32 Z#18 F#9M03M99

Tapping on a turning center

Another example

Page 52: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

F

Z R

#9

#26 #18

O1001G00 X0 Z#18G32 Z#26 F#9M04G32 Z#18 F#9M03M99

Tapping on a turning center

Another example

Page 53: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

F

Z R

#9

#26 #18

O1001G00 X0 Z#18G32 Z#26 F#9M04G32 Z#18 F#9M03M99

Tapping on a turning center

Another example

Page 54: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

F

Z R

#9

#26 #18

O1001G00 X0 Z#18G32 Z#26 F#9M04G32 Z#18 F#9M03M99

Tapping on a turning center

Another example

Page 55: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

F

Z R

#9

#26 #18

O1001G00 X0 Z#18G32 Z#26 F#9M04G32 Z#18 F#9M03M99

Tapping on a turning center

Another example

Page 56: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

F

Z R

#9

#26 #18

O1001G00 X0 Z#18G32 Z#26 F#9M04G32 Z#18 F#9M03M99

Tapping on a turning center

Another example

Page 57: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

F

Z R

#9

#26 #18

O1001G00 X0 Z#18G32 Z#26 F#9M04G32 Z#18 F#9M03M99

Tapping on a turning center

Another example

Page 58: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

F

Z R

O0001N005 G00 T0101N010 G97 S500 M03N015 G65 P1001 R.2 Z-1. F.0625N020 G00 X6.0 X5.0N025 M01..

Tapping on a turning center

Another example

Page 59: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

F

Z R

O0001N005 G00 T0101N010 G97 S500 M03N015 G65 P1001 R.2 Z-1. F.0625N020 G00 X6.0 X5.0N025 M01..

Tapping on a turning center

Another example

Page 60: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

Z R

O0001N005 G00 T0101N010 G97 S500 M03N015 G65 P1001 R.2 Z-1. F16.N020 G00 X6.0 X5.0N025 M01..

F: TPI

Tapping on a turning center

Could be number of threads per

inch

Another example

Page 61: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Argument Assignment Example

Z R

O0001N005 G00 T0101N010 G97 S500 M03N015 G65 P1001 R.2 Z-1. F16.N020 G00 X6.0 X5.0N025 M01..

O1001G00 X0 Z#18G32 Z#26 F[1/ #9]M04G32 Z#18 F[1/ #9]M03M99

F: TPI

Tapping on a turning center

Another example

Page 62: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Local Variables

#1 #2 #3 #4 #5 #6 #7 #8 #9 #10

#11 #12 #13 #14 #15 #16 #17 #18 #19 #20

#21 #22 #23 #24 #25 #26 #27 #28 #29 #30

#31 #32 #33

With argument assignment number one:

Available for use for calculations:

Again, if you wish to use local

variables for temporary calculations,

use these to keep from overwriting a

needed variable!

Use these local variables for general purpose calculations

Page 63: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Variable Types

ArgumentsLocal variablesCommon variablesPermanent common variablesSystem variables

Page 64: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variables

##100 - #149

Until power off

Retained until M30 orCommon variables are less volatile

than local variables!

Common variables range from #100 through #149

A parameter setting controls when common variables are set back to vacant

Page 65: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variables

You can actually see variable values

Press SET or SETTING several times

Press OFFSET and then MACRO

or

…depending upon control model

Page 66: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variables

G00 X[#24 + 2 * #7]

#100 = #24 + 2 * #7..G00 X#100

An application: Calculating values up front:

Calculation done in motion command

Calculation done up-front

Page 67: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common VariablesCommon Variables

G00 X[#24 + 2 * #7]

#100 = #24 + 2 * #7..G00 X#100

A note about brackets ([ ])…

Brackets required when a calculation is done within a CNC word

Brackets not required

Page 68: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

If you’re using custom macro to

create a canned cycle application,

use G65 to pass arguments

Z

U

Y

XD F: Feedrate

O0003N005 G54 G90 S500 M03N010 G00 X0 Y0N015 G43 H01 Z0.1N020 G65 P1003 X1. Y1. U4. Z0 D.25 F5.N025 G65 P1003 X1. Y3. U4. Z0 D.25 F5.N030 G91 G28 Z0 M19N035 M01..

Common VariablesProgram startup formatCall user-created canned cycle

Page 69: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

.5

Common Variables

0.5

0.75

But in part family applications:

Page 70: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

But in part family applications:Common Variables

#101

#102

#103#104

O0006 (Cap blocks)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)...N25 G81 R.1 Z-[#104+.18] F5....

Use common variablesPlace them at beginningNote messagesReference them as needed

Use common variables to specify

input data (arguments) at the very

beginning of the part family program!

Be sure to label each with a

documenting message!

Page 71: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variables

O1001..#104 = 400...M99

O0001..G65 P1001 . . ...G65 P1002 . . ...M30

O1002..S#104 M03...M99

Common variables are retained until the power is turned off

You can use common variables

from one program to another!

Invoke custom macroCommon variable set in one program……can be referenced in another

Page 72: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

Z

H

T

O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99

Y

D

#11

#26

#9

#25

#7

#20

F - FeedrateX#24

Calculating values up front:

Example shown earlier

Page 73: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99

Calculating values up front:

Page 74: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99

O1000#100 = #24 - #7/2#101 = #25 - #7/2 -.1#102 = #26 - #20 - .05#103 = #25 + #11 + #7/2#104 = #26 + 0.1G00 X#100 Y#101Z#102G01 Y#103 F#9G00 Z#104M99

Calculating values up front:

Common Variable Example

You can use common variables to

calculate values that will be needed

later in the program!

Page 75: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

O1000/ #100 = #24 - #7/2/ #101 = #25 - #7/2 -.1/ #102 = #26 - #20 - .05 / #103 = #25 + #11 + #7/2/ #104 = #26 + 0.1G00 X#100 Y#101Z#102G01 Y#103 F#9G00 Z#104M99

Calculating values up front:

With block delete, you can save

calculation time once variables

have been calculated once!

Page 76: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

0.5

0.75

Part family example:

Page 77: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

#101

#102

#103#104

O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 (1/2 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01

Part family example:

Page 78: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

#101

#102

#103#104

O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01

Part family example:

Page 79: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

#101

#102

#103#104

O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01

Part family example:

Page 80: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

#101

#102

#103#104

O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01

Part family example:

Page 81: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

#101

#102

#103#104

O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01

Part family example:

Page 82: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

#101

#102

#103#104

O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01

Part family example:

Page 83: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

#101

#102

#103#104

O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01

Part family example:

Page 84: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

#101

#102

#103#104

O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01

Part family example:

Page 85: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

#101

#102

#103#104

O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01

Part family example:

Page 86: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

#101

#102

#103#104

O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01

Part family example:

Page 87: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

#101

#102

#103#104

O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01

Part family example:

Page 88: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

#101

#102

#103#104

O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01

Part family example:

Page 89: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

#101

#102

#103#104

O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01

Part family example:

Page 90: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

#101

#102

#103#104

N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30

Part family example:

Page 91: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

#101

#102

#103#104

N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30

Part family example:

Page 92: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Common Variable Example

#101

#102

#103#104

N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30

Part family example:

Page 93: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

#101

#102

#103#104

N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30

Part family example:

Common Variable Example

Page 94: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

#101

#102

#103#104

N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30

Part family example:

Common Variable Example

Page 95: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

#101

#102

#103#104

N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30

Part family example:

Common Variable Example

Page 96: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

#101

#102

#103#104

N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30

Part family example:

Common Variable Example

Page 97: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

#101

#102

#103#104

N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30

Part family example:

Common Variable Example

Page 98: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

#101

#102

#103#104

N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30

Common Variable ExamplePart family example:

Page 99: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Variable Types

ArgumentsLocal variablesCommon variablesPermanent common variablesSystem variables

Page 100: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Permanent Common Variables

#500 - #509

Retained even after power off

#Some controls have more than ten

Use permanent common variables for

applications that require that you retain

data even after the power is turned off!

Page 101: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Permanent Common Variables

Part counters

Tool life management

Cycle time meter

Page 102: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Permanent Common Variables

O0001N005 T0101 M41N010 G97 S500 M03N015G00 X0.5 Z0.1N020 G01 Z-1.0 F0.005N025 G00 Z0.1N030 G00 X6.0 Z5.0N035 M01..

Make your approach value a system constant

Examples…

Page 103: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Permanent Common Variables

O0001N005 T0101 M41N010 G97 S500 M03N015G00 X0.5 Z#500N020 G01 Z-1.0 F0.005N025 G00 Z#500N030 G00 X6.0 Z5.0N035 M01..

Make your approach value a system constant

Examples…

Page 104: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

O0001N005 T0101 M41N010 G97 S500 M03N015G00 X0.5 Z#500N020 G01 Z-1.0 F0.005N025 G00 Z#500N030 G00 X6.0 Z5.0N035 M01..

Permanent Common Variables

Eliminate M code inconsistencies from machine to machine

Examples…

Page 105: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Permanent Common Variables

O0001N005 T0101 M#501N010 G97 S500 M03N015G00 X0.5 Z#500N020 G01 Z-1.0 F0.005N025 G00 Z#500N030 G00 X6.0 Z5.0N035 M01..

Eliminate M code inconsistencies from machine to machine

Examples…

Page 106: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Permanent Common Variables

#500 00.0000 __________#501 00.0000 __________#502 00.0000 __________#503 00.0010 __________#504 00.0000 __________#505 00.0000 __________#506 00.0000 __________#507 00.0000 __________#508 00.0000 __________

O0001SETVN 500 [APPROACH]SETVN 501 [LOW RANG]#500= 0.1#501 = 41M30

You can even label permanent common variables

SETVN stands for Set Variable Name

Page 107: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Permanent Common Variables

#500 00.1000 APPROACH#501 41.0000 LOW RANG#502 00.0000 __________#503 00.0000 __________#504 00.0000 __________#505 00.0000 __________#506 00.0000 __________#507 00.0000 __________#508 00.0000 __________

O0001SETVN 500 [APPROACH]SETVN 501 [LOW RANG]#500= 0.1#501 = 41M30

You can even label permanent common variables

Page 108: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Permanent Common Variables

#500 00.0000 APPROACH#501 00.0000 LOW RANG#502 00.0000 __________#503 00.0000 __________#504 00.0000 __________#505 00.0000 __________#506 00.0000 __________#507 00.0000 __________#508 00.0000 __________

0.1

You can also enter values manually

Page 109: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Permanent Common Variables

#500 00.1000 APPROACH#501 00.0000 LOW RANG#502 00.0000 __________#503 00.0000 __________#504 00.0000 __________#505 00.0000 __________#506 00.0000 __________#507 00.0000 __________#508 00.0000 __________

You can also enter values manually

Page 110: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Permanent Common Variables

#500 00.0500 RADIUS#501 00.0012 X+ O&D#502 00.0021 X- O&D#503 00.0014 Y+ O&D#504 00.0018 Y- O&D#505 06.6674 LENGTH#506 00.0000 __________#507 00.0000 __________#508 00.0000 __________

Be careful! Some may be used by other devices!

These are probe

calibration values!

Page 111: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Permanent Common Variables

O0008 (Main program)...N445 G65 P1008 C250.N450 M30

O1008#500 = #500 +1IF[#500 LT #3] GOTO 99#500 = 0#3000 = 100 (PART COUNT ACHIEVED)N99 M99

A part counter

We’ll explain the IF

statement in detail later

Page 112: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

Variable Types

ArgumentsLocal variablesCommon variablesPermanent common variablesSystem variables

Page 113: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

System Variables

#>#1000

Access to many CNC features

Page 114: 2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables

System Variables

#1000 series: Input/output signalsInterface with accessories

#2000 series: Tool offsetsRead and write

#3000 series: Misc. CNC featuresAlarm, control panel functions, stop w/message

#4000 series: Modal statesG code groups, current word address status

#5000 series: Axis positionRelative to program zero or zero return

More on system

variables later