NC Studio
NC Studio
PROGRAMMING MANUAL
there is WEIHONG
上海维宏电子科技股份有限公司
Weihong Electronic Technology Co., Ltd.
Contents
1 New Functions ........................................................................................................................... 1
4.1 Spindle Function (S), Feed Function (F) &Tool Function (T) .................................................. 7
7 PLT Support.............................................................................................................................. 69
1 New Functions
1) New command M802 P458752 is used for clearing the external offset. For detailed
information please refer to chapter 4.4.
2) New command G921 is used for specifying the workpiece coordinates of current point in the
current coordinate system. For detailed introduction please turn to chapter 4.3 ―commands
related to coordinate system and coordinates‖.
3) New command G922 is used for setting the machine coordinate of the origin of the specified
workpiece coordinate system. For detailed introduction please refer to chapter 4.3
―commands related to coordinate system and coordinates‖.
4) New support for circle, bias and chessboard drilling cycle command (G34, G35, G36, and
G37). For detailed introduction please refer to chapter 4.3 ―special canned cycle‖.
5) New rotation function commands G68/G69, for detailed introduction please refer to chapter
4.3 ―G68/ G69 coordinate system rotation function commands‖.
6) New mirror image function commands G50.1/G51.1, for detailed introduction please refer to
chapter 4.3 ―G50.1/ G51.1 mirror image function commands‖.
7) New command G923 is used for direct tool offset setting, for detailed introduction please
refer to chapter 4.3 ―G923 directly set tool offset‖.
8) Strengthened function for command G906 to test if the specified port is timeout. For detailed
introduction please refer to chapter 4.4.
9) New command M903 is used for modifying the current tool number. For detailed introduction
please refer to command M list in chapter 4.4.
10) Command G92 is taken as invalid command in the array machining, and should be deleted
manually. For detailed introduction please refer to chapter 4.3, ―commands related to
coordinate system and coordinates‖.
12) Improvement of command G904: the usage of PLC address; keywords of PX, PY, PZ are
compatible with PLC address and equal mark expression.
13) Improvement of M901 and G906: the usage of PLC address; new keywords ―PLC‖ and
―LEVEL‖; and PLC keywords are compatible with [PLC address] and equal mark expression.
14) New command G992 allows the translation of coordinate system. For detailed introduction
please refer to ―G992 temporarily set WCS according to tool position‖ in chapter 4.3.
15) New command G28 is used for backing to the reference point. For detailed introduction
please refer to chapter 4.3, ―G28 auto back to reference position‖.
16) New commands related with encoder. For details, refer to ―G codes related with encoder‖ in
chapter 4.3.
As shown in Fig. 2-1 below, a machining file can be created by traditional manual programming
or CAD/CAM application (Such as the popular MasterCAM application).
To simplify programming and guarantee the generality of program, this manual has standardized
the naming of coordinate axes and the direction of CNC machine tool. Linear feeding coordinate axes
are denoted by X, Y and Z, which are normally referred as basic coordinate axes. The correlation of X,
Y and Z axes follows ―the Right Hand Rule‖, as shown in Fig. 2-2. The thumb points in the +X
direction, the index finger points in the +Y direction, and the middle finger points in the +Z direction.
+Y
+B +Z
+X+Y+Z
+Y
+X
+X
+C +A
+Z +Y +A+B
+C
+X
+Z
MCS is the intrinsic coordinate system of machine tool. Known as machine origin or machine
zero point, or home position, the origin of MCS is confirmed and fixed after designing, manufacturing
and tuning of machine. The CNC device doesn’t know where machine origin is when power on, and
the mechanical stroke of each coordinate axis is limited by maximum and minimum limit switch. To
correctly set MCS at machining, we normally set a machine REFER point (the initial point of
measurement) within the stroke range of each coordinate axis. After starting the machine, it is
necessary to back to REFER point manually or automatically so as to create the MCS. The REFER
point can coincide with MO or not. If not, the distance from machine REFER point to MO can be set by
parameter setting. After the machine returns to the REFER point, the machine origin, which is the
reference point of all coordinate axes, is confirmed, so the MCS is established. The stroke of MCS is
defined by the machine tool manufacturer, while the valid stroke of MCS is defined by software limit.
The relationship between machine origin (OM), machine REFER point (Om), the mechanical stroke
and valid stroke of MCS is as shown in Fig. 2-3.
Y
Mechanical Stroke along X-axis (Limit)
Om
OM
X
Fig. 2-3 Machine Origin OM and Machine REFER Om
Program Block
Spindle F.W.
Miscellaneous F.W.
Feed F.W.
Dimension W.
Preparatory F.
F.: Function
Program Block No. W.: Word
Spindle Function S
Command Format: S_
Description:
S command is used to control the spindle speed. Its subsequent numerical value denotes the
rotate speed of spindle in rpm.
S is a modal command, and S function is valid only when the spindle speed is adjustable. When
one S command is specified, it will be valid until the next S command is specified.
Command Format: F_
Description:
Command F indicates the synthetic feed speed of tool relative to the workpiece being machined.
Its unit is mm/min.
With the help of feedrate override switch on the operation panel, F can be adjusted between
feedrate percent 0% -120%.
F functions differently with different commands:
G00 command, specifying the rapid traverse speed, modal for the current machining procedure.
G01~G03 command, specifying the feed speed, modal for the current machining procedure.
Command Format: T_
Description:
T is used for selecting a tool; the subsequent value denotes the tool no. selected, and the
relationship between T code and a tool is stipulated by machine tool manufacturer.
When a machining center runs T code, tool magazine will rotate to select the required tool, and
wait until command M06 comes into effect to finish automatic tool change.
T command calls in tool compensation value (including length and radius) from the tool
Modal M function: a group of M functions that can be mutually cancelled; an M function remains in
effect until another M function in the same group appears to cancel it.
Non-modal G function: only effective in the specified program block, and cancelled at the end of
program block.
Modal G function: a group of G functions that can be cancelled mutually; a G function remains in
effect until another G function in the same group appears to cancel it.
Programming Example:
As shown in Fig. 4-1 below, programming with G90, G91: the tool moves in sequence from origin
to point 1, 2, and 3.
45
2 G90 programming G91 programming
N X Y N X Y
25
3 N01 X20 Y15 N01 X20 Y15
15
1 N02 X40 Y45 N02 X20 Y30
X
N03 X60 Y25 N03 X20 Y-20
O 20 40 60
machining, the WCS should be learnt by the CNC system so as to link up the WCS with the MCS by
setting the coordinates of cutter beginning point in the MCS.
G92 command can set the REFER point; it can also create a WCS by setting the relative position
of tool beginning point (tool measurement point) to origin of WCS to be created. Once the WCS is
established, the value of the command in absolute programming is the coordinate value in the WCS.
Z
20.0
G92 X30.0 Y30.0 Z20.0
30.0
X
G992 X0 Y0
M17
O3456
3. Add the following contents at the end of the processing file:
G00 G90 X=#1
G906
G992 X0
M17
Method two:
G992 I_J_K
1. Delete M30 command in the processing file.
2. Add the following contents at the beginning of the processing file:
#1=30 ’X offset value
#2=40 ’Y offset value
#3=30 ’machining quantity along X axis
#4=30 ’machining quantity along Y axis
G65 P3455 L=#4
G00 G90 X=-#1*#3 Y=-#2*#4
G992 I=-#1*#3 J=-#2*#4
M30
O3455
G65 P3456 L=#3
G00 G90 X=-#1*#3 Y=#2
G906
G992 I=-#1*#3 J=#2
M17
O3456
3. Add the following contents at the end of the processing file:
G00 G90 X=#1
G906
G992 I=#1
M17
Both the above two programs can realize the related array machining. The first 4 parameters can
be adjusted and customized.
Note:
G992 X_Y_Z_ sets the current point as a specified point in the new coordinate system.
G992 I_J_K_ translates the original coordinate system a specified distance to form into a new
coordinate system. Comparatively speaking, G992 I_J_K_ is more efficient because it avoids the
redundant rapid traverse instruction produced by origin offset, while G992 X_Y_Z_ sets an origin after
backing to the original origin. During array machining, G92 command should be deleted manually
because it is not supported by the system.
Z
Z
G54 Workpiece
Coordinate System G59 Workpiece
Coordinate System
G54 Origin Y
G59 Origin Y
Reference Point
(Machine Zero)
X Workpiece X
Origin Offset
Note:
Once a WCS is confirmed, the following instruction values in absolute programming are all relative to
the origin of WCS.
G54~G59 are modal functions, which can be mutually cancelled. G54 is the default.
Programming Example:
As shown in Fig. 4-5, programming based on WCS to make the tool move from current point to
point A, and then to point B.
Y
30 B Current Point A B
Y
40 A
G59 O 30 X N01 G54 G00 G90 X30 Y40
N02 G59
N03 G00 X30 Y30
G59 O 30 X Machine Origin ...
Set the coordinate value of each WCS origin in the MCS before using this group of instructions.
G53: using MCS and disabling zero offset of WCS. It is a non-modal instruction which is only
valid in the current program block.
G17
G19 X
G18
Z
Fig. 4-6 Coordinate Plane Selection
When executing cutter radius compensation C, the scaling instruction (G51) can’t be specified.
A canned cycle cannot be executed together with the scaling of Z-axis. If so, an alarm will appear.
These G codes cannot be used in the execution process of scaling function: G28, G29, G53, and
G92, or else the outcome may contain an error.
If there is G51 in the program without G50, the scaling function will be automatically closed at the
end of the program.
Programming Example:
N01 G00 X50.0 Y50.0 ’rapid positioning
N02 G51 X100.0 Y80.0 P0.5 ’specifying X100, Y80 as the scaling center, and 0.5 as scale value
N03 G01 Y150.0 F1000 ’linear cutting with feed rate as 1000mm/min
N04 X175.0 Y50.0
N05 G90 X50.0
N06 G50 ’scaling function off
N07 G00 X0.0 Y0.0 ’returning rapidly
N08 M30 ’end of the program
(50,150)
Y
Program path-before scaling
N04
Real path-after scaling
N03
N01
(50,50) N05 (175,50)
N07
X
Description:
X_Y_Z_: the center of rotation
R_: rotation angle in degree. Negative value is clockwise while positive value counterclockwise.
The instruction can be used for rotary contour machining by making the selected machining
contour rotates degrees specified by R around the center in the specified plane. G68 is rotation on,
while G69 rotation off.
Meaning of R: put a watch on the current plane, and let the watch surface towards the positive
direction of the third axis; positive means counterclockwise rotation, while negative clockwise rotation.
In the process of rotation, coordinate of the third axis perpendicular to the current plane is
constant. Respectively, swiveling in XY plane, the coordinate of Z-axis keeps still; swiveling in YZ
plane, the coordinate of X-axis keeps still; and swiveling in ZX plane, the coordinate of Y-axis keeps
still.
For example:
G17G90 X0Y0Z0
G65P9999L1
G68 X0Y0R-90 ’rotating 90 degrees clockwise around the center of (0, 0)
G65P9999L1
G69 ’rotation off
M30
(100,50)
Before Rotation
(100,0)
(0,0) X
After Rotation
(0,-100) (50,-100)
O9999
G1 x200
y-100
x-200
y100
M17
O9998
G68 x50 y50 R45
G65 P9999 L1
G51 x50 y50 p0.5
G65 P9999 L1
M17
The outcome is as shown in Fig. 4-9.
plane motion to ensure safe movement. For Z-axis upward motion, Z axis motion is before plane
motion, otherwise, plane motion first.
The machine data specifies the maximum rapid moving speed of each coordinate axis; a
coordinate axis will run at this speed in rapid traverse. If rapid movement simultaneously performs on
two axes, the speed will be the maximum possible speed of two axes.
The rapid moving speed in G00 command for each axis is set by the machine parameter ―rapid
feed speed‖, or specified by F_, which is modal in a job program.
G00 is available until replaced by other commands in the group of G function (G01, G02, G03…).
Programming Example:
Programming Example:
direction. When R is negative, a circular arc is larger than a semicircle (i.e. a major arc); when positive,
a circular arc is smaller than or equal to a semicircle (i.e. a semicircle or a minor arc). When the value
of R is smaller than half of the distance between start point and end point of arc, a half circle (or a
180-degree arc) will be formed, with half of the distance between the start point and end point as the
radius. Circle center is specified by the function words I, J, K in center programming. When I, J, K
incremental mode is true, the coordinates of circle center is relative to the start point of the circular arc,
otherwise, relative to the coordinates of workpiece origin. (If the coordinates of circle center is marked
on a drawing, begin programming directly without calculation). X-Y plane is the default plane in
circular programming, or you can specify a circular interpolation plane via G17, G18 or G19.
Helical interpolation is available by specifying another axis in a linear command at the same time
to move synchronously with circular interpolation. K can be used to specify the pitch in helical
interpolation so as to realize multi-circle helical line.
Radius programming can not be used for a whole circle programming, so a whole circle must be
divided into two parts.
Note:
Programming Example:
Y Y
0
R1
R1
End point Start point
10 10
(10,10) (10,10)
X X
0 10 20 0 10 20
(a) (b)
Fig. 4-10 G02/ G03 Programming
X
0 20 40
30
Start point
X
G04 Dwell
Command Format: G04 P_
Description:
P_: the dwell time in ms
G04 can be used in the following situations:
1. When cutting a corner, the dwell command can be used to guarantee a sharp corner.
2. In machining a not through hole, when the cutter reaches the appointed depth, G04 can be
used to stop tool feed. After the spindle rotates more than one circle, execute tool retract to get a
smooth hole bottom.
3. After boring a hole, the spindle should be stopped and dwell for 1~3s until totally stopped
before tool retract in order to avoid thread scratches and ensure the smoothness of workpiece.
4. In transverse turning, G04 can be used before tool retract to make sure the spindle rotates at
least one circle.
5. When chamfering or centering on a lathe, the dwell command, spindle on and tool change, etc.
can be used to make sure the smoothness of chamfer surface and conical surface of center hole.
The dwell command comes into effect after the motion of last program block ends (the speed is
0). G04 dwells for the specified time, only effective in the program block containing it.
Inserting G04 between two program blocks can interrupt machining for the specified time, such
as in free cutting, and the time is determined by P function word, in ms.
Programming Example:
Tool Commands
Offset
Tool Moving Direction
Cutter, G40
G41
G42
X,Y(10,10)
Center
Note:
In the process of compensation or when compensation off, current moving direction of cutter cannot
be opposite to last direction.
Previous moving
direction
10
Current moving
direction
0 10 20
For example:
G92 G0 X0 Y0
G0 G41 X10 Y10 D01 F1000
G1 X20 Y10
If G1 X5 Y10 is added here, an error will appear, because the direction is opposite to that of
above-mentioned instruction. Change it to G1 X10 Y50, or other instruction not opposite to the last
direction.
G0 G40 X0 Y10 ’this instruction is also wrong, because the moving direction of cutter is
opposite to the last direction. It will be right if it is changed to G0 G40 X0 Y0.
Description:
G49: tool length compensation off
G43: compensation along positive direction (end point value of compensation axis adds offset
value)
G44: compensation along negative direction (end point value of compensation axis subtracts
offset value)
H_: parameter of G43/G44, i.e. tool length compensation offset no. (H00~H07), denotes length
compensation value relative to the tool compensation list.
Tool length compensation is used to compensate the deviation of tool length, which subtracts or
adds the saved tool offset value from or to the command value of Z-axis.
G43 and G44 are modal commands. When G43 or G44 is programmed, they will be always
effective until G49 command appears to cancel them.
length compensation
3
0 X
10
Programming Example:
For example:
G923 Z 2.392 P1
It indicates the tool offset value of cutter no.1 is 2.392.
If P is omitted, it indicates setting tool offset value for the current tool.
M802 P196609
M801 MSG"|D| wait for tool calibration signal"
G904 FZ-60 PZ=#CALIBRATION_SW LZ1
M801 MSG""
M802 P196608
G903 G00 G91 Z5
G923 z0
G906
G923 Z = #CURWORKPOS.Z-#MOBICALI_THICKNESS–5
The canned cycles of CNC mills are mainly used for machining holes, including drilling, boring
and tapping. With one program block, you can accomplish one or a full set of hole machining
operation. When continuing hole machining, if there is no need to change hole machining operations,
all the modal data in the program needn’t to be written, which can greatly simplify the program.
Description of each command is shown in the following table.
Notes: G76, G87, and G88 commands are not supported for the time being.
Generally speaking, canned cycle of hole machining is comprised of the following six operations,
see Fig. 4-17.
Operation 1: positioning of X axis and Y axis---the cutter is rapidly located to the position of hole
machining.
Operation 2: rapid traverse to point R---the cutter rapidly feeds from initial point to point R.
Operation 3: hole machining----executing hole machining at the mode of cutting feed.
Operation 4: operations at bottom of hole----including dwell, exact stop of spindle, cutter
displacement, and so on.
Operation 5: return to point R----for continuing hole machining and safely moving the cutter.
Operation 6: return to initial point at rapid traverse rate----generally, initial point is selected after
hole machining completed.
Operation 1
Initial Point
Operation 2 Operation 6
Point R
Operation 5
Operation 3
Rapid Traverse
Operation 4
Feed
Initial Plane
Initial plane is a plane specified for a safe plunge. The distance between initial plane and
workpiece surface can be set within the safe limit.
Point R Plane
Point R plane is also named R REFER plane; it is a plane where the cutter moves at a speed
from rapid traverse rate (G00) to cutting workpiece speed (GXX). The distance between workpiece
surface and point R, generally within 2~5mm, mainly varies with the dimension of workpiece surface.
When machining a blind hole, hole bottom plane is Z-axis height at the bottom of hole. When
machining a through hole, the cutter usually goes beyond the hole bottom a certain distance to make
sure all holes are machined to the specified depth. When drilling a hole, the impact of drill on hole
depth should also be taken into consideration.
Hole machining cycle is not related to plane selection command (G17, G18, and G19).
Whichever plane is selected, hole machining is positioning in XY plane and drilling in Z-axis.
Data Form
Data of Address R and Address Z in canned cycle commands are specified in incremental mode
(G91); R indicates the distance from initial point to point R, and Z indicates the distance from point R
to point Z in the hole bottom plane (refer to Fig. 4-18).
Point R R Point R
Z=0
Z
Point Z Z Point Z
Z_: the position of point Z in the hole bottom plane (absolute programming); the distance from
point R to point Z in the hole bottom plane (incremental programming)
R_: the position of point R (absolute programming); the distance from the initial point to point R
(incremental programming)
Q_: the cutting depth each time (incremental and positive)
P_: the dwell time at bottom of hole, in ms, with no decimal point
F_: feed speed; even if the canned cycle is cancelled, this modal data is still effective in the
subsequent machining.
K_: number of repeats, with default as K1. K (a non-modal command) is only effective in the
block containing it. Under G91 mode, with setting this parameter, one block can implement the
machining of several isometric holes distributed in one straight line. Under G90 mode, this parameter
can specify the repeated machining times on the same position.
Command of hole machining mode, and Z, R, Q, and P, are all modal. They will remain in effect
until hole machining mode is cancelled. Therefore, these commands can be specified at the
beginning of the program, and then it is unnecessary to specify them again in the following
consecutive machining; if the data of a certain hole is changed (such as: hole depth), you only need to
modify this data.
G80 command is used to cancel hole machining mode; if any G code of Group 01
(G00/G01/G02/G03…) appears in the program block, the hole machining mode will also be
automatically cancelled. In other words, as for canceling a canned cycle, G80 and G code of Group
01 function the same.
G98 G99
Point R Point R
Q Q
δ δ
Q Q
δ δ
Q Q
Point Z Point Z
δ: Parameter setting δ: Parameter setting P
P
1. The cutter rapidly moves to the specified hole position (X, Y);
2. Moves to the appointed point R;
3. Moves down Q relative to the present drilling depth;
4. Rapidly moves upward retract distance (set by the parameter ―retract amount‖);
5. Repeats the above drilling operations until reaching point Z at the bottom of hole;
6. Returns to the initial point (G98) or R point (G99) at G00 speed;
Programming Example:
F1200. S600
M03 ’spindle CW on
G90
G00 X0. Y0. Z10. ’moving to the initial point.
G17
G90 G99
’Setting coordinates of point R, point Z and hole 1, with cutting depth each time as 2.0, and
drilling speed as 800
G73 X5. Y5. Z-10. R-5. Q2. F800
X25. ’hole 2
Y25. ’hole 3
G98 X5. ’hole 4, and setting to return to the initial point
X10. Y10. Z-20. ’hole 5, and setting a new point Z as -20
G80
M05 ’drill stop
M02
Hole-machining process is as shown in Fig. 4-20. In G98, the cutter will return to the initial point
after hole-machining is finished. But in G99, the cutter will return to point R after hole-machining is
finished.
G98 G99
R R
Spindle CCW after P Spindle CCW after P
Z Z
Spindle CW after P Spindle CW after P
Process Description:
1. The cutter moves to the specified hole position (X, Y) at G00 speed;
2. Goes down to the specified point R at G00 speed;
Programming Example:
F1200. S600
G90
G00 X0. Y0. Z10. ’moving to the initial point.
G17
M04 ’drill CCW on
G90 G99
’Setting the coordinates of point R, point Z and hole 1, with dwell as 2s and drilling speed as 800
G74 X5. Y5. Z-10. R-5. P2000. F800
X25. ’hole 2
Y25. ’hole 3
G98 X5. ’hole 4, and setting to return to the initial point.
X10. Y10. Z-20. ’hole 5, and setting a new point Z as -20
G80
M05 ’drill stop
M02
G98 G99
P δ Z P δ Z
OSS OSS
Tool
OSS
(Oriented Spindle Stop) Offset δ
Process Description:
※ Alarm:
As a Modal Value requested in G76 cycle, the value of Q must be specified carefully, because it is
also used in G73/G83.
OSS (Oriented Spindle Stop) direction is decided by the parameter ―Oriented Spindle Stop‖:
Oriented Spindle Stop (OSS) G17 G18 G19
0 +X +Z +Y
1 -X -Z -Y
2 +Y +X +Z
3 -Y -X -Z
Programming Example:
F1200 S600
M03 ’spindle CW on
G90
G00 X0 Y0 Z10 ’moving to the initial point
G17
G90 G99
’Specifying the coordinates of point R, point Z and hole 1, with the displacement at the bottom of
hole as 2.0, dwell time as 5s, and machining speed as 800
G76 X5. Y5. Z-10. R-5. Q2. P5000. F800
X25. ’hole 2
Y25. ’hole 3
G98 X5. ’hole 4, and setting to return to initial point
X10. Y10. Z-20. ’hole 5, and specifying the new point Z as -20.0
G80
M05 ’drill stop
M02
G98 G99
R R
Z Z
Programming Example:
F1200. S600
G90
G00 X0. Y0. Z10. ’moving to the initial point
G17
G90 G99
’Setting the coordinates of point R, point Z and hole 1, with machining speed as 800
G81 X5. Y5. Z-10. R-5. F800
X25. ’hole 2
Y25. ’hole 3
G98 X5. ’hole 4, and return to initial point
X10. Y10. Z-20. ’hole 5, and setting the new point Z as -20
G80
M02
G98 G99
R R
Z Z
P P
Fig. 4-24 G82 Machining Process
Process Description:
Programming Example:
F1200. S600
G90
G00 X0. Y0. Z10. ’moving to the initial point
G17
M03 ’spindle CW on
G90 G99
’Setting the coordinates of point R, point Z and hole 1, with dwell time as 2s, drilling speed as 800
G82 X5. Y5. Z-10. R-5. P2000. F800
X25. ’hole 2
Y25. ’hole 3
G98 X5. ’hole 4, and setting to return to the initial point
G80
M05 ’spindle stop
M02
(incremental programming)
Q_: the peck depth each time(positive and incremental, minus mark will be ignored)
F_: feed speed, even if the canned cycle is cancelled, this modal data is still effective in the
subsequent machining.
K_: number of repeats (repeated movement and drilling, effective under G91 incremental mode)
The machining process of hole is as shown in Fig. 4-25. Slightly different from G73, the tool will
retract to plane R after each intermittent feed in G83. The ―‖ here, set by the parameter ―G73_G83
retract amount‖, refers to the distance between the feed plane where the cutter changes from G00 to
Gxx and the previous peck depth. G83 is especially for machining deep holes.
G98 G99
Point R Point R
Q δ Q δ
Q Q
δ δ
Q Q
Point Z Point Z
δ: Set by parameter P δ: Set by parameter P
Process Description:
Programming Example:
F1200. S600
M03 ’spindle CW on
G90
G00 X0. Y0. Z10. ’moving to the initial point
G17
G90 G99
’Specifying the coordinates of point R, point Z and hole 1, with peck depth as 3.0, cutting speed
as 800
G83 X5. Y5. Z-10. R-5. Q3. F800
X25. ’hole 2
Y25. ’hole 3
G98 X5. ’hole 4, and setting to return to the initial point
G80
M05 ’drill stop
M02
G98 G99
R R
Spindle CW after P Spindle CW after P
Z Z
Spindle CCW after P Spindle CCW after P
Fig. 4-26 G84 Machining Process
Process Description:
1. The cutter moves to the specified hole position (X, Y) in G00;
2. Moves down to the specified point R in G00;
3. Taps down to point Z at the bottom of the hole in G01;
4. Spindle CCW after P;
5. Retracts to point R in G01;
6. Spindle CW after P;
7. Retracts to the initial point (G98) or point R (G99) in G00.
Programming Example:
F1200. S600
G90
G00 X0. Y0. Z10. ’moving to the initial point
G17
M03 ’drill CW on
G90 G99
’Specifying the coordinates of point R, point Z and hole 1, with dwell as 2s, tapping speed as 800
G84 X5. Y5. Z-10. R-5. P2000 F800
X25. ’hole 2
Y25. ’hole 3
G98 X5. ’hole 4, and setting to return to the initial point
G80
M05 ’drill stop
M02
G98 G99
R R
Z Z
Fig. 4-27 G85 Machining Process
Process Description:
Programming Example:
F1200. S600
G90
G00 X0. Y0. Z10. ’moving to the initial point
G17
M03 ’spindle CW on
G90 G99
’Specifying the coordinates of point R, point Z and hole 1, with machining speed as 800
G85 X5. Y5. Z-10. R-5. F800
X25. ’hole 2
Y25. ’hole 3
G98 X5. ’hole 4, and setting to return to the initial point
G80
M05 ’spindle stop
M02
F_: feed speed, even if the canned cycle is cancelled, this modal data is still effective in the
subsequent machining.
K_: number of repeats (repeated movement and drilling, effective in G91 incremental mode)
G98 G99
Z Z
Drill Stop Drill Stop
Process Description:
Programming Example:
F1200. S600
G90
G00 X0. Y0. Z10. ’moving to the initial point
G17
M03 ’drill CW on
G90 G99
’Specifying the coordinates of point R, point Z and hole 1, with drilling speed as 800
G86 X5. Y5. Z-10. R-5. F800
X25. ’hole 2
Y25. ’hole 3
G98 X5. ’hole 4, and setting to return to initial point
G80
M05 ’drill stop
M02
OSS
Initial Point
Spindle CW
OSS
Point Z
P
Point R
Spindle CW
Tool
OSS
Offset δ
(Oriented Spindle Stop)
Fig. 4-30 Oriented Spindle Stop (OSS) Sketch Map
Process Description:
1. The cutter moves to the hole position (X, Y) in G00;
2. After OSS, offsets Q distance in a direction opposed to the direction of boring cutter specified
by the parameter ―Oriented Spindle Stop (OSS)‖;
3. Moves down to the specified point R in G00, and offsets Q distance;
4. Spindle CW;
※ Alarm:
As a Modal Value requested in G76 cycle, the value of Q must be set carefully, because it is also used
in G73/G83.
OSS (Oriented Spindle Stop) direction is decided by the parameter ―Oriented Spindle Stop‖.
Oriented spindle stop (OSS) G17 G18 G19
0 +X +Z +Y
1 -X -Z -Y
2 +Y +X +Z
3 -Y -X -Z
Programming Example:
F1200. S600
G90
G00 X0. Y0. Z10. ’moving to the initial point
G17
M03 ’spindle CW on
G90 G98
’Specifying the coordinates of point R, point Z and hole 1, with offset as 5, dwell time as 4s, and
boring speed as 800
G87 X5. Y5. Z-10. R-5. Q5. P4000 F800
X25. ’hole 2
Y25. ’hole 3
X5. ’hole 4, and setting to return to the initial point
G80
M05 ’spindle stop
M02
P_: the dwell time at the bottom of the hole, in ms, with no decimal point
F_: feed speed, even if the canned cycle is cancelled, this modal data is still effective in the
subsequent machining.
K_: number of repeats (repeated movement and drilling, effective under G91 incremental mode)
G98 G99
Z Z
Spindle stop after P Spindle stop after P
Programming Example:
F1200. S600
G90
G00 X0. Y0. Z10. ’moving to the initial point
G17
M03 ’spindle CW on
G90 G99
’Specifying the coordinates of point R, point Z and hole 1, with dwell as 2(s), boring speed as 800
G88 X5. Y5. Z-10. R-5. P2000 F800
X25. ’hole 2
Y25. ’hole 3
G98 X5. ’hole 4, and setting to return to the initial point
G80
M05 ’spindle stop
M02
G98 G99
R R
Z Z
P P
Fig. 4-32 G89 Machining Process
Process Description:
1. The cutter moves to the hole position (X, Y) in G00;
2. Moves down to the specified point R in G00;
3. Moves down to point Z at the bottom of the hole in G01;
4. Pauses for P;
5. Retracts to point R in G01;
6. Retracts to initial point (G98) or point R (G99) in G00.
Programming Example:
F1200. S600
G90
G00 X0. Y0. Z10. ’moving to the initial point
G17
M03 ’spindle CW on
G90 G99
’Setting coordinates of point R, point Z and hole 1, with dwell as 2.5s, machining speed as 800
G89 X5. Y5. Z-10. R-5. P2500 F800
X25. ’hole 2
Y25. ’hole 3
G98 X5. ’hole 4, and setting to return to the initial point
G80
M05 ’spindle stop
M02
Description:
For Example:
G34/35/36/37 instruction error: special canned cycle instructions do not match, with no designation.
-10 10 20 30
5 7
-10
6
-10 10 20 30
-10
-10 10 20 30
-10
X11=300m
△x=50mm
m
Programming Example:
37 Φ 10
Through hole
δ =10
Programming is as following:
PX[_], PY[_], PZ[_]: PLC address of to-be triggered latch signals of X, Y and Z axes
LX_, LY_, LZ_: Signal status to trigger latch of X, Y and Z axes
Programming Example:
G916 PX[00000]LX0;
’In the process of homing, encoder zero is used to trigger the latched encoder data. This
instruction informs the drive to write the configuration data of X axis and trigger latch when level
is low.
These specific programs are defined as public subprograms which have the same format as a
subprogram.
O"9002"
Operation &
control
G65 P9002 L2 instructions
(User-defined of variable
Variable)
M17;
Programming Example:
G905 G903 G01 X10 Y20 Z0 F600; ’F (feedrate) is set as 600 mm/min forcedly
G905 enables feed speed specified by F command temporarily, instead of the default speed.
When the parameter ―Use default speed‖ is set as valid, this instruction disables the default
speed and forces to use the programmed speed temporarily, commonly used in functions of backing
to reference point and tool measurement, and so on.
This non-modal command is used together with G00, G01, G02 or G03.
Programming Example:
G905 G903 G01 X10 Y20 Z0 F600; ’F (feed speed) is set as 600 mm/min forcedly
Programming Example:
For Example:
Programming Example:
Programming Example:
M902 H0; ’end of X-axis returning to reference point, i.e. the machine coordinate of current point
is 0 (machine origin) in X-axis
All positions behind the address characters that are taken up by numbers can be replaced by
assignment expressions.
No characters of space type are allowed to exist in the expression, including Space, Tab and
Enter, etc. What’s more, an expression must be ended with a valid separator.
Note:
Radian is the unit for the numbers in the brackets which are behind sin, cos, tg, ctg, asin, acos, atg.
For Example:
R25 R25 50
20
15
X
135
70
R20
50
60 40
40
R50
30
X
40 120
Example 4 Programming for the Workpiece Shown in Fig. 4-42 (CCW tapping)
65
R 5
15
X
0 15 65 80
Z
5
3
0
28
Example 5 Programming for the Workpiece Shown in Fig. 4-43 (requirement: amount of feed is
2mm each time in Z-axis)
N01 G92 X0 Y0 Z0 ’workpiece coordinates system establishment
N02 G91 M03 S800 M08 ’incremental coordinates adopted, spindle CW at 800 rpm, coolant on
N03 G65 P9001 L6 ’subprogram 9001 call, executed six times
N04 G00 Z12 M05 M09 M30 ’rapid traverse to X0, Y0, Z0, spindle stop, coolant off, end of
program and return to the program header
O9001 ’subprogram 9001
N100 G00 X10 Y0 Z-2 ’rapid traverse to X10, Y0, Z-2
N110 G01 Y60 F1000 ’linear interpolation to X10, Y60, feed speed 1000mm/min
N120 X50 ’linear interpolation to X60, Y60
N130 Y-50 ’linear interpolation to X60, Y10
N140 X-60 ’linear interpolation to X0, Y10
N150 G00 Y-10 ’rapid traverse to X0, Y0
N160 M17 ’subprogram return
Y
R 14
60 Y
X
0
X Z
10 2
Z 60
2
X 0 X
14
10
Fig. 4-43 Workpiece Machining Sketch Fig. 4-44 Workpiece Machining Sketch
5 Named Parameters
For a common user, the machining workpiece operations and other basic operations provided by
the controller can meet his demands, such as: tool calibration, center calibration, canned cycle, etc.
While for an advanced user who needs to modify some operating details, write operating
programs and customize canned cycles, the controller provides a group of fast and convenient
named parameters. With these parameters, it is not only convenient for the user to modify or write
operation programs and customize the content of canned cycle in public.dat to meet the machining
demand, but also convenient to write programs directly in the program edit operation interface.
Example 1, Use named parameters to compile a subprogram of tool coolant and tool change, as
follows:
O1000 ’subprogram of tool coolant and tool change
M901 H=#COOLANT_START_PORT P1
G04 P10
IF(#ENABLE_CTP) G53 G00 G90 X=#CTP_POS.X Y=#CTP_POS.Y Z=#CTP_POSZ ’move to
the position of tool change
G00 G90 Z10 ’or lift the cutter directly for tool change
M05
M17
Example 2, Use named parameters to modify the content of G86 canned cycle from without
retract amount parameter in the system to with retract amount parameter, as follows:
O686
#FC50=#CANNEDCYCLE_BACK
IF (! #FC13) G90 G65 P786
IF (#FC13) G91 G65 P786 L=#FC11
M17
O786
G00 X=#FC1 Y=#FC2
G90 G00 Z=#FC4
G90 G01 Z=#FC4-ABS (#FC5) F=#FC7
)-1
G65 P886 L=INT(ABS(#FC4-#FC3)/ABS(#FC5)
G90 G01 Z=#FC3 F=#FC7
M05
G90 G00 Z=#FC4
IF (!#FC12)G90 G00 Z=#FC14
M03
IF (#FC13) G91
M17
O886
’Conditional statement ―if‖ can be used to set the actions (like gear shift) during spindle rotating
O202
M17
’spindle CW (only one direction supported)
O203
M901 H2 P1
G04 P5
M17
’spindle CCW (only one direction supported)
O204
M901 H2 P1
G04 P5
M17
’spindle stop
O205
M901 H2 P0
G04 P5
M17
’coolant on
O208
M901 H24 P1
G04 P5
M17
’coolant off
O209
M901 H24 P0
G04 P5
M17
7 PLT Support
At present, the system supports PLT instructions as below:
//PU Pen Up
// PU [ X,Y [,...]] [;]
//CI Circle
// CI r [, qd] [;]
Notes:
PLT format has strong expansibility and different products have different instructions. If you meet
unidentifiable instructions, please contact us as soon as possible, so that we can develop a
corresponding interpreter for you.
8 DXF Support
At present, the system supports Entities as below:
LINE
LWPOLYLINE
ARC
CIRCLE
ELLIPSE
SPLINE
Prompt:
Save the figure drawn with Auto CAD as DXF format, and then perform ―Open and Load‖ and
―Simulation Mode‖ in our system. At this time, the figure shown in the track window is what you have
drawn with Auto CAD.