Search

Embedded Systems Tutorial

Embedded Systems

We can broadly define an embedded system as a microcontroller-based, software-driven, reliable, real-time control system, designed to perform a specific task. It can be thought of as a computer hardware system having software embedded in it. An embedded system can be either an independent system or a part of a large system. In this tutorial, we will explain all the steps necessary to design an embedded system and use it.

This tutorial has been designed to help the students of electronics learn the basic-to-advanced concepts of Embedded System and 8051 Microcontroller.


Before proceeding with this tutorial, you should have a good understanding of the concepts of basic electronics such as circuits, logic gates, etc.


Table of contents:
1. Overview
 2. Processors
 3. Architectures
 4. Tools and Peripherals
 5. 8051 Microcontroller
 6. I/O Programming
 7. Terms
 8. Assembly Language
 9. Registers
 10. Registers Bank/Stack
 11. Instructions
 12. Addressing Modes
 13. Special Function Registers
 14. Timer/Counter
 15. Interrupts

- tutorialspoint.com

CNC Programming Examples - Slot Milling

Fanuc G71 Turning Cycle

G71 turning cycle is used for rough-material removal from a cnc lathe component. G71 turning cycle makes large diameter cutting easy. Cutting can be done in simple straight line or a complex contour can also be machined very easily.

* Best ebooks for CNC programming: 
CNC Programming Basics 
G-Code and M-Code 
CNC programming 
G-Code Reference 
CNC Machine Tutorial 

Through G71 turning cycle parameters cnc machinists can control
  • Depth of cut.
  • Retract height.
  • Finishing allowance in x-axis and z-axis.
  • Cycle cutting-feed, spindle speed.

Programming

G71 U... R...
        G71 P... Q... U... W... F... S...

Parameters

First block
Parameter Description
U Depth of cut.
R Retract height.
Second block
Parameter Description
P Contour start block number.
Q Contour end block number.
U Finishing allowance in x-axis.
W Finishing allowance in z-axis.
F Feedrate during G71 cycle.
S Spindle speed during G71 cycle.

G71 Turning Cycle Overview

  • G71 turning cycle cuts the whole contour repeatedly which is given in P Q blocks.
  • Depth of every cut can be controlled by first-block U value.
  • Second-block U W are the finishing allowances which can be given if you want to make a finish cut with G70 finishing cycle.
  • F is cutting feed and S is spindle speed (given in second-block) which are used during G71 turning cycle.
Note – The F and S given inside P Q block will not be used during G71 turning cycle, they are used with G70 finishing cycle if later called.

G71 Turning Cycle Working

N60 G71 U10 R10
        N70 G71 P80 Q90 U3 W0 F0.25
        N80 G00 X60
        N90 G01 Z-75
When G71 turning cycle is run the whole operation will be done in following sequence,
First-cut
1 – Tool will move in x-axis U (depth of cut) deep with programmed feed from starting-point.
2 – Tool will travel with feed in z-axis (destination point in z-axis is given in P Q blocks )
3 – Tool rapidly retracts R amount in both x-axis and z-axis (at 45 degrees).
4 – Tool rapidly travel in z-axis to start-point
Later-cuts
5 – Tool rapidly moves to last cut depth.
6 – Tool moves with feed in x-axis U deep (first-block U depth of cut).
7 – Tool with feed moves in z-axis (destination point given in P Q blocks).
8 – Tool rapidly retracts in x-axis and z-axis R amount (45 degrees).
9 – Tool rapidly moves to start-point only in z-axis.
This whole sequence of operation keep on going, until the destination point in x-axis is met.
If finishing allowance is given tool will not make the exact diameter and length given in P Q blocks but will leave that much allowance, This finishing allowance can be later machined by calling G70 finishing cycle.

Fanuc G71 Turning Cycle

Fanuc G71 Example

