Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables."— Presentation transcript:

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

2 Introduction To Variables 253156 Jar AJar CJar B Jar C = Jar A + Jar B Jar A = 25Jar B = 31 Variables are like storage containers for numbers

3 Introduction To Variables G Provide storage for numbers G Have no meaning until used G Are used in arithmetic expressions G Can represent just about anything Of course, we’re not storing values in jars! Variables:

4 Introduction To Variables Tool 4 ? Offsets: 1 2 3 4 5 6 7 00.0000 5.4876 A G43 H04 Z0.1 Offsets are a kind of variable… Tool length is unknown while programming During setup, length is measured Offset value is entered after measurement Command in program invokes offset value A Tool length A Cutter radius A Wear offset A Tool nose radius Offsets can only represent: Offsets usage is rather limited By comparison, variables can be used to represent just about anything!

5 Introduction To Variables Say you must mill a slot in several workpieces

6 Introduction To Variables But the width of each workpiece varies

7 Introduction To Variables But the width of each workpiece varies As does the position and depth With parametric programming, variables can be used to represent these workpiece attributes

8 Variable Types < Arguments < Local variables < Common variables < Permanent common variables < System variables There are five kinds of variables in custom macro B Let’s begin with arguments

9 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

10 Custom Macro B Arguments G65 P1000A45. R2. H8. D.75 Call custom macro Input data (arguments) One form of argument in custom macro includes letters of the alphabet

11 For reasons we’ll describe later, avoid I, J, & K Custom Macro B Arguments ABCDEFH IJKMQRS TUVWXYZ Argument assignment number one: Not allowed: G, L, N, O, & P Allowable letters of the alphabet

12 Custom Macro B Arguments X Y Z D H An example: Choose logical representations: H for hole D for depth X for X position Y for Y position Z for Z position

13 Custom Macro B Arguments X Y Z D H An example: Choose logical representations: H for hole D for depth X for X position Y for Y position Z for Z position G65 P1000 X2.0 Y2.0 Z0 D0.25 H2.5 Call custom macro Arguments Argument assignment number one is, by far, the more popular form of argument assignment

14 Custom Macro B Arguments Argument assignment number two: A B CI J K This form of argument assignment is seldom used A, B, C, and ten sets of I, J, and K are allowed

15 Custom Macro B Arguments O1000 G00 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…

16 Variable Types < Arguments < Local variables < Common variables < Permanent common variables < System variables

17 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

18 Custom Macro B Local Variables Represent arguments Reference temporary values The primary application for local variables is to reference the values of arguments coming from a G65 command Local variables are used to: Primary use

19 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)

20 Custom Macro B Local Variables A:#1B:#2C:#3D:#7E:#8F:#9H:#11 I:#4J:#5K:#6M:#13Q:#17R:#18S:#19 T:#20U:#21V:#22W:#23X:#24Y:#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

21 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

22 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.0000 02.5000 00.0000 03.0000 00.2500

23 Custom Macro B Local Variables G65 P1000 X2. Y2.5 Z0 D.25 H3. 1) Set values of local variables 2) Execute program 01000 Example of argument assignment…

24 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

25 #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.0000 02.5000 Custom Macro B Local Variables Local variables #24 & #25 set from program O0001

26 Nesting: Main: O0001. G65P1001 X2. Y2.5. M30 Level 1: O1001. G65P1002 X5. Y7.. M99 Level 2: O1002. M99. Custom Macro B Local Variables

27 #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.0000 07.0000 Custom Macro B Local Variables Local variables #24 & #25 set from program O1001

28 Nesting: Main: O0001. G65P1001 X2. Y2.5. M30 Level 1: O1001. G65P1002 X5. Y7.. M99 Level 2: O1002. M99. Custom Macro B Local Variables

29 #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.0000 02.5000 Custom Macro B Local Variables Local variables #24 & #25 set from program O0001

