CNC Programming
CNC Programming
The CNC-7, like all Excellon machines, has a set of part programming codes that can be used to control the machine for
drilling, toolchanging, setting up machine parameters (such as feeds and speeds), and routing (if so equipped). Also, like
other Excellon machines, the part program codes are backward compatible. This means that part programs from a CNC-
2,4,5 or 6 can be run on your CNC-7 without modification. Since newer controls contain new features, the reverse is not
necessarily true (You may not be able to run all CNC-7 programs on a CNC-2,4,5 or 6). Part programs are simply data files,
coming from any one of a variety of sources or devices. This chapter will detail all available part program codes available
for your use.
Where to rout
Additionally, if the programmer wants to change the speed of the direction of a particular tool of the worktable, without
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 2 of 49
stopping the machine, the change must be made in the part program. Examples of these changes are:
Example of a Header
Below is a sample of a header. The PURPOSE shown to the right of the COMMAND is not part of the command, but is
shown for your benefit to explain the command:
COMMAND PURPOSE
M48 The beginning of a header
INCH,LZ Use the inch measuring system with leading zeros
VER,1 Use Version 1 X and Y axis layout
FMAT,2 Use Format 2 commands
1/2/3 Link tools 1, 2, and 3
T1C.04F200S65 Set Tool 1 for 0.040" with infeed rate of 200 inch/min Speed of 65,000 RPM
DETECT,ON Detect broken tools
M95 End of the header
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 3 of 49
Rewind Stop
%
% Defines the end of a part program header. Either this command or the M95 command must follow the last header
command in the part program header. This tells the CNC-7 where the header ends. When this command is used, the
machine will stop at the end of the header and await your action. You may enter any appropriate Keyboard commands
and/or press CYCLE START to continue.
Note: This command has a different meaning when used in the part program body.
COMMAND DESCRIPTION
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 4 of 49
Duplicate Commands
If you have a command in the header and the exact same command in the part program body, there is no harm done. Nor
will it matter if you enter the exact same command from the keyboard. In each case, because the commands do not
contradict each other, the performance of the machine will not be affected.
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 5 of 49
COMMAND DESCRIPTION
A# Arc Radius
B# Retract Rate
C# Tool Diameter
G84 Circle
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 6 of 49
G85 Slot
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 7 of 49
S# Spindle RPM
/ Block Delete
G05 G81
M00 M02
M01 M24
M02 M26
M06 M01
M08 M27
M09 M00
M02X#Y#M70 M26X#Y#M23
M72 M70
M02X#Y#M80 M26X#Y#M21
M02X#Y#M90 M26X#Y#M22
R#M02 R#M26
X and Y Coordinates
The location on the PC board where a hole is to be drilled or a router begins or ends a move is called a coordinate. A
coordinate is a pair of measurements used to locate that point. It is measured along an axis which runs from the front to the
back of the machine, and an axis which runs from left to right. These axes are perpendicular to each other and are known
as the X and Y axis. When the machine is not in the routing mode, the coordinate is also the command for a drill bit to
plunge into the panel and drill a hole. The coordinate tells the CNC-7 to move the spindle to the location and drill. There are
two ways to move from coordinate to coordinate and you must choose one of them when you are programming. The two
ways are absolute and incremental. Absolute means that every coordinate is measured to the same location on the board.
This location is called work zero. Incremental means that every coordinate is measured to the previous coordinate. Unless
you specify otherwise, the CNC-7 runs in the absolute mode, and part programs must be programmed for absolute. When
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 8 of 49
you program in the incremental mode, include the ICI,ON command in the part program header, or in the MACH.DAT file.
The following illustrates how a set of holes are programmed in either absolute or incremental mode. Note that when either
the X or Y coordinate does not change from one hole to another, it does not have to be repeated.
ABSOLUTE INCREMENTAL
XY XY
Y01 Y01
Y02 Y01
X012Y032 X012Y012
X024Y044 X012Y012
X034 X01
You specify the coordinate measurement you want by using the METRIC or INCH command in the program header. When
the program is running on the machine, all X and Y coordinates will be displayed on the screen in the form you have
chosen. Additionally, all other measurements will be displayed in this form, including the following:
Feed Rate
Tool Diameter
Rout Depth
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 9 of 49
Depth Offset
Routing Distance
X0075 Correct
Y014 Correct
Here are some examples of using the trailing zero inch mode:
The rules for typing leading and trailing zeros for other commands are discussed under each command.
Decimal Places
Decimals are not needed in either INCH or METRIC modes. But if you do use them, the decimal point will automatically
override leading zero or trailing zero mode. Coordinates can be typed with or without the decimal. If you use the decimal
and the coordinate distance is less than one inch or one centimeter, you can eliminate the zeros to the left of the decimal.
For example, in the INCH format:
X.075 Correct
The same applies to the METRIC format with three and four zeros to the left of the decimal. But in either case, if you have a
whole number to the left of the decimal, it must be included. For example:
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 10 of 49
Y1.45 Correct
If you choose to type coordinates without the decimal, all zeros to the left of the decimal must be shown. For example:
Tool Commands
There are several commands used to select and control tools. Some are used separately and others are combined to form a
single command. Whenever tool commands are used in the header, they are strictly for loading tool data into the CNC -7.
When tool commands are intended for tool changing or for machine movements, they must be in the body of the program.
The # in each command indicates that a number is to be used to designate quantity, distance, speed, etc. From one to six
digits are used, depending on the command. The number of the tool specified with the tool command is the same as the
tool number on the Tool Data Page.
Tool Commands
Tool Selection
T#
T# is used to specify which tool is to be used next in the manual or automatic tool change mode. It may be used in the part
program header or body, or an M02 block step and repeat patterns. On machines with automatic tool change, the spindle
will put away the tool it is using, pick up the tool number you specify in the place of #, and move to the next coordinate in
the part program. On machines with manual tool change, the worktable will move to the part position and stop. The screen
will display the message in the Machine Status box. After changing the tool, you press the CYCLE START button and the
machine resumes operation. Tool numbers 1 through 9 may be specified with or without a leading zero. (e.g. 01 or 1)
Examples of usage:
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 11 of 49
counterclockwise direction, however, you might need to use a diameter of 0.094". But you may not have such a diameter, or
it may not be possible or practical to switch tools. Instead, you can assign an index number for a tool with a diameter of
0.094" (Refer to the CP,#,#.# command in the Keyboard Commands chapter). When you identify the index number with your
0.092" diameter routing tool, the CNC-7 will offset the path of the tool as though it were 0.094" diameter.
The Compensation Index value must be entered before the rout mode is turned on (G00 command), and may not be
changed during routing moves.
Example of usage:
Z-Axis Infeed
F#
F# is used within a routing sequence to set the worktable feed rate, or in a drilling sequence to set the spindle (Z-axis)
infeed rate. Feed rate values are always entered in leading zero format, e.g.: F2 means 200 inches per minute, and F02
means 20 inches per minute. The value you assign in place of #, indicates inches per minute (IPM) or millimeters per
second (mm/s). Decimals are not to be used with this command. They will produce a message when the part program runs
on the machine. Drilling feed rates must be given to the CNC-7 or the machine will not run. The rate may be specified in the
Tool Data Page, or through the F# command. The F# command may also be entered at the Tool Data Page to change the
infeed rate for a particular tool.
The drilling feed rate can be set from 10 to 500 IPM (4 to 212 mm/s), in increments of 1 IPM (1mm/s). The routing table feed
rate can be set from 10 to 150 IPM (4 to 63 mm/s), in increments of 1 IPM (1 mm/s). If you do not set a feed rate, the CNC-7
will use a maximum rate of 100 IPM for any router.
Examples of usage:
T01F2 Tool number one with a spindle infeed rate of 200 IPM or 200 mm/s
Retract Rate
B#
B# is used to set the spindle (Z-axis) retract rate, e.g., the speed at which the tool is withdrawn from the work. Retract
values are always entered in leading zero format, e.g.: B02 means 200 inches per minute, and B002 means 20 inches per
minute. The value you assign in place of # indicates inches per minute (in/min) of millimeters per second (mm/s). Decimals
are not to be used with this command. They will produce a message when the part program runs on the machine. The B#
command may also be entered at the Tool Data Page to change the retract rate for a particular tool. A default retract rate is
established when the CNC-7 is started. If NO B# command is specified for a tool, the default retract rate will be used. The
default rate may be changed using the RTR keyboard command. The retract rate can be set from 10 to 1000 IPM (5 to 425
mm/s), in increments of 1 IPM (1 mm/s). Unless altered by the RTR command, the default retract rate is 1000 in/min (425
mm/s).
Example of usage:
T01B02 Tool number one with a spindle retract rate of 200 IPM or 200 mm/s.
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 12 of 49
Spindle RPM
S#
S# Sets the speed of spindle rotation. The value you assign in place of # indicates RPM in thousands. Trailing zeros are not
shown. The S# command may also be entered at the Tool Data Page to change the rate for a particular tool. The spindle
speed on most machines may be programmed from a minimum of 14,000 RPM to a maximum of 60,000 RPM for routers and
80,000 RPM for drilling tools. Some machines have spindles speeds greater than 100,000 RPM. When you specify a speed of
six digits on these machines, use a decimal point, followed by a number to indicate hundreds of RPM's. This command may
not be used by itself, but must be included in a tool selection block (T#S#).
Examples of usage:
T06F200S61 Tool number six with a feed rate of 200 IPM or 20 mm/s and a speed of
61,000 RPM
Tool Diameter
C#
C# is used to select the tool diameter necessary for certain machine canned cycles. When feed and speeds are not
specified with Tool Diameter, the CNC-7 will load them from the tool diameter table if a tool diameter table has been loaded.
The value you specify in place of # indicates the diameter in thousandths of an inch, or microns, depending on which
measurement mode the machine is set for. Trailing zeros are not shown. The C# command may also be entered at the Tool
Data Page to change the diameter of a particular tool. This command should not be used by itself but must be included in a
tool selection command block (T#C#).
Examples of usage:
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 13 of 49
Examples of usage:
Depth Offset
Z+# or Z-#
Z+# (or Z-#) Sets the Depth Offset for tools. This command is used in conjunction with T# command. Depth Offset may be
programmed for each logical tool. A mean depth, common to all tools, can be supplied through the part program header, or
by you through the keyboard, or through the LOWER LIMIT or ROUT DEPTH switches on the Touch Screen. The Depth
Offset is programmed as a deviation or offset from the mean depth. You supply the offset in place of #.
The offset value will be in inch or metric, LZ or TZ, depending on how the machine is set. The offset can be supplied in
increments of 0.001" (0.01mm). Decimal mode may be used. Plus signs (+) may be omitted, but minus signs (-) must be
used to indicate negative values. A positive value offsets the depth of the tool above the mean depth set by you or the part
program header. A negative value represents a distance below the mean depth.
Depth Offset permits control of drill penetration depth into the backup material. A large tool Depth Offset, requires a greater
penetration depth than does an intermediate size tool, or a small tool. Accurate penetration depth is necessary to ensure
that the tool chamfer clears the back of the last circuit board in the stack being drilled. The mean depth, plus the
programmed Depth Offset, gives you the actual depth for that tool. The resulting actual depth must not be less than zero
because this represents the lower limit of Z-axis (spindle) travel. A minimum Z-axis stroke length must be maintained.
Therefore, the actual depth must be at least 0.125" (3.18mm) lower than the Upper Limit set.
The Z# command may also be entered at the Tool Data Page to change the depth offset for a particular tool. Depth Offsets
may be included with preprogrammed infeed and speed information through the keyboard or a part program header.
Offsets can also be stored on the Diameter Page. The Depth Offset may also be included in a part program as part of an
integral feed and speed block.
Examples of usage:
T01C00125Z-00001 Sets drill penetration depth for tool 01 to 0.001" below the mean
depth
T02C0009Z Sets drill penetration depth for tool 02 to the mean depth
T03C00008Z00002 Sets drill penetration depth for tool 03 to 0.002" above the mean
depth
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 14 of 49
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 15 of 49
When several tool commands are combined into one, the order of their appearance in the combined command can be very
important. The CNC-7 reads the command from left to right. The commands on the left can be overridden by the commands
to the right.
For example, look at the following two sample commands:
T01F190S73C.038 T01C.038F190S73
Both commands contain the same information, but in a different order. In the first example, the CNC-7 selects tool 01, sets
the feed at 190 IPM, sets the spindle speed at 73,000 RPM, and then is told that the diameter of the bit is 0.0038". The CNC-7
will now look at the Tool Diameter Page and use the feed and speed listed, if any, in the table. It may ignore the feed and
speed you specified in the command. In the second sample, the opposite is true. The CNC -7 selects tool 01, looks in the
Tool Diameter Page for a drill bit of 0.0038" diameter, then sets the feed at 190 IPM and the speed at 73,000 RPM. The feed
and speed in the Diameter Page will be ignored.
Tool Changing
If you have only manual tool changing on your machine, then you must specify in the part program when you want to
change the tool. If you have automatic tool change on your machine, you need to specify not only when to change tools,
but which tool the spindle is to pick up. Changing a tool is a simple matter. When you get to the point in the program where
the tool is to be changed, just type in a tool command and specify which tool is to be used for the next operation. Nothing
has to be said about the tool that you are dropping. If you need to have a special RPM or infeed rate used with the tool,
include it with the tool command.
Rout Mode
G00
G00 turns the routing mode on and the drilling mode off. This command is required before any routing can be performed.
An X and Y coordinate must be provided to move the worktable to a starting point for routing. When the CNC-7 encounters
this command, the worktable moves to the X,Y coordinate. The spindles will not plunge into the work until a plunge
command (e.g. M15) is given. Compensation is automatically turned off during the move and can be turned on again after
the move. The G00 command remains in effect until another G00 command, or a G01, G02, G03, or G05 command is
encountered. Do not use this command when the Z-axis is in the rout position. The tool can be damaged by a high speed
move.
Format: G00X#Y#
Drill Mode
G05
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 16 of 49
G05 turns the routing mode off and returns to the default drill mode. This command is programmed in a block by itself and
remains in effect until a G00 is encountered. G05 is not needed if routing has not been turned on by any rout command in
the part program. Any coordinates following the G05 command will cause the worktable to move at maximum velocity to the
command position and perform a drill stroke. The spindles will start to rotate above the tool holders with Automatic Tool
Change (ATC) ON, and at the Drill Ready position with ATC OFF.
Special note: The G81 command, when used in Format 1, is equivalent to the G05 command. The G81 command, when used
in Format 2, becomes equivalent to the G82 command.
Routing Commands
Excellon has developed a series of fourteen commands which are used strictly for routing. Each of these commands are
presented here.
Linear Move
G01
G01 turns on linear interpolation mode. This means that the machine will begin routing in a straight line. If you supply an X
and/or Y coordinate with the command, the machine will rout a straight line from the current position to the coordinate
position. If you do not supply coordinates, the CNC-7 will look for coordinates in a succeeding block, and rout to the first
coordinate found. Unless a different rate has been set, linear movement will occur at a default rate of 100 IPM (42.3 mm/s) at
100% feed rate. This can be overridden with the F# command, described in the Tool Commands section of this chapter, or
with the FEED RATE buttons on the Touch Screen.
Format: G01(X#)(Y#)
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 17 of 49
X025567Y020567 Circular
counterclockwise move
with 0.075" radius
3 G03X0245Y021A00075 Sets radius to 0.075"
X025567Y020567 Circular
counterclockwise move
X0246Y0154A0015 with 0.075" radius
Circular
counterclockwise move
with 0.15" radius
Arc Radius
A#
A# Specifies the arc radius of a circular move. You specify a radius in place of #. The digits you supply will be in inch or in
metric mode, however the system is set. The arc radius command is used in conjunction with the G02, G03, G32, or G33
commands discussed in this section. If the radius you specify does not fit the X,Y coordinates supplied with these
commands, the CNC-7 will adjust the arc to fit the coordinates. The following figure shows how the arc is adjusted.
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 18 of 49
Note: Cutter compensation is always used. Commands G32 and G33 must be used for each inside circle to be cut. The
pattern repeat code P cannot be used with these two commands. The G32 and G33 commands cause the machine to plunge
0.01 inch (0.254mm) off the edge of the circle, rout 540 degrees in the appropriate direction, end up 0.1 inch (2.54mm) off the
edge of the opposite side of the circle, and retract. The Feed command (F#) may be entered in the block prior to the G32 or
G33 commands to set the Table Feed Rate.
For example:
G00
F02
G32X04Y04A005
G00X#Y#
M15
Y2
Y1
XrYr
M17
Note: If a specific controlled table feed rate is desired, the G32 or G33 must be preceded with a G00 block containing the
feed rate.
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 19 of 49
G40
G41
G41 turns cutter compensation on for the tool being used to rout. The compensation path is left of the part relative to the
direction that the tool is moving.
THIS COMMAND MUST NOT BE USED WHILE PLUNGED! A Compensation Index must be specified on the Cutter
Information Page for the tool being used. Without an Index there will be no compensation applied to the tool after
compensation is turned on. A value must be assigned to the index number. Compensation will continue for all routing
moves until a G00, G40, or G42 command is encountered, or the part program ends. The command must be programmed in
a block by itself.
Example of usage:
G41
Example of usage:
G42
M14
M14 is provided for routing machines equipped with the optional router depth control scale. The M14 command performs
the same function as the M15 command and also enables Depth Control Contouring. The command causes the spindle to
plunge to the Rout Down position, the position from which rout moves are made. The vacuum is turned on and Depth
Controlled Contouring is enabled. To perform Depth Controlled Contouring, depth control must be enabled and the tool
must be declared as a depth controlled tool. A depth controlled plunge will be performed, where the machine senses the
touchdown of the pressure foot to determine the proper depth. Throughout the cut, the height of the material is
continuously monitored. The spindle height is adjusted automatically to maintain a constant depth into the material. Depth
Controlled Contouring is turned off by G32/G33 and M15 commands, and at End of Program. With the exception of the G32
and G33 commands, a rout position command must be used before any rout moves are made. When a rout move is
complete, the spindles are retracted, and the worktable moves to another rout position. A rout position command must then
be used again before starting the rout move.
Most PC boards have integrated circuits installed in them. These circuits use a pin pattern that is standard throughout the
electronics industry. By using a simple command, you can type the coordinates of two pin holes and the CNC -7 will
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 21 of 49
automatically drill the rest. This is called a "canned cycle". Excellon has supplied you with commands for drilling a large
hole or a slot when you don't have a router to use. These are also canned cycles.
Excellon has built five canned cycles into system software for your use:
Dual In Line Package 8 Pin Circular L Package Drill a large hole with a drill bit Drill a slot with a drill bit
Each of these cycles is described below.
Format 2 Format 1
G82/G81(X#Y#) G82(X#Y#)
X#Y# X#Y#
X#Y# X#Y#
Note: Do not use the G82 command to program square packages. Since the G82 command is only given the two corners of
the pattern, it will not know which side to put the pins on. You may also see different results from one machine type to
another. Use the repeat hole commands to generate square patterns where necessary.
Canned Circle
G84
G84 Cuts a hole by drilling a set of overlapping holes around the circumference of a circle. The hole is programmed by
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 22 of 49
specifying the center of the circle with an X and Y coordinate, followed by another G84 command, followed by an X
dimension which specifies the diameter of the circle in thousandths of an inch or microns. This command must be in one
block. It may not be broken up onto different lines (blocks) of the part program. The smallest hole diameter allowed is twice
the tool diameter. If a smaller diameter is specified, the CNC-7 will display a message on the screen. The CNC -7 will use the
drill size found in the tool diameter table to compensate the cutting radius. If the size is zero (not specified), a 0.125
diameter will be assumed by the CNC-7. Drilling overlapping holes around the circle creates a hole. This leaves protrusions
around the edge of the hole. The holes are spaced close enough that these protrusions are less than 0.0005".
Format: X#Y#G84X#
Slot
G85
G85 Cuts a slot by drilling a series of closely spaced holes between two points. The start of the hole is programmed with an
X and Y coordinate, followed by the command, followed by the ending X and Y coordinate. The tool is specified with a T
command prior to the G85 command. The tool size MUST be specified prior to using this command. The size may be
provided by the Operator through the console, in the part program body, or the part program (M48) header. The slot is as
wide as the drill bit used. The slot is created by drilling a series of evenly spaced adjacent holes from one end of the slot to
the other. This leaves protrusions around the edge of the hole. Then another set of spaced holes is drilled between the
previous set. This continues until a smooth sided slot has been produced. The holes are spaced close enough that these
protrusions are less than 0.0005".
X1Y1G87X2Y2Z-
#U#
Where:
X1Y1 - Start of slot X2Y2 - End of slot Z-# - Depth increment (must be a negative value) U# - Initial depth offset
The beginning and ending points (X1Y1, X2Y2) define the center of the slot at each end. Cutter compensation is NOT
applied during step slot routing. The final depth of the slot must be specified according to the current depth mode, prior to
the G87 block. This may be done either within or outside of the part program. G87 supports all depth modes, i.e. depth
control and non-depth control routing. The initial depth (U code) is given as a positive offset above the final depth. The
depth increment (Z code) is a negative value specifying the distance the cutter will plunge each pass through the slot. Note
that the final plunge distance may be reduced in order to complete the slot at the proper depth. The G87 command
internally generates the following program sequence:
G40
T#Z#
G00X1Y1
M15
G01
X2Y2
G00X2Y2
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 23 of 49
T#Z#
G00X2Y2
M15
G01X1Y1
G00X1Y1
. . . M17
Each M15 advances the cutter deeper into the slot until the desired depth is reached. Note that the spindle is not raised
until the slot is completely routed.
T6Z-.05 Pick up tool 6 and set the rout depth at .05 inches into the
backup
X05Y06G87X05Y07Z-.1U.2 Rout a 1 inch long slot (Y axis). The machine will rout the
slot in 3 passes at the following depths: 1st pass: .15 inches
above the backup 2nd pass: .05 inches above the backup
3rd pass: .05 inches into the backup
Note: The pattern repeat 'P' code cannot be used with this command.
Format: X#Y#G87X#Y#Z-#U#
Creating a Pattern
Patterns are created by using the Editor to type a set of X and Y coordinates. Drilling patterns locate the coordinates of
each hole to be drilled. Routing patterns locate the coordinates of rout moves. Coordinates may be programmed in either
absolute or incremental mode, the same as the part program. For example, if the part program is written in the incremental
mode, the user defined pattern must also be incremental. It is also important to know which version of X and Y coordinates
are used by the part program. Version refers to the direction of X and Y coordinates. The version of your user defined
pattern must be the same as your part program. Otherwise the worktable will move in the wrong direction when it drills or
routs the pattern. Once you have programmed the set of coordinates, store them as a file on the system software disk. The
following figure shows how to program the coordinates for 10 pin pattern. This is a sample to illustrate the form of a pattern
and how to program it. The coordinates are shown in both absolute mode with leading zeros and incremental mode with
trailing zeros.
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 24 of 49
name will be the name of the file on one of the system's devices. Along with the filename, specify the device to be used.
You must specify which device you want the file stored on. Typically, you will want the M99 patterns stored with the non-
replaceable data in USER (on the hard disk), or on the floppy disk containing the part program which calls the M99 file.
Each file name must be different (unique), should relate to the purpose the file was created for, and should not be too long.
Rules and guidelines for naming the files are covered later in this chapter.
Repeating a Hole
Some electrical components have so may variations of pin quantities that it would be highly impractical to create a user
defined pattern for each one. As an alternative, the repeat hole command lets you locate the first pin hole and let the CNC-7
drill the rest without a stored pattern.
Repeat Hole
R#
This command drills a series of equally spaced holes from the previously specified hole. The number following the R (up to
four digits) specifies the number of repeats. An X and/or Y coordinate must be used to define the spacing between hole
centers. These coordinates must be in the same block as the R: they may not be on a separate line.
Examples of usage:
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 25 of 49
This method may be easier than developing a stored pattern with 32 coordinates.
Format: R#X#(Y#)
Canned Text
M97
It is possible to drill a series of holes that spell out words or numbers. The M97 and M98 commands allow you to program
the CNC-7 to write a message on the board. This feature can be used to:
The machine will drill a series of holes to spell out the message you supply in place of text. M97 drills the text along the X+
axis and the M98 drills along the Y+ axis.
The characters you can use are:
A through Z
0 through 9 + - / *
Both commands will start drilling at the X,Y coordinate which follows the command. If no tool diameter is specified in the
Tool Page, the CNC-7 will use the default letter height of 0.25", and will drill the holes 0.0417" apart. If a diameter is
specified, the holes that make up the characters will be spaced 1.2 diameters between hole centers. The characters are
drilled on a 4x7 grid (4 columns in 7 rows).
Format:
M97,text X#Y#
M98,text X#Y#
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 26 of 49
Canned text
Following are step and repeat commands with an explanation of how to use them.
Beginning of Pattern
M25
M25 indicates the beginning of the part program section which is to be repeated. These commands do not actually cause a
repeat action by themselves, but work in conjunction with the M01 and M02 commands. The M25 and % commands are
equivalent, and are programmed in a block by themselves.
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 27 of 49
End of Pattern
M01
M01 indicates the end of the part program section which is to be repeated. This command is programmed in a block by
itself.
Format 2 Format 1
M01 M24
Format 2 Format 1
M02X#Y# M26X#Y#
Format 2 Format 1
M08 M27
Repeat Block
R#M02
R#M02 is used in place of the M02 command, discussed above, for a pattern which has the same X coordinate or the same
Y coordinate as the previous pattern. It is useful when making a column of evenly spaced parts. The number following the R
indicates the number of repetitions of the pattern. You specify the coordinate (X# or Y#) which changes. The X or Y
coordinate which does not change can be left out of the command, at your option. The Repeat Block command may be
used with the mirror image or swap axis commands which are discussed in the next section. The following figure illustrates
the use of this command to produce a column of patterns with the same Y coordinate. The repeat pattern offset M02
command is also shown for comparison. They will both produce the same column of patterns.
Format 2 Format 1
R#M02X#Y# R#M26X#Y#
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 28 of 49
Swap Axis
M70
Mirror Image and Swap Axis
You can make better use of PC board materials and reduce setup time by turning the axis of the boards by 180 degrees, or
by reversing the axis to create a mirror image, or both. Excellon provides you with three commands which enable you to
reverse and/or rotate the axis of a pattern, or an entire PC board. These commands are step and repeat commands and
must be used in combination with the M25 and M01 commands, described earlier in this chapter. The swap rotates the
pattern 90 degrees and makes a mirror image by changing the X axis to Y, and the Y axis to X. This command is used in a
step and repeat offset block only, as shown.
Format 2 Format 1
M02X#Y#M70 M26X#Y#M23
Format 2 Format 1
M02X#Y#M80 M26X#Y#M21
Format 2 Format 1
M02X#Y#M90 M26X#Y#M22
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 29 of 49
stored pattern routs an L shaped hole, and an M01 commands marks the end of the pattern. Next an M02 offsets Work Zero
by the distance X#Y#, and another M02 repeats any pattern between itself and the M25 command. Then an M01 ends the
repeat. This produces a total of two patterns. A third M02 offsets Work Zero by the distance X#Y#, and a fourth M02 repeats
any patterns between itself and the M25 command. There are now four patterns in this category, so four patterns are
repeated. Then an M01 ends the repeat. This produces a total of eight patterns. An M08 ends the step and repeat.
Setup Commands
Setup commands speed set -up and reduce operator involvement when preparing your machine for a new job. As with all
Excellon commands, parentheses () are used to indicate options. These commands must be used in the part program body.
They cannot be used as keyboard commands.
The following table provides a list of each of the setup commands in the order they are detailed below.
COMMAND DESCRIPTION
Absolute Mode
G90
G90 Sets absolute measuring mode, which causes all coordinates to be referenced to work zero. G90 must be programmed
in a block by itself.
Incremental Mode
G91
G91 Sets incremental mode, which causes all coordinates to be referenced to the last coordinate. This mode does not
change Work Zero.
The computer accumulates the coordinates into absolute dimensions, starting from Work Zero. The incremental
accumulators are cleared at the end of a step-and-repeat pattern, the end of the program, or by a system reset. Clearing the
accumulators sets them back to Work Zero. G91 is programmed in a block by itself.
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 30 of 49
Zero Set
G93
G93 Sets work zero relative to absolute zero. You supply a coordinate value in place of #. The CNC -7 adds the zero set
coordinates to the zero correction and false zero to set up the new work zero (zero set + zero correction + false zero = work
zero). The adding together of separate values allows the user to build part programs that will run on any Excellon machine,
regardless of the tooling configuration.
Format: G93X#Y#
Operator Message
M47
M47 halts automatic operation of the machine and lights the red CYCLE STOP indicator light. The message you supply in
place of text is displayed on the console screen, along with the M47 block. You may supply up to 20 numbers or letters for
text. When the operator presses the CYCLE START button, the program will resume. This command can be used to identify
a part program before the operator runs it.
Format: M47,text
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 31 of 49
M60
M60 Enables Reference Scaling. Any drilled hole coordinates following this command will be adjusted per the Reference
Scaling values entered by the operator and displayed on the Reference Scaling page. This command allows the part
program to enable Reference Scaling under part program control so that certain coordinates can be scaled, others not. This
part program command is equivalent to entering the SCLR,ON keyboard command to enable Reference Scaling.
Format: M60
Format: M61
Format: M62
Format: M63
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 32 of 49
system when starting the machine or after a toolchange. These do not have to be programmed with an M18 command. The
M18 is normally not needed for Depth Controlled drilling, but may be useful under certain special circumstances. For
example:
1) When doing testing and you want to collect data about a number of tool tip checks without going through toolchanges.
2) When doing extremely critical depth controlled drilling where you are concerned about compensating for normally
minimal factors, such as thermal spindle growth or drill wear.
M18 has no effect if Depth Control is not enabled, or if Depth Control is not on for the particular tool in question.
Format: M18
Stop Commands
Stop commands are used to temporarily stop the running of the part program or to indicate the end. Many of these
commands may contain X and Y coordinates which cause the worktable to position but not to drill. If the coordinates you
specify in the commands exceed the worktable limits, the limits will override your coordinates.
NOTE: In each of these stop commands, the coordinate (which you provide) is relative to absolute zero, not work zero.
Absolute zero is in the X and Y version (1 through 8) which is currently selected. As with all Excellon commands,
parentheses () are used to indicate options. Each command is entered by pressing the RETURN key after typing the
command. The following table provides a list of each of the setup commands, in the order they are detailed below.
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 33 of 49
COMMAND DESCRIPTION
Variable Dwell
G04
G04 Halts the machine for the time you specify in place of #. This command is used, for example, to cool a router bit after a
long cut. The dwell time is interpreted as 1 millisecond per increment in the current coordinate measurement mode (inch or
metric). The dwell time may be programmed from 1 to 10 seconds of 1 msec. If you program beyond these limits, or if you
do not supply a value, the dwell time defaults to 10 seconds.
Format: G04X#
Example of usage:
G04X001 = 1 second
If you supply a coordinate (X#Y#), the worktable will move to that position relative to absolute zero. If you do not provide a
coordinate, the machine stops in its current location (it does not self park). Pressing the CYCLE START button will continue
the program.
Format:
Format 2 Format 1
M09(X#Y#) M00(X#Y#)
Optional Stop
M06
M06 this command is similar to the Stop for Inspection command, with the exception that the operator must turn the
function on at the keyboard. When the operator types the OSTOP,ON command before the M06 command is encountered,
the machine will stop for inspection. If OSTOP is OFF, the CNC-7 will ignore the M06 command. To continue the part
program after an optional stop, the operator presses the CYCLE START switch.
Format:
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 34 of 49
Format 2 Format 1
M06(X#Y#) M01(X#Y#)
Format 2 Format 1
M00(X#Y#) M02(X#Y#)
A through Z
0 through 9
?%-$!
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 35 of 49
The characters space, tab, comma, quotes and backslash, as well as "&@(){}[]<>" are specifically prohibited.
Forward slashes - "/" - usually will not work, since the operating system takes this character as a directory identifier.
S=Speed
B=Retract
H=Max Hits
18. T2C.032F070S70B0700H2000
19. T3C.043F160S53B1000H3000
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 36 of 49
20. T4C.052F132S44B1000H3000
21. T5C.062F109S36B1000H3000
22. T6C.070F099S33B1000H3000
33. R9X0005
34. Y0105
35. R9X-0005
43. G83
45. X007Y041
46. G83
47. X011Y041
48. X015Y041
50. X03Y05G85X03Y047
51. X034Y046G85X031Y046
52. X03Y042G85X03Y045
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 37 of 49
55. X032Y047G85X033Y049
56. X031Y045G85X033Y043
57. X029Y049G85X027Y043
58. X027Y049G85X029Y047
59. M97,COMPLEX,PART,PROGRAM
63. M97,EXCELLON,AUTOMATION
66. G82
68. X012Y036
69. G82X.1Y.4
71. X033Y036
72. G82X.2Y.5
74. X054Y038
75. G82X.1Y.6
77. X055Y029
78. G82
80. X04Y048
84. X01Y018
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 38 of 49
86. R4X001
102. G91
103. Y001
104. Y001
106. Y001
107. Y001
108. X001
109. X001
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 39 of 49
X012Y007
R2X001
R2Y-001
R5X-001
R2X001Y001
126. R5Y-001
127. R4X-001
129. R4X.1Y.1
131. R4X-.1Y-.1
132. R3X-.1Y.1
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 40 of 49
you can use one set of landmarks to compensate the approximate panel locations, and nested functions to
find precise targets within the panel. As with all Excellon commands, parentheses () are used to indicate
options. These commands must be used in the part program body. They cannot be used as keyboard
commands. The following table provides a list of each of the vision commands in the order they are detailed
below.
COMMANDS DESCRIPTION
G34,#(,#) Select Vision Tool
G35(X#Y#) Single Point Vision Offset (Relative to Work Zero)
G36(X#Y#) Multipoint Vision Translation (Relative to Work Zero)
G37 Cancel Vision Translation or Offset (From G35 or G36)
G38(X#Y#) Vision Corrected Single Hole Drilling (Relative to Work Zero)
G39(X#Y#) Vision System Autocalibration
G45(X#Y #) Single Point Vision Offset (Relative to G35 or G36)
G46(X#Y#) Multipoint Vision Translation (Relative to G35 or G36)
G47 Cancel Vision Translation or Offset (From G45 or G46)
G48(X#Y#) Vision Corrected Single Hole Drilling (Relative to G35 or G36)
M50,# Vision Step and Repeat Pattern Start
M51,# Vision Step and Repeat Rewind
M52(#) Vision Step and Repeat Offset Counter Control
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 41 of 49
G36X#Y#
G36 is used to adjust a series of locations relative to two or three alignment pads which can be seen by the Vision System.
For example, you might want to align the drilled pattern to some alignment pads. Two or three G36 commands are used in
series, depending on the setting of the ROTATE variable in the Vision Configuration file. If two G36 codes are used, the
pattern is adjusted for offset and rotation only. If three G36 codes are used, the pattern is adjusted for offset, rotation, and
stretch. The coordinate provided with the G36 is the location of the pad to be measured, and the amount of the variances
are used together to translate all coordinates that follow. Please note that G36 is relative to the current work zero, and is not
affected by any current vision translation or offset. G35 and G36 cannot be active at the same time. G36 and its coordinate
are programmed in a block by themselves.
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 42 of 49
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 43 of 49
conjunction with G36 and/or G46. M50 and its label are programmed in a block by themselves.
COMMAND DESCRIPTION
M48
T1S20F09
T2S20F09
T3S20F09
%
G34,1 Vision tool number
G36X -0087Y-007 Panel pre-alignment targets
G36X -0087Y155
G36X09Y155
T1
M50,1 Vision Step and Repeat Pattern Start
M25
G46XY Alignment targets
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 44 of 49
G46XY02
G46X02Y02
X005Y005
X0051Y0151
M01
M02X03
M02X03
M02
M08
T2
M51,1 Vision Step and Repeat Rewind
M25
M52,3 Vision Step and Repeat Offset (Replaces previous
G46's declared inside M50)
X01Y005
X0101Y0151
M01
M02X03
M02X03
M02
M08
M50, 2 New vision Step and Repeat Pattern Start
M25
G46X015Y Alignment targets
G46X01Y02
G46X02Y03
X01Y002
X01Y018
M01
M02X03
M02X03
M02
M08
T3
M51,1 Vision Step and Repeat Rewind
M25
M52,3 Vision Step and Repeat Offset
X015Y005
X0151Y0151
M01
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 45 of 49
M02X03
M02X03
M02
M08
M30
COMMAND DESCRIPTION
M48
T1S20F09
T2S20F09
T3S20F09
%
G34,1 Vision Tool Number
G36X -0087Y-007 Panel pre-alignment targets
G36X -0087Y155
G36X09Y155
M50,1 Vision Step and Repeat Pattern Start
M25
G46XY Alignment targets
G46XY02
G46X02Y02
M01
M02X03
M02X03
M02
M08
T1
M51,1 Vision Step and Repeat Rewind
M25
M52,3 Vision Step and Repeat Offset
X005Y005
X0051Y0151
M01
M02X03
M02X03
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 46 of 49
M02
M08
T2
M51,1 Vision Step and Repeat Rewind
M25
M52,3 Vision Step and Repeat Offset
X01Y005
X0101Y0151
M01
M02X03
M02X03
M02
M08
M50,2 New Vision Step and Repeat Start
M25
G46X015Y New Alignment Targets
G46X01Y02
G46X01Y02
X01Y002
X01Y018
M01
M02X03
M02X03
M02
M08
T3
M51,1 Vision Step and Repeat Rewind
M25
M52,3 Vision Step and Repeat Offset
X015Y005
X0151Y0151
M01
M02X03
M02X03
M02
M08
M30
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 47 of 49
If your machine is equipped with Servo Controlled Variable Zoom and Focus, the following additional commands are
available:
COMMAND DESCRIPTION
M48
T1S20F09
T2S20F09
T3S20F09
%
$uvis,search,on Turn Autosearch ON
$uvis,zoom,7 Change Magnification Level
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 48 of 49
file://C:\CNC%20Programming.htm 12/11/2003
Program Commands Page 49 of 49
M51,1
M25
M52,3
X1.2Y2.4
M01
R3M02X3.1Y
M01
R6M02XY2.9
M08
$uvis,lamp,0 Turn Camera Light Off
M30
Machine Manuals | Diameter Pages | Helpful Hints | Contact Info | Excellon Private
file://C:\CNC%20Programming.htm 12/11/2003