Here is a cnc part-program which shows how G71 turning cycle can be used, this is the program for the drawing given above
N50 G00 X106 Z5 M3 S800
        N60 G71 U10 R10
        N70 G71 P80 Q90 U3 W0 F0.25
        N80 G00 X60
        N90 G01 Z-75
In this program G71 turning cycle will keep repeating the contour given inside P Q blocks shown below
N80 G00 X60
        N90 G01 Z-75
These two cnc program blocks tell us that we want to remove material till X60 deep and in Z-75 in length.
The depth of cut is given in first-block U10 retract amount is also given R10.
Finishing allowance in x-axis is U3 but there is no finishing allowance given in z-axis W0.

G70 Finishing Cycle

If you programmed G71 turning cycle with finishing allowances then that finish allowances can be removed with G70 finishing cycle.
G70 finishing cycle repeats the whole contour the G71 way, but in just one-cut removing the finishing allowances.

Why Use G70 Finishing Cycle

As material can be removed with G71 turning cycle, but if you want a different cutting-feed and spindle speed for the last cut, then it is recommended that you use G70 finishing cycle.
G70 finishing cycle use F and S values which are given inside P Q programmed blocks. (G71 use F S values which are given inside G71 second block.)

Fanuc G70 Example

N50 G00 X106 Z5 M3 S800
        N60 G71 U10 R10
        N70 G71 P80 Q90 U3 W0 F0.25
        N80 G00 X60
        N90 G01 Z-75 F0.15
        N100 G00 X200 Z100
        N110 G92 S1200
        N120 T3 G96 S150 M03
        N130 G00 X106 Z5
        N140 G70 P80 Q90
        N150 G00 X200 Z100
        N160 M30

G70 G71 Example


G71 Rough Turning Cycle Example
O0004
        G00 X200 Z10 M3 S800
        G71 U2 R1 F200
        G71 P80 Q120 U0.5 W0.2
        N80 G00 X40 S1200
        G01 Z-30 F100
        X60 W-30
        W-20
        N120 X100 W-10
        G70 P80 Q120
        M30

------------

Fanuc G71 G72 G70 Canned Cycle CNC Lathe Internal Machining Example (Boring & Facing )

Fanuc programming example which shows the use of multiple fanuc canned cycle in cnc programming, Following canned cycle are used in this cnc lathe programming example
  • G71 Rough Turning Cycle
  • G72 Facing Cycle
  • G70 Finish Cycle
Contents
  • Fanuc G71 for Boring Opertaion
  • Fanuc Programming Example

Fanuc G71 for Boring Opertaion

This programming example also illustrate how G71 turning cycle can be used for internal machining (boring operation). So if you want to remove extra stock from inside of a component, you can use Fanuc G71 turning cycle for internal stock removal as well.

Fanuc Programming Example


Fanuc Canned Cycle Example
G28 U0 W0
            G50 S1500
            N1 T0101 M8 (OD FACING)
            G96 S180 M3
            G0 X255.0 Z5.0
            G72 W2.0 R0.5
            G72 P100 Q200 F0.25
            N100 G0 Z0 G41
            G1 X-2.0 F0.18
            N200 G0 Z5.0
            G40
            X255.0
            G28 U0 W0
            N2 T0404 M8 (ID ROUGH)
            G96 S180 M3
            G0 X50.0 Z5.0
            G71 U2.0 R0.5
            G71 P500 Q600 U-0.5 W0.1 F0.25
            N500 G0 X202.0 G41
            G1 Z0 F0.12
            X200.0
            Z-10.0
            X100.0
            Z-30.0
            X60.0
            Z-45.0
            N600 X50.0
            G40
            G0 Z5.0
            G28 U0 W0
            N3 T0505 M8 (ID FINISH)
            G96 S220 M3
            G0 X50.0 Z5.0
            G70 P500 Q600
            G0 X50.0 Z5.0
            G28 U0 W0
            M5 M9
            M30
---------------

Fanuc G73 Pattern Repeating Cycle CNC Program Example Code