30 Nesting: Main: O0001. G65P1001 X2. Y2.5. M30 Level 1: O1001. G65P1002 X5. Y7.. M99 Level 2: O1002. M99. Custom Macro B Local Variables

31 #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 Variables Local variables #24 & #25 set back to vacant

32 Nesting: Main: O0001. G65P1001 X2. Y2.5. M30 Level 1: O1001. G65P1002 X5. Y7.. M99 Level 2: O1002. M99. Custom Macro B Local Variables

33 Argument Assignment Example Mill left side of any workpiece Full example

34 Argument Assignment Example Mill left side of any workpiece Full example

35 Argument Assignment Example Mill left side of any workpiece Full example

36 Argument Assignment Example Z H Y T D O0001 N005 G54 G90 S300 M03 N010 G00 X0 Y0 N015 G43 H01 Z0.1 N020 G65 P1000 X0 Y0 Z0 H2. T1. D1.0 F4. N025 G91 G28 Z0 M19 N030 M01. X F - Feedrate Mill left side of any workpiece Full example

37 Argument Assignment Example Z H T O1000 G00 X[#24-#7/2] Y[#25-#7/2 -.1] Z[#26 - #20 -.05] G01 Y[#25 + #11 + #7/2] F#9 G00 Z[#26 + 0.1] M99 Y D #11 #26 #9 #25 #7 #20 F - Feedrate X #24 Mill left side of any workpiece Full example

38 Z H T O1000 G00 X[#24-#7/2] Y[#25-#7/2 -.1] Z[#26 - #20 -.05] G01 Y[#25 + #11 + #7/2] F#9 G00 Z[#26 + 0.1] M99 Y D #11 #26 #9 #25 #7 #20 #24 F - Feedrate X Argument Assignment Example Mill left side of any workpiece Full example

39 Argument Assignment Example Z H T O1000 G00 X[#24-#7/2] Y[#25-#7/2 -.1] Z[#26 - #20 -.05] G01 Y[#25 + #11 + #7/2] F#9 G00 Z[#26 + 0.1] M99 Y D #11 #26 #9 #25 #7 #20 #24 F - Feedrate X Mill left side of any workpiece Full example

40 Argument Assignment Example Z H T O1000 G00 X[#24-#7/2] Y[#25-#7/2 -.1] Z[#26 - #20 -.05] G01 Y[#25 + #11 + #7/2] F#9 G00 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

41 Argument Assignment Example Z H T O1000 G00 X[#24-#7/2] Y[#25-#7/2 -.1] Z[#26 - #20 -.05] G01 Y[#25 + #11 + #7/2] F#9 G00 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

42 Argument Assignment Example Z H T O1000 G00 X[#24-#7/2] Y[#25-#7/2 -.1] Z[#26 - #20 -.05] G01 Y[#25 + #11 + #7/2] F#9 G00 Z[#26 + 0.1] M99 Y D #11 #26 #9 #25 #7 #20 #24 F - Feedrate X Mill left side of any workpiece Full example

43 Argument Assignment Example Z H T O1000 G00 X[#24-#7/2] Y[#25-#7/2 -.1] Z[#26 - #20 -.05] G01 Y[#25 + #11 + #7/2] F#9 G00 Z[#26 + 0.1] M99 Y D #11 #26 #9 #25 #7 #20 #24 F - Feedrate X Mill left side of any workpiece Full example

44 Argument Assignment Example Z H T Y D O0001 N005 G54 G90 S300 M03 N010 G00 X0 Y0 N015 G43 H01 Z0.1 N020 G65 P1000 X0 Y0 Z0 H2. T1. D1.0 F4. N025 G91 G28 Z0 M19 N030 M01. #11 #26 #9 #25 #7 #20 #24 F - Feedrate X Mill left side of any workpiece Full example

45 Argument Assignment Example Z H T O1000 G00 X[#24-#7/2] Y[#25-#7/2 -.1] Z[#26 - #20 -.05] G01 Y[#25 + #11 + #7/2] F#9 G00 Z[#26 + 0.1] M99 Y D #11 #26 #9 #25 #7 #20 #24 F - Feedrate X Minimizing redundant calculations Full example

46 Argument Assignment Example Z H T O1000 #27 = #7/2 G00 X[#24- #27] Y[#25- #27 -.1] Z[#26 - #20 -.05] G01 Y[#25 + #11 + #27] F#9 G00 Z[#26 + 0.1] M99 Y D #11 #26 #9 #25 #7 #20 #24 F - Feedrate X 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

47 Argument Assignment Example Tapping on a turning center Another example

48 Argument Assignment Example Tapping on a turning center Another example

49 Argument Assignment Example Tapping on a turning center Another example

50 Argument Assignment Example F Z R O0001 N005 G00 T0101 N010 G97 S500 M03 N015 G65 P1001 R.2 Z-1. F.0625 N020 G00 X6.0 X5.0 N025 M01. Tapping on a turning center Another example

51 Argument Assignment Example F Z R #9 #26 #18 O1001 G00 X0 Z#18 G32 Z#26 F#9 M04 G32 Z#18 F#9 M03 M99 Tapping on a turning center Another example

52 Argument Assignment Example F Z R #9 #26 #18 O1001 G00 X0 Z#18 G32 Z#26 F#9 M04 G32 Z#18 F#9 M03 M99 Tapping on a turning center Another example

53 Argument Assignment Example F Z R #9 #26 #18 O1001 G00 X0 Z#18 G32 Z#26 F#9 M04 G32 Z#18 F#9 M03 M99 Tapping on a turning center Another example

54 Argument Assignment Example F Z R #9 #26 #18 O1001 G00 X0 Z#18 G32 Z#26 F#9 M04 G32 Z#18 F#9 M03 M99 Tapping on a turning center Another example

55 Argument Assignment Example F Z R #9 #26 #18 O1001 G00 X0 Z#18 G32 Z#26 F#9 M04 G32 Z#18 F#9 M03 M99 Tapping on a turning center Another example

56 Argument Assignment Example F Z R #9 #26 #18 O1001 G00 X0 Z#18 G32 Z#26 F#9 M04 G32 Z#18 F#9 M03 M99 Tapping on a turning center Another example

57 Argument Assignment Example F Z R #9 #26 #18 O1001 G00 X0 Z#18 G32 Z#26 F#9 M04 G32 Z#18 F#9 M03 M99 Tapping on a turning center Another example

58 Argument Assignment Example F Z R O0001 N005 G00 T0101 N010 G97 S500 M03 N015 G65 P1001 R.2 Z-1. F.0625 N020 G00 X6.0 X5.0 N025 M01. Tapping on a turning center Another example

59 Argument Assignment Example F Z R O0001 N005 G00 T0101 N010 G97 S500 M03 N015 G65 P1001 R.2 Z-1. F.0625 N020 G00 X6.0 X5.0 N025 M01. Tapping on a turning center Another example

60 Argument Assignment Example Z R O0001 N005 G00 T0101 N010 G97 S500 M03 N015 G65 P1001 R.2 Z-1. F16. N020 G00 X6.0 X5.0 N025 M01. F: TPI Tapping on a turning center Could be number of threads per inch Another example

61 Argument Assignment Example Z R O0001 N005 G00 T0101 N010 G97 S500 M03 N015 G65 P1001 R.2 Z-1. F16. N020 G00 X6.0 X5.0 N025 M01. O1001 G00 X0 Z#18 G32 Z#26 F[1/ #9] M04 G32 Z#18 F[1/ #9] M03 M99 F: TPI Tapping on a turning center Another example

62 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

63 Variable Types < Arguments < Local variables < Common variables < Permanent common variables < System variables

64 Common Variables # #100 - #149 Until power off Retained until M30 or Common 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

65 Common Variables You can actually see variable values Press SET or SETTING several times Press OFFSET and then MACRO or …depending upon control model

66 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

67 Common 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

68 If you’re using custom macro to create a canned cycle application, use G65 to pass arguments Z U Y X D F: Feedrate O0003 N005 G54 G90 S500 M03 N010 G00 X0 Y0 N015 G43 H01 Z0.1 N020 G65 P1003 X1. Y1. U4. Z0 D.25 F5. N025 G65 P1003 X1. Y3. U4. Z0 D.25 F5. N030 G91 G28 Z0 M19 N035 M01. Common Variables Program startup format Call user-created canned cycle

69 .5 Common Variables 0.5 0.75 But in part family applications:

70 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 variables Place them at beginning Note messages Reference 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!

71 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 macro Common variable set in one program… …can be referenced in another

72 Common Variable Example Z H T O1000 G00 X[#24-#7/2] Y[#25-#7/2 -.1] Z[#26 - #20 -.05] G01 Y[#25 + #11 + #7/2] F#9 G00 Z[#26 + 0.1] M99 Y D #11 #26 #9 #25 #7 #20 F - Feedrate X #24 Calculating values up front: Example shown earlier

73 Common Variable Example O1000 G00 X[#24-#7/2] Y[#25-#7/2 -.1] Z[#26 - #20 -.05] G01 Y[#25 + #11 + #7/2] F#9 G00 Z[#26 + 0.1] M99 Calculating values up front:

74 O1000 G00 X[#24-#7/2] Y[#25-#7/2 -.1] Z[#26 - #20 -.05] G01 Y[#25 + #11 + #7/2] F#9 G00 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.1 G00 X#100 Y#101 Z#102 G01 Y#103 F#9 G00 Z#104 M99 Calculating values up front: Common Variable Example You can use common variables to calculate values that will be needed later in the program!

75 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.1 G00 X#100 Y#101 Z#102 G01 Y#103 F#9 G00 Z#104 M99 Calculating values up front: With block delete, you can save calculation time once variables have been calculated once!

76 Common Variable Example 0.5 0.75 Part family example:

77 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 M03 N15 G00 X.5 Y.5 N20 G43 H01 Z.1 N25 G81 R.1 Z-[#104+.18] F5. N30 Y[#102-.5] N35 X[#101-.5] N40 Y.5 N45 G80 N50 G91 G28 Z0 M19 N55 M01 Part family example:

78 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 M03 N15 G00 X.5 Y.5 N20 G43 H01 Z.1 N25 G81 R.1 Z-[#104+.18] F5. N30 Y[#102-.5] N35 X[#101-.5] N40 Y.5 N45 G80 N50 G91 G28 Z0 M19 N55 M01 Part family example:

79 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 M03 N15 G00 X.5 Y.5 N20 G43 H01 Z.1 N25 G81 R.1 Z-[#104+.18] F5. N30 Y[#102-.5] N35 X[#101-.5] N40 Y.5 N45 G80 N50 G91 G28 Z0 M19 N55 M01 Part family example:

80 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 M03 N15 G00 X.5 Y.5 N20 G43 H01 Z.1 N25 G81 R.1 Z-[#104+.18] F5. N30 Y[#102-.5] N35 X[#101-.5] N40 Y.5 N45 G80 N50 G91 G28 Z0 M19 N55 M01 Part family example:

81 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 M03 N15 G00 X.5 Y.5 N20 G43 H01 Z.1 N25 G81 R.1 Z-[#104+.18] F5. N30 Y[#102-.5] N35 X[#101-.5] N40 Y.5 N45 G80 N50 G91 G28 Z0 M19 N55 M01 Part family example:

82 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 M03 N15 G00 X.5 Y.5 N20 G43 H01 Z.1 N25 G81 R.1 Z-[#104+.18] F5. N30 Y[#102-.5] N35 X[#101-.5] N40 Y.5 N45 G80 N50 G91 G28 Z0 M19 N55 M01 Part family example:

83 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 M03 N15 G00 X.5 Y.5 N20 G43 H01 Z.1 N25 G81 R.1 Z-[#104+.18] F5. N30 Y[#102-.5] N35 X[#101-.5] N40 Y.5 N45 G80 N50 G91 G28 Z0 M19 N55 M01 Part family example:

84 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 M03 N15 G00 X.5 Y.5 N20 G43 H01 Z.1 N25 G81 R.1 Z-[#104+.18] F5. N30 Y[#102-.5] N35 X[#101-.5] N40 Y.5 N45 G80 N50 G91 G28 Z0 M19 N55 M01 Part family example:

85 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 M03 N15 G00 X.5 Y.5 N20 G43 H01 Z.1 N25 G81 R.1 Z-[#104+.18] F5. N30 Y[#102-.5] N35 X[#101-.5] N40 Y.5 N45 G80 N50 G91 G28 Z0 M19 N55 M01 Part family example:

86 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 M03 N15 G00 X.5 Y.5 N20 G43 H01 Z.1 N25 G81 R.1 Z-[#104+.18] F5. N30 Y[#102-.5] N35 X[#101-.5] N40 Y.5 N45 G80 N50 G91 G28 Z0 M19 N55 M01 Part family example:

87 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 M03 N15 G00 X.5 Y.5 N20 G43 H01 Z.1 N25 G81 R.1 Z-[#104+.18] F5. N30 Y[#102-.5] N35 X[#101-.5] N40 Y.5 N45 G80 N50 G91 G28 Z0 M19 N55 M01 Part family example:

88 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 M03 N15 G00 X.5 Y.5 N20 G43 H01 Z.1 N25 G81 R.1 Z-[#104+.18] F5. N30 Y[#102-.5] N35 X[#101-.5] N40 Y.5 N45 G80 N50 G91 G28 Z0 M19 N55 M01 Part family example:

89 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 M03 N15 G00 X.5 Y.5 N20 G43 H01 Z.1 N25 G81 R.1 Z-[#104+.18] F5. N30 Y[#102-.5] N35 X[#101-.5] N40 Y.5 N45 G80 N50 G91 G28 Z0 M19 N55 M01 Part family example:

90 Common Variable Example #101 #102 #103 #104 N55 M01 N60 T02 M06 (3/4 Mill) N65 G54 G90 S300 M03 N70 G00 X[#101/2] Y-.475 N75 G43 H02 Z-#103 N80 G01 Y[#102+.475] N85 G00 Z0.1 N90 G91 G28 Z0 M19 N95 M30 Part family example:

91 Common Variable Example #101 #102 #103 #104 N55 M01 N60 T02 M06 (3/4 Mill) N65 G54 G90 S300 M03 N70 G00 X[#101/2] Y-.475 N75 G43 H02 Z-#103 N80 G01 Y[#102+.475] N85 G00 Z0.1 N90 G91 G28 Z0 M19 N95 M30 Part family example:

92 Common Variable Example #101 #102 #103 #104 N55 M01 N60 T02 M06 (3/4 Mill) N65 G54 G90 S300 M03 N70 G00 X[#101/2] Y-.475 N75 G43 H02 Z-#103 N80 G01 Y[#102+.475] N85 G00 Z0.1 N90 G91 G28 Z0 M19 N95 M30 Part family example:

93 #101 #102 #103 #104 N55 M01 N60 T02 M06 (3/4 Mill) N65 G54 G90 S300 M03 N70 G00 X[#101/2] Y-.475 N75 G43 H02 Z-#103 N80 G01 Y[#102+.475] N85 G00 Z0.1 N90 G91 G28 Z0 M19 N95 M30 Part family example: Common Variable Example

94 #101 #102 #103 #104 N55 M01 N60 T02 M06 (3/4 Mill) N65 G54 G90 S300 M03 N70 G00 X[#101/2] Y-.475 N75 G43 H02 Z-#103 N80 G01 Y[#102+.475] N85 G00 Z0.1 N90 G91 G28 Z0 M19 N95 M30 Part family example: Common Variable Example

95 #101 #102 #103 #104 N55 M01 N60 T02 M06 (3/4 Mill) N65 G54 G90 S300 M03 N70 G00 X[#101/2] Y-.475 N75 G43 H02 Z-#103 N80 G01 Y[#102+.475] N85 G00 Z0.1 N90 G91 G28 Z0 M19 N95 M30 Part family example: Common Variable Example

96 #101 #102 #103 #104 N55 M01 N60 T02 M06 (3/4 Mill) N65 G54 G90 S300 M03 N70 G00 X[#101/2] Y-.475 N75 G43 H02 Z-#103 N80 G01 Y[#102+.475] N85 G00 Z0.1 N90 G91 G28 Z0 M19 N95 M30 Part family example: Common Variable Example

97 #101 #102 #103 #104 N55 M01 N60 T02 M06 (3/4 Mill) N65 G54 G90 S300 M03 N70 G00 X[#101/2] Y-.475 N75 G43 H02 Z-#103 N80 G01 Y[#102+.475] N85 G00 Z0.1 N90 G91 G28 Z0 M19 N95 M30 Part family example: Common Variable Example

98 #101 #102 #103 #104 N55 M01 N60 T02 M06 (3/4 Mill) N65 G54 G90 S300 M03 N70 G00 X[#101/2] Y-.475 N75 G43 H02 Z-#103 N80 G01 Y[#102+.475] N85 G00 Z0.1 N90 G91 G28 Z0 M19 N95 M30 Common Variable Example Part family example:

99 Variable Types < Arguments < Local variables < Common variables < Permanent common variables < System variables

100 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!

101 Permanent Common Variables l Part counters l Tool life management l Cycle time meter

102 Permanent Common Variables O0001 N005 T0101 M41 N010 G97 S500 M03 N015G00 X0.5 Z0.1 N020 G01 Z-1.0 F0.005 N025 G00 Z0.1 N030 G00 X6.0 Z5.0 N035 M01. Make your approach value a system constant Examples…

103 Permanent Common Variables O0001 N005 T0101 M41 N010 G97 S500 M03 N015G00 X0.5 Z#500 N020 G01 Z-1.0 F0.005 N025 G00 Z#500 N030 G00 X6.0 Z5.0 N035 M01. Make your approach value a system constant Examples…

104 O0001 N005 T0101 M41 N010 G97 S500 M03 N015G00 X0.5 Z#500 N020 G01 Z-1.0 F0.005 N025 G00 Z#500 N030 G00 X6.0 Z5.0 N035 M01. Permanent Common Variables Eliminate M code inconsistencies from machine to machine Examples…

105 Permanent Common Variables O0001 N005 T0101 M#501 N010 G97 S500 M03 N015G00 X0.5 Z#500 N020 G01 Z-1.0 F0.005 N025 G00 Z#500 N030 G00 X6.0 Z5.0 N035 M01. Eliminate M code inconsistencies from machine to machine Examples…

106 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 __________ O0001 SETVN 500 [APPROACH] SETVN 501 [LOW RANG] #500= 0.1 #501 = 41 M30 You can even label permanent common variables SETVN stands for Set Variable Name

107 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 __________ O0001 SETVN 500 [APPROACH] SETVN 501 [LOW RANG] #500= 0.1 #501 = 41 M30 You can even label permanent common variables

108 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

109 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

110 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!

111 Permanent Common Variables O0008 (Main program). N445 G65 P1008 C250. N450 M30 O1008 #500 = #500 +1 IF[#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

112 Variable Types < Arguments < Local variables < Common variables < Permanent common variables < System variables

113 System Variables # >#1000 Access to many CNC features

114 System Variables X #1000 series: Input/output signals X Interface with accessories X #2000 series: Tool offsets X Read and write X #3000 series: Misc. CNC features X Alarm, control panel functions, stop w/message X #4000 series: Modal states X G code groups, current word address status X #5000 series: Axis position X Relative to program zero or zero return More on system variables later


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

Similar presentations


Ads by Google