CNC Machine Help-Home

Applications & Programming
RS232 communications
Macro programming
Macro variable list
Programming safety code
Coolant mix water problems
Finish, chatter problems
Tapping problems
Common Parameter changes
Drill tap chart
Tool presetter calibration
Create a new NC program
Fixture design considerations
Tool breakage detection
Unit conversion software
End mill training education
Touch or tool probe systems
G10 parameter change
G codes, M codes List (General)
Okuma G & M codes list
Haas G code, M code list

Rotary Indexer selection
High pressure coolant
Coolant oil skimmers
Tool breakage detection
Machine tool Options

 

**CNC help Forums**
Newest recent content
CNC Books Store
CNC Specialty STORE (New!!)

Classifieds (buy/sell-Free)
Search

Newsletter sign up

Free trade magazines







Custom Macro for Variable peck drilling cycle

Problem :  Write Custom Macro “B” (for FANUC Oi Mate – TB system) program for variable peck drilling cycle :  A hole of dia. 11 mm is to be drilled thru’ for the depth of 50 mm. Since the hole is having L/D ratio of > 4, it is desirable to program for variable (i.e. uniformly reducing depth type) pecks. Program the operation while referring to the following data. 

Data :
i)   Length of the first peck = 7.0 mm

ii)  Decrement by which the subsequent pecks should uniformly reduce = 0.5 mm

iii) Retraction Amount after each peck = 1.5 mm.

iv) The drill should withdraw fully after every three pecks and it should dwell for 5.0

     seconds for coolant blow to clean up the chips clogged on the cutting edges and the  

     flutes.

v)  Dwell at the end of each peck = 2.0 seconds.

 

Program :

O2222 (VARIABLE PECK DRILLING CYCLE);

N1;

T0000;

G28 U0 W0;

T0101;

G50 S1600;

G97 S1600 M03;

G0 Z20.0 M08;

X0.0;

Z2.0;

#99 = 7.0;

#100 = 7.0;

#101 = -2.0;

#102 = 0.0;

N10;

IF [ #100 GT 51.0 ] GOTO 30;

G0 Z-#101;

G1 Z-#100 F0.05;

G04 X2.0;

#101 = #100 – 1.5

G0 Z-#101;

#99 = #99 – 0.5;

#100 = #100 + #99;

#102 = #102 + 1;

IF [ #102 EQ 3 ] GOTO 20;

GOTO 10;

N20;

#102 = 0;

G0 Z2.0;

G04 X5.0;

GOTO 10;

N30;

G0 Z2.0 M09;

G97 M05;

G28 U0 W0;

M30;

%

Explanation of what exactly is happening to the variables after each iteration :

 Value of each variable at each iteration while execution of the program proceeds :

 

Iteration no.

#101- 1st value

#99

#100

#101 – 2nd value

#102

1

-2.0

7.0

7.0

5.5

1

2

5.5

6.5

13.5

12.0

2

3

12.0

6.0

19.5

18.0

3

The drill will be withdrawn to Z2.0, will dwell for 5 seconds and will plunge in rapid to Z-18.0

4

18.0

5.5

25.0

23.5

1

5

23.5

5.0

30.0

28.5

2

6

28.5

4.5

34.5

33.0

3

The drill will be withdrawn to Z2.0, will dwell for 5 seconds and will plunge in rapid to Z-33.0

7

33.0

4.0

38.5

37.0

1

8

37.0

3.5

42.0

40.5

2

9

40.5

3.0

45.0

43.5

3

The drill will be withdrawn to Z2.0, will dwell for 5 seconds and will plunge in rapid to Z-43.5

10

43.5

2.5

47.5

45.0

1

11

45.0

2.0

49.5

48.0

2

12

48.0

1.5

51.0

49.5

3

The drill will be withdrawn to Z2.0, will dwell for 5 seconds

13

49.5

1.0

52.0

50.5

1

13th iteration will not be executed, the drill will remain out to Z2.0 and the program will end.

 

 

Definition of Each variable :

#101 – 1st value = Positioning of the drill tip before the peck has started.

#101 – 2nd value = Positioning of the drill tip after the peck has completed; this

                             value is followed before the start of the next peck as well.

#99  =  Decrementing value which is to be added to the previous peck depth.

#100 = Depth of each peck.

#102 = Counter set to count 3 pecks after which the drill will get withdrawn to

            Z2.0 and dwell for 5 seconds.

 

Note : The 1st value of #101 for the first iteration is specified as = -2.0

           because only during first iteration, the position of the drill tip should be

           at Z-(-2.0) = Z+2.0. For subsequent iterations the value will be calculated

           from within the loop.

 

 

________________

Jasmin C. Shah

CNC Application Engineering Consultant

Date :  4th September, 2006

 

Share your CNC information?
...Procedures
...Macro programs
...Experience
...Stories
...Articles
...Recommendations
...Anything related

Suggestions or comments?
Please Email Me: petro@machinetoolhelp.com

Thank you for all your contributions and supporting the CNC community.





.