CNC programming example for Fanuc G73 pattern repeating cycle.
Fanuc G73 Pattern Repeating Cycle has already been described here
CNC Fanuc G73 Pattern Repeating Cycle
You might like other Fanuc G73 pattern repeating cycle examples
CNC Fanuc G73 Pattern Repeating Cycle CNC Program Example
Fanuc G73 Pattern Repeating Canned Cycle Basic CNC Sample Program

Fanuc G73 Pattern Repeating Cycle Programming Example

This cnc program example also shows how cnc machinists can use ‘W’ instead of ‘Z’ for z-axis movements.

Fanuc G73 Pattern Repeating Cycle Program Example
N010 G00 X260.0 Z80.0
                N011 G00 X220.0 Z40.0
                N012 G73 U14.0 W14.0 R3
                N013 G73 P014 Q020 U4.0 W2.0 F0.3 S0180
                N014 G00 G42 X80.0 Z2.0
                N015 G01 W-20.0 F0.15 S0600
                N016 X120.0 W-10.0
                N017 W-20.0 S0400
                N018 G02 X160.0 W-20.0 R20.0
                N019 G01 X180.0 W-10.0 S0280
                N020 G40
                N021 G70 P014 Q020
                N022 G00 X260.0 Z80.0
                N023 M30


-------------

CNC Programming Example with Fanuc G71 Rough Turning Cycle and G70

Here is another cnc programming example, this cnc programming example shows the use of G71 Canned Cycle and G70 for Fanuc CNC Control.
Contents
  • G71 Turning Cycle
  • Program Example

G71 Turning Cycle

Although I already have posted about the G71 Turning Canned Cycle(Rough Turning Cycle), but that blog post just illustrates the use of G71 and G71 parameters.
This cnc programming example shows a complete contour cutting with G71 and finish cut on contour with G70.
G70 finishing cycle for fanuc cnc control can also be used with G72 Facing cycle for fanuc control. Usage of G70 Finishing cycle with G72 Facing cycle is same as shows here in the following example.

Program Example


CNC Programming Example with Fanuc G71 Rough Turning Cycle and G70
N10 G00 G90 X142 Z171
                    N20 G71 U4 R1
                    N30 G71 P40 Q110 U4 W2 F0.3
                    N40 G00 X40
                    N50 G01 Z140 F0.2
                    N60 G01 X60 Z110
                    N70 G01 Z90
                    N80 G01 X100 Z80
                    N90 G01 Z60
                    N110 G01 X140 Z40
                    N120 G70 P40 Q110
                    N130 G00 X200 Z220
                    N140 M30

CNC Programming Examples - Pattern Drilling

Fanuc Lathe Programming Example Using G70, G71, G74 for ID Machining

Fanuc lathe programming example which uses Fanuc canned cycle
  • G71 Turning Cycle
  • G70 Finish Cycle
  • G74 Peck Drilling Cycle
This Fanuc lathe programming example illustrates who to use G71 Turning cycle, G70 Finish cycle, G74 Peck drilling cycle for ID machining (Inside machining, boring operations)

Fanuc Lathe Programming Example

Fanuc Lathe Programming Example Using G71, G70 for ID Machining
N10 G40 G00
        N20 G99
        N30 M5
        N40 M9
        N60 T0101
        N70 G50 S3500
        N80 G96 S0240 M4
        N90 G00 X102. Z0.
        N100 G01 X-2. F0.15 M7
        N110 G00 X150. Z150.
        N120 M9
        N130 T0707
        N140 G97 S0950 M3
        N150 G00 Z3.
        N160 G00 X0.
        N170 G74 R1.0
        N171 G74 X0.0 Z-59.0 Q12000 R0.0 F0.2
        N350 G00 X150. Z150.
        N360 T0505
        N370 G50 S3500
        N380 G96 S0200 M4
        N390 G00 X23. Z2.
        N400 G71 U3. R1
        N410 G71 P420 Q530 U-0.5 W0.2 F0.3
        N420 G41 G00 X72.
        N440 G01 Z-21.
        N450 G03 X66. Z-24. I-3. K0.
        N460 G01 X54.
        N470 G02 X48. Z-27. I0. K-3.
        N480 G01 Z-41.
        N490 G03 X42. Z-44. I-3. K0.
        N500 G01 X30.
        N510 G02 X24. Z-47. I0. K-3.
        N520 G01 Z-59.
        N530 G01 X23.
        N540 G40
        N550 G00 X150. Z150. F0.3
        N560 T1111
        N570 G50 S4500
        N580 G96 S0380 M4
        N590 G41 G00 X72. Z2.
        N600 G70 P420 Q530
        N610 G40
        N620 G00 X23. Z2.
        N630 G00 X200. Z150.
        N640 M5
        N650 M30

Tools & Oprations

T0101 Turning Tool – Facing Operation
T0707 Tip Drill Tool – Drilling
T0505 Boring Bar – Internal machining (ID machining)
T1111 Boring Bar – Internal finish machining

------------

CNC Lathe Programming Exercise Fanuc G71 Turning Cycle, G74 Peck Drilling Cycle

CNC programming exercise for cnc lathe machinists who work on Fanuc cnc control (or similar cnc control).
This cnc programming exercise use
Fanuc G71 Turning Cycle
Fanuc G74 Peck Drilling Cycle
Contents
  • CNC Lathe Programming Exercise
    • Used Tools & Operations

CNC Lathe Programming Exercise


CNC Lathe Programming Exercise Fanuc G71, G74 Cycles
N10 G40 G00
            N20 G99
            N60 T0101
            N70 G50 S3500
            N80 G96 S0240 M4
            N90 G00 X72. Z0.1
            N100 G01 X-1.6 F0.12 M7
            N110 G00 X150. Z150.
            N120 M5
            N130 M9
            N140 T0303
            N150 G97 S2500 M3
            N160 G00 X0. Z3.
            N170 G01 Z-6. F0.1 M7
            N180 G00 Z2.
            N190 G00 X150. Z150.
            N210 T0707 M7
            N220 G97 S0884 M3
            N230 G00 Z3.
            N240 G00 X0.
            N250 G74 R1.0
            N260 G74 X0.0 Z-68.326 Q18000 F0.22
            N380 G00 X200.
            N400 G00 Z100.
            N500 T0404 M7
            N510 G50 S3500
            N520 G96 S0240 M4
            N530 G00 Z1.
            N540 G00 X70.
            N550 G71 U4. R1
            N560 G71 P570 Q650 U0.6 W0.2 F0.35
            N570 G42 G00 X24.
            N580 G01 Z0.
            N590 G01 X28. Z-2.
            N600 G01 Z-72.
            N610 G02 X32. Z-74. I2. K0.
            N620 G01 X62.
            N630 G01 X68. Z-77.
            N640 G01 Z-90.
            N650 G40
            N660 G00 X150.
            N680 G00 Z70.
            N690 T0202 M7
            N700 G50 S4500
            N710 G96 S0380 M4
            N720 G00 X16. Z3.
            N730 G42 G01 Z0. F0.1
            N740 G01 X24.
            N750 G01 X28. Z-2.
            N760 G01 Z-72.
            N770 G02 X32. Z-74. I2. K0.
            N780 G01 X62.
            N790 G01 X68. Z-77.
            N800 G01 Z-90.
            N810 G40
            N820 G00 X150. Z150.
            N830 M5
            N840 M9
            N850 M30

Used Tools & Operations

  • T0101 Turning Tool – Rough Facing
  • T0303 Center Drill – Center Drilling
  • T0707 Twist Drill – Drilling
  • T0404 Turning Tool – Rough Turning
  • T0202 Turning Tool – Finish Contour Cutting

---------------

Face Grooving with G74 Peck Drilling Cycle CNC Programming Tutorial

Contents
  • G74 Peck Drilling Cycle
  • Face Grooving with G74 Peck Drilling Cycle

G74 Peck Drilling Cycle

G74 peck drilling cycle be used in variety of ways, from peck drilling to face grooving.
The G74 Peck drilling in already discussed here Simple CNC Lathe Drilling with Fanuc G74 Peck Drilling Cycle.
The cnc programming example below shows how face grooving can be machined with the help of G74 peck drilling canned cycle.
With face grooving operations the tool is fed axially rather than radially toward the end surface of the workpiece.

Face Grooving with G74 Peck Drilling Cycle


Face Grooving with G74 G Code a CNC Programming Tutorial
N10 G50 S2000 T0100
                N20 G96 S80 M03
                N30 G00 X50.0 Z1.0 T0101
                N40 G74 R1.0
                N50 G74 X10.0 Z-10.0 P10000 Q3000 F0.1
                N60 G00 X200.0 Z200.0 T0100
                N70 M30
-------------

Simple CNC Lathe Drilling with Fanuc G74 Peck Drilling Cycle

Here is a cnc programming example for simple drilling on a cnc lathe machine. CNC Fanuc control has a very powerful and versatile peck drilling cycle (Fanuc G74) which relieves us from many unwanted chores. Although Fanuc G74 peck drilling cycle for fanuc cnc control can be used in variety of ways but this cnc programming example is just doing a simple peck drilling. One thing for newbies in cnc field is that we can simply drill a component by just giving a feed with G01.
N10 G00 X0 Z10
                    N20 G01 Z-30 F0.2
                    N30 G01 Z10 F1
If we can drill with the above method them why use a peck drilling cycle. Actually peck drilling (Fanuc G74) gives us some hidden benefits like
  • Longer drill life
  • Proper chip breaking
  • Proper chip removal
  • Prevents component from heating
  • Smooth drilling
  • Easy to program
So here is the simple cnc program example which shows simple cnc peck drilling (Fanuc G74) on a cnc lathe machine

Simple CNC Lathe Drilling with Fanuc G74 Peck Drilling Cycle
N10 T5
                    N20 G97 S500 M03
                    N30 G00 X0 Z2
                    N40 G74 R1
                    N50 G74 Z-60 Q30000 F0.1
                    N60 G00 X100 Z100
                    N70 M30
The above cnc program code shows that the tool no.5 which is a drill, will drill the component with the peck drilling cycle G74.
The R in first block shows the amount ( 1mm) the drill will get back after it drills 30 mm every time.

CNC Programming Examples - Intermediate Level

Fanuc G81 Drilling Cycle 

G81 drilling cycle is used for simple drilling/spot drilling operations.

* Best ebooks for CNC programming: 
CNC Programming Basics 
G-Code and M-Code 
CNC programming 
G-Code Reference 
CNC Machine Tutorial 

Syntax

G81 X... Y... Z... R... K... F...
Parameter Description
X Hole position in x-axis.
Y Hole position in y-axis.
Z Depth, tool will travel with feed to Z-depth starting from R plane.
R Position of the R plane.
K Number of cycle repetitions (if required) .
F Feedrate.
Once G81 drilling cycle is defined, the canned cycle is repeated at every X-Y position in sequential blocks. So G81 drilling cycle must be cancelled with G80.

Usage

N30 G81 X10 Y30 Z-17 R2 F75
        N40 Y10
        N50 X30
        N60 Y30
        N70 X90
        N80 Y10
        N90 G80
In the above example drilling will start with G81 drilling cycle at X10 Y30, so first drill will be at X10 Y30, then second at Y10, third at X30, fourth at Y30, fifth at X90 and the last one at Y10, because next block have G80 code, so drilling cycle will no more be repeated.

Working

Here is briefly described how G81 drilling cycle operates,
1- Rapid traverse to the specified x,y axis position (drilling position).
2- Rapid traverse to the R plane position.
3- Drilling with specified Feed from R-plane position to Z-depth position.
4- Rapid traverse to Initial level or R-plane depends on G98, G99 modes.

G81 drilling cycle working

G98 G99 Modes

After completing drilling depth the return is made with Rapid feed, the return height can be controlled through using G98 or G99.
G98 Drill will return to the Initial level
G99 Drill will return to R-plane.
G98, G99 can be used multiple times during G81 drilling cycle.

Example

N30 G81 X10 Y30 Z-17 R2 F75
        N40 Y10
        N50 G98 X30
        N60 G99 Y30
        N70 X90
        N80 Y10
        N90 G80

Repeat Drilling

With G81 drilling cycle drilling operation can be repeated multiple times. The drilling is repeated K times when that parameter is given with G81 drilling cycle.
Repeat drilling is normally used with G91 Incremental mode, and a good example of repeated drilling is Grid-plate drilling. the example for repeat drilling  is given below.

Working Examples


G81 Drilling Cycle Example
N10 T1 M06
        N20 G90 G54 G00 X30 Y25
        N30 S1200 M03
        N40 G43 H01 Z5 M08
        N50 G81 Z-10 R2 F75
        N60 X80 Y50
        N70 G80 G00 Z100 M09
        N80 M30

G98 G99 Example


G81 drilling cycle usage with G98 G99
N10 M06 T1
        N20 G90 G00 X12.5 Y10 Z12 S1000 M03
        N30 G99 G81 X12.5 Y10 Z-17 R2 F75
        N40 Y30
        N50 G98 X57.5
        N60 G99 Y10
        N70 G91 G80 G28 X0 Y0 Z0 M05
        N80 M30

Repeat Drilling Example


Repeat drilling with G81 Drilling Cycle
T1 M6
        G00 G90 G40 G21 G17 G94
        G54 X0 Y0 S1000 M03
        G43 H1 Z100
        Z3
        G81 G99 G91 X20 Y20 R3 Z-20 K3 F100 M08
        G80
        G00 G90 Z100
        M30
OR
T1 M6
        G00 G90 G40 G21 G17 G94
        G54 X20 Y20 S1000 M03
        G43 H1 Z100
        Z3
        G81 G99 R3 Z-20 F100 M08
        G91 X20 Y20 K2
        G80
        G00 G90 Z100
        M30

----------


Drilling Grid Plate with G81 Drilling Cycle – Sample CNC Program

CNC machine workshops deal with variety of components, of course cnc machinists program and machine them.
But a cnc machinists also should understand and practice new and economical ways to machine a component.
The following cnc programming example can be programmed in variety of ways, the method of cnc programming used in this cnc program sample uses G81 drilling cycle with G91 Incremental Programming mode, which makes programming easy.
Fanuc cnc control uses K with G81 drilling cycle to repeat drilling cycle.
Haas cnc controls use L to repeat G81 drilling cycle.
Following cnc program is written for haas cnc machine but can easily be converted for Fanuc cnc controls.
You might read other cnc programming example which shows the same technique for Fanuc cnc controls
  • G81 Drilling Cycle – Repeat Drilling in G91 Incremental Mode Example Code
  • Repeat Drilling with G81 Drilling Cycle and G91 Example Program

CNC Program of Drilling Grid Plate


Drilling Grid Plate with G81 Drilling Cycle
03400      (Drilling grid plate)
        T1 M06
        G00 G90 G54 X1.0 Y-1.0 S2500 M03
        G43 H01 Z.1 M08
        G81 Z-1.5 F15. R.1
        G91 X1.0 L9
        G90 Y-2.0   (Or stay in G91 and repeat Y-1.0)
        G91 X-1.0 L9
        G90 Y-3.0
        G91 X1.0 L9
        G90 Y-4.0
        G91 X-1.0 L9
        G90 Y-5.0
        G91 X1.0 L9
        G90 Y-6.0
        G91 X-1.0 L9
        G90 Y-7.0
        G91 X1.0 L9
        G90 Y-8.0
        G91 X-1.0 L9
        G90 Y-9.0
        G91 X1.0 L9
        G90 Y-10.0
        G91 X-1.0 L9
        G00 G90 G80 Z1.0 M09
        G28 G91 Y0 Z0
        M30
In above cnc program G90 Absolute programming mode is used while starting a new row for drilling. Although G91 Incremen0tal programming can be used but using G90 there makes this program easy to read understand and debug (if anything goes wrong).

-----------

Repeat Drilling with G81 Drilling Cycle and G91 Example Program

Here is another G81 drilling cycle programming example which illustrates the use of repeat drilling in G91 Incremental Programming Mode.
Other CNC program example is here G81 Drilling Cycle – Repeat Drilling in G91 Incremental Mode Example Code

Repeat Drilling with G81 Drilling Cycle


Repeat Drilling with G81 Drilling Cycle and G91
O1000
            T1 M6
            G00 G90 G40 G21 G17 G94
            G54 X20 Y10 S1000 M03
            G43 H1 Z100
            Z3
            G81 G99 R3 Z-20 F350 M08
            G91 X10 Y10 K4
            G80
            G00 G90 Z100
            M30

---------

G81 Drilling Cycle – Repeat Drilling in G91 Incremental Mode Example Code

This cnc program example explains the use of G81 Drilling cycle but this time the tool is not positioned in the usual way (G90 absolute programming mode) but this time G91 Incremental Programming Mode is used.
This programming example code also explains the use of G81 drilling cycle parameter K (number of repeats), which is not normally used.
Contents
  • G81 Drilling Cycle Format
  • CNC Code G81 Drilling Cycle with G91 Inremental Programming
    • Explanation

G81 Drilling Cycle Format

G81 X_ Y_ Z_ R_ F_ K_ ;
X_ Y_: Hole position data
Z_ : Z-depth (tool will travel with feed to Z-depth starting from R plane)
R_ : The distance from the initial level to point R level
F_ : Cutting feedrate
K_ : Number of repeats (if required)
G81 drilling cycle parameter K (number of repeats). On different cnc controls this parameter has different letter assign to it such as on,
  • Fanuc uses letter K for number of repeats.
  • Haas CNC uses letter L for number of repeats.
  • Fagor CNC Control uses letter N for number of repeats.
Incremental motion in canned cycle is often useful as a loop count, which can be used to repeat the operation with an incremental X or Y move between each cycle.

CNC Code G81 Drilling Cycle with G91 Inremental Programming


G81 Drilling Cycle – Repeat Drilling in G91 Incremental Mode Example Code
N10 T1 M6
                N20 G00 G90 X0 Y0 Z0
                N30 S1450 M03
                N40 G81 G99 G91 X50 Y50 Z-120 R-98 K3 F350
                N50 G98 G90 G00 X500 Y500
                N60 G80
                N70 G90 X0 Y0
                N80 M30

Explanation

N40 G81 G99 G91 X50 Y50 Z-120 R-98 K3 F350
K3 means that the G81 drilling cycle will repeat three times.
G91 Incremental mode makes the tool to move every time X50 and Y50
So first hole will be at X50 Y50
Second hole will be at X100 Y100 because
X100 = X50(previous value) + X50 (increment)
Y100 = Y50(previous value) + Y50 (increment)
Third hole will be at X150 Y150 because
X150 = X100(previous value) + X50 (increment)
Y150 = Y100(previous value) + Y50 (increment)
N50 G98 G90 G00 X500 Y500
The fourth hole position is given with G90 Absolute Programming Mode.
The above code is only possible if you use G91 Incremental Programming Mode with G81 Drilling cycle, but if you try to use G90 Absolute Programming Mode with G81 as above you will see the tool will repeat drilling at the same position