Академический Документы
Профессиональный Документы
Культура Документы
It consists of several blocks, which is made up of bytes and separated by an end code of the block.
1.1 Main program
Programs are constituted of main programs and subroutine. Generally speaking, the CNC machine moves according to the
command of the main program. If there is an instruction to operate the subroutine in the course of the main program, the
subroutine continues to work. When the instruction returns to the main program issues, the main program executes again.
Main program Subroutine
For example:At the beginning of the subroutine, the subroutine number is defined after the address 0, ending with the
M99 instruction. For example:
For example
X...M99;
Note:
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
In order to be interchanged with other devices, the subroutine in the first block can use N0000
instead of 0000. The sequence number following N is stored in the memory as a subroutine
number.
The calling of the subroutine in the subroutine is the same as that of the subroutine in the main program.
Note:
An alarm occurs when the subroutine number specified by the address P fails to be retrieved.
In the main program, if M99 is executed, it returns to the beginning of the main program and continues repeatedly.For
example,there is a block /M99 in the main program. If the optional block switch is turned OFF, M99 will be executed,
returning to the beginning of the main program, and repeating from the beginning.During the OFF state of the optional
block, it is repeatedly executed. When on, the M99 block is skipped and the next block is executed.
Skip switch is on
Format
0XXX
0 :address character of program number .
XXXX :Program number (1~9999, leading one can be omitted)
NXXXX
N : address character of program number.
XXXX :Sequence number (leading one can be omitted)
Explanation
The order of the sequence numbers can be arbitrary, and different in their interval. The sequence number can be inserted
in all blocks, or in important blocks. It is convenient to insert the sequence number in an important part of the program.
For example, in changing a tool, or moving the table to a new surface.
In the programme mentioned above, if the skip switch is on, the N101 block will be skipped.
X1000
X:address
1000:value
Explanation
The address is a letter in the English alphabet (A-Z), which specifies the meaning of the subsequent values. Based on the
preparation, sometimes the same address has a different meaning. In this system, the address available and its meaning are
shown in the following table.
Function Address Meaning
Program O Program number
number
Sequence N Sequence number
number
Preparation G To specify the action status (straight line, arc,
etc.)
Size of byte X Y Z A B C U V W H Axis movement instruction
R Radius of the arc
IJK Center coordinate of the Arc and intermediate
point of G12 arc .
Feed rate F Feed rate specification
Spindle S,SS Designation of spindle speed, S spindle 1, SS
function spindle 2
Tool T Designation of the tool number
function
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
These parameters refer to the range that the CNC can command, unrelated to its actual one. For example, the system can
command the axis to move about 100m, but X-axis journey of the actual machine may be only 2m. Refer to both the
manual and the machine manual when programming the program.
1.8 End of program
The program ends with M30 or M99.
Format
M30;end of program
M99;end of Subroutine
Explanation
In the course of the execution, if the program code mentioned above occurs, the system will end and enter the reset state.
At the end of M30, the parameter M30 controls the return of the program cursor to the beginning of the program. At the
end of the subroutine, the system returns to the program that calls the subroutine to continue to execute.
The preparation is represented by the G code, including the G address and its subsequent values. The G code consists of
modal and non-modal.
Type
Type 1:Non-modal G code
Only valid in the block that is being executed
Type 2:Modal G code
Always valid before other G code is being executed in the same group
For example
G00 and G01 are the same group of modal G codes. The processing procedure is as follows:
G0OX_ ; (G00 is valid)
Y__ ;(G00 is valid)
G012_ ; (G01 is valid)
X__ ;(GO1 is valid)
G00* 01 To position at a quick speed that is based on the parameter of GO, and
the linear and non-linear lines can be selected in the comprehensive
parameters.
G01 Refer to linear interpolation and run according to the given F
G02 Refer to clockwise circular interpolation, run according to the given F or
spiral interpolation if there is a non-planar axis
G03 refer to counterclockwise circular interpolation and others are the same as
mentioned above
G12 Refer to intermediate interpolation of arc
G04 00 Refer to delay waiting, in which parameter X is in seconds, parameter P
in leap seconds and resolution of 5 seconds
G17* 02 Refer to the selection of XY on the circular interpolation plane
G18 Refer to the selection of ZX on the circular interpolation plane
G19 Refer to the selection of YZ on the circular interpolation plane
G28 00 Refer to returning parameter (in other words, to mechanical zero),
including speed, zero return and direction of parameters
G31 Refer to skip mechanism, if the G31 input port effectively stops the
current motion, the next instruction will work
G50 Refer to lateral movement, if the input port is invalid, it will stop, the
same to G31, but you can specify the input port arbitrarily.
G51 Refer to lateral movement, the input port is effectively stopped, the same
to G31, but you can specify the input port arbitrarily.
G22 0 Refer to loop instruction
G23 Refer to loop instruction
G43 05 Refer to compensation of length of tool in the positive direction ,
unrelated to plane; it is always on Z axis or invalid
G44 Refer to compensation of length of tool in the negative direction ,
unrelated to plane; it is always on Z axis or invalid
G49* Refer to cancel of compensation of length of tool, unrelated to plane; it is
always on Z axis or invalid
G52 00 Refer to function of local coordinate
G53 Refer to coordinate positioning of the machine
G54* 06 Refer to workpiece coordinates 1
G55 Refer to workpiece coordinates 2
G56 Refer to workpiece coordinates 3
G57 Refer to workpiece coordinates 4
G58 Refer to workpiece coordinates 5
G59 Refer to workpiece coordinates 6
G73 07 Refer to processing cycle of deep hole at high speed
G74 Refer to cycle of reverse tapping on the basis of that of the encoder.
G80* Refer to cancellation of fixed cycle
G81 Refer to drilling cycle (drilling cycle)
G82 Refer to drilling cycle (empty cycle of the boring ladder )
G83 Refer to drilling cycle of the deep hole
G84 Refer to tapping cycle on the basis of that of the encoder
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
Note:
1 The G code with the * is set as the default G code of the system, and the modal G code will be
the default one when the power is turned on.
2 The G code of the 00 group belongs to non-modal G code and is valid only in the block.
3 An alarm occurs if a G code that is not listed or not used in the G code list.
4 Several different groups of G codes can be commanded in the same block. If so, the last G code
is valid.
Instruction format
G00 IP__;
The IP of X, Y, Z, A, B, C, U, V, W and etc means any combination of axes. For absolute programming, it means
the end-point coordinate value of tools’ movement. For programming of incremental value, it means the tool’s
moving distance.
Semi-colon (;) mean the end of program section.
Descriptions of instruction:
▲Non-linear interpolation location
You can choose line and non-linear line in integrated parameters.
When conducting G00 instruction, each axis realize quickly location by individual and fast movement. If you designate
X-axis and Z-axis at same time, the tools’ moving will not have linear tracks in common condition. Or we can say, during
the conduction of G00, moving axis at same time, the tools’ moving will not follow linear interpolation algorithm but
choose the optimal path. Generally, this operation is used in stepping motor system.
▲Linear interpolation location
You can choose line and non-linear line in integrated parameters.
When conducting G00, G01 has same tool path, tools will realize the location in Min. times by the speed which was less
than each axis quick moving speed.
Two ways are defined in parameter(P0028).
Schematic diagram of two locating modes are shown as follows:
Start-point
G00 linear location
2.3
G01-L Note:
inear 1 Fast moving speed of G00 each axis was set by parameters. The feeding speed which was designated
Interp by F was useless. Fast moving speed of G00 could be divided in four levels :100%, 75%, 50%,
olatio 25%, F0.
n
2 G00 is a modal instruction. If the next instruction is G00 too, you do not need to write it. G00 could be
G01 programmed as G0.
IP_F_:
3 When you use G00 instruction, please notice safety position of tools, in case of tools collision
IP: For
absolut
e
progra
mming,
it means absolute coordinates value. For incremental programming, it means the movement of the tool.
Feeding speed will be designated by F. F will be valid before receiving new instruction. So, you do not need to appoint
one by one.
G91 G01 X200 Y100 F200
Tool moves from (0,0) to (200,100) at speed of 200mm/min
2.4 G02/G03—Circular Interpolation
G02/G03 refers to an instruction of the circular interpolation. They control the cutting the tool along the arc on a specified
plane. What’s more, the subroutine fails to run this instruction
Format of the instruction
Arc on the XY plane
distance and Z
Two axes in XY2 Distance from the the coordinates of the
in the U, V and starting point to that of the end one
W or G91
4 Center point or Two axes in I,J The distance from the coordinates of the
radius and K starting point to the coordinates of the center
of the circle (I, J and K is also calculated in
increments in absolute mode)
R Radius of the arc
5 Feed rate F Tangent speed of arc feed
Instruction description
▲Direction of the circular interpolation
The clockwise (G02) and counterclockwise (GO3) means from the positive direction of the Z-axis (Y_axis, X_axis) to the
negative one on the X_Y plane (Z X plane, Y Z plane) in the right-hand rectangular coordinates, as shown below:
Center
Center Center
▲Radius of the arc
End point
Start point
①’s arc is less than 180°and executes G code including G91 G02 X60 Y50 R50 F300;
②’s arc is more than 180°and executes G code including G91 G02 X60 Y50 R-50 F300:
▲Feed rate
The feedrate for circular interpolation is specified by F, which is the speed of the tool along the tangential of the arc.
Note
1 When I, j and K are 0, it can be omitted.
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
2 When the amount of movement (X, Y, Z) on the arcs is ignored, the end point is the same as the
starting point. If I, J, and K are used to specify the center of the circle, the specified circle is a full
one.
3 R works when the end point is the same as the start point position and an arc of 0 degrees
occurs, that is, it remains unchanged.
4 The actual movement speed of the tool differs from the specified speed within ±2%, and the
specified speed refers to the speed of the arc movement of the tool along the radius compensation.
5 When I, J, K, and R are specified at the same time, R is valid, while I, J, and K are not.
For example
The trajectories on the graph are programmed in absolute value and measured value respectively.
Absolute mode
G92 X200. 0 Y40.0 Z0 :
G90 G03 X140.0 Y100. 0 1-60.0 F300.0 ; G02 X120.0 Y60.0 1-50.0 :
Or
G92 X200.0 Y40.0 Z0 ;
G90 G03 X140. 0 Y100. 0 R60.0 F300.0 ; G02 X120. 0 Y60.0 R50.0 ;
Incremental mode
G91 G03 X-60. 0 Y60. 0 1-60.0 F300.0 ; G02 X-20. 0 Y-40. 0 1-50.0 :
orG91 G03 X-60. 0 Y60. 0 R60.0 F300.0 ; G02 X-20. 0 Y-40. 0 R50.0 ;
Explanation
The F command specifies the feedrate along the circumference of the arc projection, as shown in the following figure. The
feed rate of the linear axis (Z axis) refers to
Fx Length of the linear axis
Length of arc projection
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
Tool path
The speed of the circumference along the arc refers to the specified speed
Note
When the feedrate F is specified, the speed of the linear axis is not allowed to exceed any limit
value.
I, J, and K are the middle points of the arc, among which the absolute point refers to below the G90 , and the relative point
to the below G91.
X,Y and Z are the middle points of the arc, among which the absolute point refers to below the G90 , and the relative
point refers to the below G91.
This instruction is mainly used for teaching programming.
The middle point is best to use the point in the middle of the arc to reduce the error. And what’s more, start point, middle
point, and end point cannot be in the same line.
2.7 G 04—delay waiting
With the instruction of delay waiting, the execution of the next block can be postponed, and the delay time refers to the
instruction one.
Instruction format
G04 X_ ;
Or
G04 P_ ;
X: Time setting of delay waiting (a decimal is available).
P:Time setting of delay waiting (a decimal is unavailable).
Instruction description
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
With the pause instruction, the execution of the next block can be deferred for a specified period of time.
Note
1 The X/P command unit is independent of the minimum unit of the linear or rotary axis.
2 If the P and X instructions are omitted, it can be regarded as an accurate stop.
3 Execution of the G04 command will automatically prevent pre-reading and buffering.
point
G28 refers to the automatic return to the reference point: A- >B- >R
G29 refers to moving from reference point: R- >B- >C
Command format
G28 IP_ ;
G28: command refers to automatic return to the reference point .
IP_ : the coordinates of the intermediate point through which the reference point automatically
returns, whose absolute or incremental value is spcified.
Instruction description
1 In the course of the execution of G28, the intermediate point and reference point are positioned at the speed of zero
return of the program.
2 When the machine is locked, the G28 fails to be positioned from the intermediate point to the reference point, and the
zero return light will not on.
3 G28 is generally used in automatic tool change, so in principle, the compensation amount such as tool radius and length
should be canceled in advance.
4 There are multiple axes in G28 with the order of execution of Z->XY->ABC
For example
N1 G28 X40.0 ; intermediate point(40.0)
N2. G28 Y60.0 ; intermediate point(40.0,60.0)
Note
1 After power-on, if the reference point is never not manually returned, the motion from the
intermediate point to the reference point is the same as the manual return to the reference point
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
The system uses one of the machine coordinates, the workpiece coordinates, and the local coordinates to specify the
position of the coordinates.
Machine zero is a fixed reference point set by the machine tool builder for the machine. The coordinates with the machine
zero as the coordinate origin are called the machine coordinates.
1 The machine coordinates are based on the fixed point on the machine tool, the reference of other coordinate systems.
Once it is established, the system saves it and is valid until it is reset.
2 The coordinates of the workpiece are based on the sub-coordinate system in the machine coordinates, and can be set and
changed.
3 The local coordinates are based on the sub-coordinates in the workpiece coordinates, and can be set and changed.
Relations of each coordinate system are as shown in the following:
Reference point
Generally speaking, after the system is turned on, the user is required to reset the machine coordinates.
After manually zeroing each axis of the coordinate or returning to the reference point by G28 command, the system can
establish the machine coordinates according to the zero point of the machine. This coordinates will be saved in the system
until the user resets.
G53 IP_ ;
IP_ : absolute coordinates of the target point in the coordinates of the machine
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
Instruction description
1 Since the general positioning command (G00) can only specify the target point in the workpiece coordinates, if the user
wants to move the tool to a special position of the machine (such as the change position of the tool), G53 command is a
better choice.
2 G53 is a non-modal G code that is valid only in the block.
3 The G53 command must be an absolute command. If it is an incremental instruction, an alarm will take place.
Note
1 When the G53 command is specified, the compensation amount such as radius and length of
the tool is automatically cleared.
2 The G53 instruction prevents pre-read of the G code.
G92 IP__ ;
IP_ :to specify the coordinates of the point in the set workpiece coordinates.
The workpiece coordinates are established by making the value of the specified coordinate (IP_) into the value of the
absolute coordinate of the point on the tool (such as the tool tip) in the set workpiece coordinates.
1 In terms of the length compensation of the tool, when the coordinates are set with G92, the value of the specified
coordinate (IP_) refers to the position before the tool compensation.
2 When it comes to the radius compensation of the tool, the compensation temporarily disappears when the G92 command
counts.
3 In general,to set the workpiece coordinates before specifying tool compensation.
For example
To set the workpiece coordinates with the tool tip as the specified point
To set the workpiece coordinates with the difficulty of the base of the tool holder as the specified point
After the coordinate system is established, the tool length compensation must be added from the reference point to the tool
tip, when the command reference point is moved to the specified position through the absolute mode,
Workpiece coordinates
3 If the working coordinate system is selected, it is normal to set zero in the parameter. If not, all workpiece coordinates
are offset from the value of the parameter, after returning the parameter reference point.
Note
1 When the workpiece coordinate system is selected, the coordinate system is not required to be
set by G92. If so, the workpiece coordinates of 1-6 will be moved. Therefore, do not mix G92 with
G54-G59 unless the workpiece coordinates of 1-6 are to be moved.
2 Whether the relative position changes with the setting of the workpiece coordinates depends on
the setting in the parameter.
For example
Processing program
N10 G55 G00 X100. 0 Z20.0 ;
N20 G56 X80.5 Z25.5 ;
G92 IP_ ;
IP__ :To specify the coordinates of the point in the set of workpiece coordinates.
Command explanation
To execute the G92 command in the selected workpiece coordinates (G54-659) allows all the original ones to be offset
synchronously to produce a new coordinates with the same offset.
Instruction format
local coordinates
workpiece coordinates
local coordinates
workpiece coordinates 6
Note
1 When an axis returns to the reference point automatically or manually, its zero point coincides
with the zero point of the workpiece coordinates, that is, the local coordinates are canceled, whose
effect are the same as the command G52a; (a: the axis of returning to the reference point).
2 The setting of the local coordinates will not change the workpiece coordinates and the machine
coordinates.
3 Whether to eliminate the local coordinates during reset depends on the setting of the parameters.
4 If the workpiece coordinates is set with G92, the local coordinates will be canceled. If the
coordinate values of all axes are not commanded, the local coordinates will not be canceled and
changed.
5G52 temporarily cancels radius compensation of the tool .
6After the G52 is executed, the absolute coordinates immediately display the coordinates in the
local coordinates.
|
G17.....XY plane
G18......ZX plane
G19......YZ plane
In the blocks of G17,G18 and G19 without instruction, the plane does not change.
For example
G18X_Z_;ZX plane
X_ Y_ : plane invariant (ZX plane)
In addition, the move instruction is independent of plane selection. For example, the 7-axis is not in the XY plane, so the
Z-axis movement is independent of the XY plane.
G_IP_R__Q_P_F_J_;
Address description
Command explanation
▲Absolute programming and relative programming
To specify absolute programming and relative programming with G90 and G91
G98 (returning to the plane of the initial point) G99 (returning to the plane of the R point)
Z point
Z point
.....the plane of the initial point R point plane
R point R point
Z point Z point
▲Manner of hole processing
Fixed cycle commands of hole processing available include G73, G74, G76 and G80 ~ G89, which belong to modal G
codes.
The fixed cycle command specifies all its data, including mode and direction of the hole processing, data of hole position
and of hole processing, etc., to form a block.
Once the mode and data of the hole processing are commanded,the G code (G80 and 01 G code) for the fixed cycle is
valid until canceled, so the hole processing is not required for the mode and data of each block when the same hole
processing is performed continuously. At the beginning of the fixed cycle, all the necessary hole machining data should be
specified, and therefore only the changed data is specified in the subsequent fixed cycle.
Note
The cutting speed (F command) of the command in the canned cycle will work after the fixed
cycle is canceled.
▲Cancellation of the fixed cycle
The fixed cycle can be canceled by the code of the 01 group or G80 in the same group as the fixed cycle. G code of 01
Group includes G00, G01, G02 and G03.
Command Explanation
The high-speed drilling cycle of the deep hole refers to intermittent feed along the drilling axis, and withdraws after the
bottom of the hole, which facilitates chip evacuation and increases drilling speed and accuracy.
Note
1 The amount of withdrawal can be set by parameters, and the direction of the drilling axis is
intermittently fed; to make deep hole processing easy in chip removal. The amount of withdrawal
can be set to a small amount, which can improve its efficiency. The movement is at a high speed.
2 To start the spindle before specifying G73.
3 In terms of the the fixed cycle, if any one or more of the X, Y, Z, and R is commanded, the hole
processing works immediately. However, when X and G04 are specified at the same time, hole
processing is not performed.
4 The data Q and P of the hole processing can be commanded in the block in which the hole
processing can be performed. The data Q and P of command hole processing cannot be stored as
modal data in the block in which the hole processing is not available.
5 When it comes to the fixed cycle, the offset is made at the position of initial point of the plane, if
the offset of the tool length has been commanded.
6 The tool offset command in the fixed cycle is invalid.
7 The fixed cycle must be canceled before changing the drilling axis or processing plane.
Note
1In terms of the G74 counter-tapping cycle, the rate of feed speed and feed remain inactive. Even
if the "Feed Hold" button is pressed, it does not stop until the return operation ends.
2 To start the spindle before specifying G74. If the G74 and M codes are specified in the same
program, the M code is sent at the initial positioning, and the next loop is performed after its
execution ends.
3 In terms of the the fixed cycle, if any one or more of the X, Y, Z, and R is commanded, the hole
processing works immediately. However, when X and G04 are specified at the same time, hole
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
Note
1 To start the spindle before specifying G81.If the G81 and M codes are specified in the same
block, the M code is sent at the time of initial positioning, and the next loop is performed after the
execution of the M code ends.
2 In terms of the the fixed cycle, if any one or more of the X, Y, Z, and R is commanded, the hole
processing works immediately. However, when X and G04 are specified at the same time, hole
processing is not performed.
3 When it terms of the fixed cycle, the offset is made at the position of initial point of the plane, if
the offset of the tool length has been commanded.
4 The tool offset command in the fixed cycle is invalid.
5 The fixed cycle must be canceled before changing the drilling axis or processing plane.
For example
MO4 S800 ; spindle stats to rotate
G90 G99 G81 X100. Y100. Z- 20. R50. F100. ; to position, drill the hole 1 and return to R
X150, ; to position, drill the hole 2 and return to R
G98 Y150. ; to position, drill the hole 2 and return to the initial plane
G80 G00 XO. YO. Z0.; to cancel the fixed cycle and return to the starting point
M05 ; spindle ends to rotate
J_ :processing axis
Note
1 To start the spindle before specifying G82.If the G82 and M codes are specified in the same
block, the M code is sent at the time of initial positioning, and the next loop is performed after the
execution of the M code ends.
2 In terms of the the fixed cycle, if any one or more of the X, Y, Z, and R is commanded, the hole
processing works immediately. However, when X and G04 are specified at the same time, hole
processing is not performed.
3 The data Q and P can be processed by the command hole in the block where the hole processing
operation is allowed. The command hole processing data Q, P cannot be stored as modal data in
the block where hole processing is not available.
4 When it terms of the fixed cycle, the offset is made at the position of initial point of the plane, if
the offset of the tool length has been commanded.
5 The tool offset command in the fixed cycle is invalid.
6 The fixed cycle must be canceled before changing the drilling axis or processing plane.
Command explanation
According to the format command mentioned above, Q refers to the amount of each cutting feed commanded by the
incremental value. At the second time, the cutting feed works, while feed is quickly fed to the d mm from the
just-processed position. The Q value must be a positive value, even if a negative value has been commanded, the symbol
is invalid. d is set with parameters.
Note
1To start the spindle before specifying G83.If the G83 and M codes are specified in the same
block, the M code is sent at the time of initial positioning, and the next loop is performed after the
execution of the M code ends.
2 In terms of the the fixed cycle, if any one or more of the X, Y, Z, and R is commanded, the hole
processing works immediately. However, when X and G04 are specified at the same time, hole
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
G84IP_R_P_F_J_ ;
IP_ (non-hole processing axis): data of hole position
IP_ (hole processing axis): the distance from the R point to the bottom of the hole (incremental
value) or the coordinates of the bottom of the hole (absolute value)
R_:The distance from the initial point of the plane to the R point (incremental value), or the
coordinate of the R point (absolute value)
P_ :pause time of the bottom of the hole (in 0.001 seconds)
F_:Metric pitch. Range of value; 0. 001~ 500.00mm
J_ :processing axis
Z point Z point
Note
1 In terms of the G84 counter-tapping cycle, the rate of feed speed and feed remain inactive. Even
if the "Feed Hold" button is pressed, it does not stop until the return operation ends.
2 To start the spindle before specifying G84.If the G84 and M codes are specified in the same
block, the M code is sent at the time of initial positioning, and the next loop is performed after the
execution of the M code ends.
3 In terms of the the fixed cycle, if any one or more of the X, Y, Z, and R is commanded, the hole
processing works immediately. However, when X and G04 are specified at the same time, hole
processing is not performed.
4 The data Q and P can be processed by the command hole in the block where the hole processing
operation is allowed. The command hole processing data Q, P cannot be stored as modal data in
the block where hole processing is not available.
5 When it terms of the fixed cycle, the offset is made at the position of initial point of the plane, if
the offset of the tool length has been commanded.
6 The tool offset command in the fixed cycle is invalid.
7 The fixed cycle must be canceled before changing the drilling axis or processing plane.
Instruction format
G85 IP_R_F_J ;
IP_ (non-hole processing axis): data of hole position
IP_ (hole processing axis): the distance from the R point to the bottom of the hole (incremental
value) or the coordinates of the bottom of the hole (absolute value)
R_:The distance from the initial point of the plane to the R point (incremental value), or the
coordinate of the R point (absolute value)
P_ :pause time of the bottom of the hole (in 0.001 seconds)
Command explanation
After the tool is positioned, it moves to the R point quickly, cuts to the bottom of the hole along the Z, exits at the cutting
speed, and finally the tool returns to the R point or the initial plane.
Note
1 To start the spindle before specifying G85.If the G85 and M codes are specified in the same
block, the M code is sent at the time of initial positioning, and the next loop is performed after the
execution of the M code ends.
2 In terms of the the fixed cycle, if any one or more of the X, Y, Z, and R is commanded, the hole
processing works immediately. However, when X and G04 are specified at the same time, hole
processing is not performed.
3 When it terms of the fixed cycle, the offset is made at the position of initial point of the plane, if
the offset of the tool length has been commanded.
4 The tool offset command in the fixed cycle is invalid.
5 The fixed cycle must be canceled before changing the drilling axis or processing plane.
Command explanation
After the tool is positioned, it moves to the R point quickly, cuts to the bottom of the hole along the Z, exits at the cutting
speed, and finally the tool returns to the R point or the initial plane and at the same time spiral launches positive rotation
Note
1 To start the spindle before specifying G86.If the G86 and M codes are specified in the same
block, the M code is sent at the time of initial positioning, and the next loop is performed after the
execution of the M code ends.
2 In terms of the the fixed cycle, if any one or more of the X, Y, Z, and R is commanded, the hole
processing works immediately. However, when X and G04 are specified at the same time, hole
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
TOPCNCWORKSHOP@OUTLOOK.COM TOPCNC WORKSHOP AUTOMATION TECHNOLOGY CO., LTD.
G89 IP_R_P_F_J_;
IP_ (non-hole processing axis): data of hole position
IP_ (hole processing axis): the distance from the R point to the bottom of the hole (incremental
value) or the coordinates of the bottom of the hole (absolute value)
R_:The distance from the initial point of the plane to the R point (incremental value), or the
coordinate of the R point (absolute value)
P_ :pause time of the bottom of the hole (in 0.001 seconds)
F_: rate of the cutting feed
J_ :processing axis
Command explanation
G89 cycle is the same as the G85, except increasing the pause at the bottom of the hole, which can improve the processing
precision of the blind hole.
Note
1 To start the spindle before specifying G89.If the G89 and M codes are specified in the same
block, the M code is sent at the time of initial positioning, and the next loop is performed after the
execution of the M code ends.
2 In terms of the the fixed cycle, if any one or more of the X, Y, Z, and R is commanded, the hole
processing works immediately. However, when X and G04 are specified at the same time, hole
processing is not performed.
3 When it terms of the fixed cycle, the offset is made at the position of initial point of the plane, if
the offset of the tool length has been commanded.
4 The tool offset command in the fixed cycle is invalid.
5 The fixed cycle must be canceled before changing the drilling axis or processing plane.
G80;
Command explanation
It is used to cancel all data of all fixed cycles (G73, G74 and G81~G89), and then process according to the normal
operation.
2.11 Example of drilling fixed cycle (by length compensation of the tool )
▲ Size of the workpiece 1
Reference point
turning posiiton
▲Processing program
N0O1 G92X0 Y0Z0; The coordinates are set at the reference point.
N0O2 G90 G00 2250. 0;
N003 G43Z0H11; Length of the tool is compensated at the initial point.
N004 S1000 M3; The spindle starts.
N005 G99 G81 X400.0 Y-350.0 Z-153.0 R-97.0 F120.0; processing hole #1 after being
positioned.
N006 Y-550.0; processing hole #2 after being positioned, returning to the plane of the R
point plane.N007
G98 Y-750.0 ; processing hole #3 after being positioned, returning to returning to the
plane of the initial point
N008 699 X1200.0 ; processing hole #4 after being positioned, returning to the plane of the R
point
N009 Y-550.0 ; processing hole #5 after being positioned, returning to the plane of the R
point point
N010 98 Y-350.0 ; processing hole #6 after being positioned, returning to the plane of the initial
point
NO11 G00XO YOM5 ; to return to the reference point and the spindle stops.
N012 C49 2250.0 ;
MO00 ; to pause the tool and change it
N013 G43 Z0 H15 ; length compensation of the tool on the plane of the initial point plane.
N014 S20 M3 ; Spindle starts.
N015 G99 G82 X550.0 Y-450.0 Z-130.0 R-97.0 P30 F70; processing hole #7 after being
positioned, returning to the plane of the R point
N016 G98 Y-650.0 ; processing hole #8 after being positioned, returning to the plane of the initial
point
N017 G99 X1050.0 ; processing hole #9 after being positioned, returning to the plane of the R
point point
N018 G98 Y-450.0 ; processing hole #10 after being positioned, returning to the plane of the
initial point
N019 G00X0 Y0 M5 ; returning to the reference point and the spindle stops.
N020 G49 Z250.0 ;
MOO : to pause the tool and change it
NO21 G43 20 H31 ; length compensation of the tool at the plane of the initial point.
N022 S10 M3 ; the spindle starts.
NO23 G85 G99 X800.0 Y-350.0 Z-153.0 R47.0 F50 ; processing hole #11 after being positioned,
returning to the R plane
N024 G91 Y-200.0 ; Y-200.0 ; processing hole #12 and #13 after being positioned, returning to
the plane of the R point
N025G00C90X0YOM5; returning to the reference point and the spindle stops.
NO26 G49 20 ; to cancel length compensation of the tool.
NO27 MO5 ; the spindle stops.
N028 M30 ; the program stops
G31 IP_ F_ ;
G31: a skip command, featured by being non-modal, is valid only in this block
IP_: to specify the coordinates of the moving end point.
F_ :to specify the rate of the feed.
For example
▲The block after G31 refers to the incremental command
The incremental value is moved from the position where the skip signal is interrupted. At the same time, the X coordinate,
an absolute coordinate of the jump point is saved to the macro variable #1.
Actual movement
To enter the skip signal,
If not
......
G91 G31 X100.0 F100. 0 ;
G04 ;
#1 = #5041 ;
Y50.0 ;
......
2.14 G50-G51 refers to positioning movement
The positioning movement is a supplement to the G31 and can access to more inputs. Each axis moves in line with the
G1.
Instruction format
G50/G51 IP_ P_ ;
IP: moving axis.
P: input port.
For example:
G50 X10 Z100 P2 ; if the input port 2 is invalid during the movement, interrupt the movement and execute the next line.
G51 Y10 250 P20 ; if the input port 20 becomes valid during the movement, interrupt the movement and execute the next
line.
Name Function
M00 The program is paused and press the "cycle start" program continues
M01 Quasi-stop, if the Quasi stop light is on, the program stops
M12 Clamp
M13 Release
M30 The program ends and the program returns to the beginning
M70 Wait for input port, output port or auxiliary relay invalid. Example: M70 X12 input
port; M70 Y1 output port; M70 Z1 auxiliary relay;
M71 Wait for input port, output port or auxiliary relay Valid. Example: M71 X12 input
port; M71 Y1 output port; M71 Z1 auxiliary relay;
M72 Skip when input port, output port or auxiliary relay is invalid. Example:M72 Xxx Pn
input port;, M72 Yxx Pn output port; M72 Zxx Pn auxiliary relay;
M73 Skip when input port, output port or auxiliary relay is valid Example:M73 Xxx Pn
input port;, M73 Yxx Pn output port; M73 Zxx Pn auxiliary relay;
M74 Waiting for input, output, or auxiliary relay falling edge
M82 Output port or auxiliary relay gives output for a period of time, then close off.
Example: M82 Y12 P1000 (milliseconds)
M83 Output port or auxiliary relay gives output and close off when an input port is valid
Example: M83 Y12 X13
M84 Output port or auxiliary relay gives output and close off when an input port is invalid
Example: M84 Y12 X13
M98 Call subprogram. Note that the subprogram name format should be Oxxxx.nc and x is
the number
M99 Subprogram or macro return. If used in the main program, the program loops from the
beginning
M08/M09- Coolant
Instruction format:
M08 (or M8)
M09 (or M9)
Instruction function:
M08, coolant open
M09, coolant stop
Instruction function:
M12, chuck clamping
M13, chuck releasing
M30-end of program
Instruction format
M30
Instruction function:
Conduct M02 instruction under automatic operating, after other program segments were finished, operating this
instruction and program automatic finished, cursor return to program start-point. Spindle stopped revolving and cooling at
same time.
Using automatic count (P0003=0), counter plus 1.
Instruction function
Xx: Code 01-96.
The specified port will wait for a valid signal first, and then wait for an invalid signal. Specify only one port per time.
M83- Output port close outputting after waiting for an input port valid
Instruction format
M83 Yxx Xxx: Output port
Instruction function
Xx: Code 01-96.
Example: M83, Y12, X13. Explain: Open the 12# output port, and then judge whether 13# input port valid. If the 13#
input port valid, close the output of 12#.
Specify only one port per time.
M84- Output port close outputting after waiting for an input port invalid
Instruction format
M84 Yxx Xxx: Output port
Instruction function
Xx: Code 01-96.
Example: M84, Y12, X13. Explain: Open the 12# output port, and then judge whether 13# input port valid. If the 13#
input port invalid, close the output of 12#.
Specify only one port per time.
Instruction format
M98 P####Ln;
M99;
Command function
1. P: the subroutine calls the feature character and cannot be omitted.
2. ###: the name of the subroutine must be four numbers.
3.Ln: the number of subroutine calling refers to once when omitted, up to 9999 times.
When there is a fixed program in the program that repeats, it can be used as a subroutine, so that the execution of the
subroutine will work if necessary without repeating the programming.
The last paragraph of the subroutine must be the returns command of the subroutine, M99. When M99 command is
executed, the program returns to the main program and execute the next program of the main program command.
For example
......
N0150 M30 ;
Subroutine 0005
N0010 G01 X10 F100 ;
*...
N0060GOZ30;
N0070 M99 ;
return of subroutine
to execute the main program 00001, whose flow refers to
N0010 M03 S1000 ;
****.
N0080 GO X10 ;
G43H;G44 H_ ;
G43:positive offset
G44:negative offset
H:offset member
Instruction description
▲offset direction
Regardless of an absolute value instruction or an incremental value instruction, when G43 is specified, the coordinates
the end point specified by the Z movement command add the length compensation specified by the H code (in the offset
memory), and the calculation result is taken as the coordinate of the end point; when G44 is specified, the coordinate of
the end point specified by the Z-axis movement command in the program is subtracted from the length compensation
specified by the H code, and the result is used as the coordinate of the end point.
When the Z-axis movement is omitted, only the tool length compensation is moved. When the offset is negative, the
direction of movement is reversed. G43 and G44 are modal G codes and are valid until other G codes in the same group
occur.
▲ offset number
The offset number can specify Hn00 Hn99. In the panel LCD/ADI , the amount of the offset numbers Hn01-Hn99 can be
set in advance in the offset memory. The tool length compensation of the offset number Hn00 is always 0.The shape value
of the tool length compensation (n: X, Y, Z, A, B, C) allows the input range to be [-99999.999, 99999.9999].
Note
When the offset amount is changed with the offset amount, it simply becomes a new offset
amount, instead of the new amount of the offset and the amount of the compensation.
For example:
HZ01 offset amount of 20.0
HX02offset amount of -30.0
G90 H201 Z100.0 ; Z to 120.0
G90 HXO1 X100.0 ; X to 70.0
▲ To cancel the length compensation of the tool
To utilize the Hn00 to cancel the length compensation of the tool.
For example
Local variable could be only used for storing data in macro-program, for
example, calculation result. Cut off the power, local variable will be
#1~#99 Local variable
initiated to null.
#1000~ System variable Used for reading data while CNC is operating
Variable reference: If you want to use variable in program, adding address of variable number after specified instruction.
When you specifying variable by expression, locating the expression in bracket. For example: G01 X[#l+#2] F#3; G00
X-#l.
Note 1: Address O, G and N can’t cite variable, like O#100, N#120 were illegal reference;
2: Exceeding the Max. code value which was ruled by address, can’t use. For example, when #130 = 120, M#230
exceeded Max. code value.
Null variable: When the variable value was not defined, the variable is a null variable. If the variable # equal to zero, it
always be null variable which can’t be written but only read.
▲ When you citing an undefined variable (null variable), the address could be ignored.
When #1=<empty> When #1=0
▲ Operation. Except use <Null variable > for assignment, under other condition, <Null variable> was same to “0”.
#2=#1 #2=#1
↓ ↓
#2=<null> #2=0
#2=#1 * 5 #2=#1 * 5
↓ ↓
#2=0 #2=0
#2=#1+#1 #2=#1+#1
↓ ↓
#2=0 #2=0
▲ Condition expression, the <null> in EQ and NE not same to “0”
When #1=<null> When #1=0
#1 EQ #0
#1 EQ #0
↓
↓
True
False
#1 NE #0 #1 NE #0
↓ ↓
False False
#1 GE #0 #1 GE #0
↓ ↓
True False
#1 GT #0 #1 GT #0
↓ ↓
False False
4) Display of variable value: When variable displayed as null, variable value equal to null; when
variable displayed as “*****”, it means variable value overflowed.
5.3 System variable
System variable was used for reading and writing CNC inner data, such as: input port, output
port, tools offset value, current coordinate and etc. But some system variable could only be used
for reading.
Descriptions:
5.3.1 System macro-variable of interface signal
CNC has defined 96 units input signals and 96 units output signals of system macro-variable.
Micro input port: #1001~#1096 . Micro output port: #1101~#1196.
Valuing output macro-variable #1101~#1196 could change Y01~Y96 output signals status.
When the assignment was equal to “1”, connecting output signal; assignment equal to “0”, close
output signal.
But it’s invalid when output ports were not common use!
You can check the input status of input ports X01-X96 by detecting the value of input
macro-variable.
Corresponding table of input signal and system macro-variable:
Macro variables number Macro variables function Writing and reading function
#1001~#1096 Input port Only read
#1101~#1196 Output port Read and write
Input port 8bit read,#1=#1301
#1301~#1312 Only read
One time read-in X01~X08,
Output port 8bitread and write,
#1401~#1412 Read and write
#1401=0,one time Y01~Y08
Macro variables number Macro variables function Writing and reading function
#4007 Current tools number Only read
#4008 Current tools compensation number Only read
#6101~#6116 Z-axis 1~16 tools compensation Read and write
#6201~#6216 X-axis 1~16 tools compensation Read and write
5.3.2 System macro-variable of tools compensation
5.3.3 Other system variables
5.4 Arithmetic and logistic operation
Macro variables number Macro variables function Writing and reading function
Expressions which were positioned at operator right hand could contain constants or variables
which were composed of functions or operators. In expression, variables #j and #k could be
valued by constants. Left variable could be valued by expression too.
GOTOn;
n:Sequence number (1~99999)
Instructions format
For example:
5.5.2 Condition control
GOTO1;
GOTO# 10;
▲Instructions format 1
IF[<condition expression>]GOTOn;
If the specified condition expression was true, transfer to program segment which has the
sequence number of n; If the specified condition expression was false, operating next program
segment.
For example:
If the value of #1 variable greater than 10, transfer to program segment which has the sequence number of N2.
Program
▲Instructions format 2
IF[Condition expression] THEN<Macro-program statement >;
If the condition is satisfied, conduct the statement which was after THEN, and only one
macro-program statement can be conducted.
For example
IF[#1 EQ #2] THEN #3=0;
If #1 and #2 have equal value, then assign 0 with variable #3;If #1 and #2 not have equal value, then sequence down an
not conduct assign statement which was following THEN.
Descriptions of instruction
Conditional expression must include conditional operator. At both sides of conditional operator,
there could be variables, constants or expressions. Expressions should be closed by bracket.
Conditional operator as follows:
Operator Meanings
EQ EQ(=)
NE NE(≠)
GT GT(>)
GE GE(≥)
LT LT(<)
LE LE(≤)
Example: Following program was used for calculating the sum of integer 1-10
O9600
#1=0; Initial value of storage and number variable
#2=1; Initial value of augend variable
N1 IF[#2 GT 10]G0T02; When augend greater than 10, transfer to N2
#1= #1+#2; Calculation summation
#2= #2+1 ; Next augend
G0T01; Transfer to N1
N2 M30; End of program.
Specifying a conditional expression after “WHILE”. When the specified condition is true, conduct
the program segment from Do to END; Or, it will jump to the program segment after END.
Descriptions of instruction:
If the result of expression is not equal to 0, we regard the result as true. Cycle conducting
statements from WHILE to END until the result of expression is false. When the If the result of
expression is equal to 0, jump to next program segment which was next to END statement. If the
result of expression is not integer, force translate it to integer, or it will alarm.
M is a positive integer, only used for matching statement DO and END.
For example:
……
N1 #1 = 1 ;
N2 #2 = 0 ;
N3 WHILE[#1 <= 100] DO 5 ;
N4 #2 += #1 ;(Calculating 1+2+3+……+100)
N5 #1 += 1 ;
N6 END 5;
……
When conducting this program, #1 means plus from 1 to 100, #2 means the summation of 1+2+3+……+100
▲Instructions format 2
DO m;
……
END m ;
m:Signs of conduct range specified cycle(1~1023)
Descriptions of instruction:
If there’s no specified “WHILE” for judging conditional statement in DO type statement, it’s
infinite cycle.
As the examples in format 1, if there’s no WHILE for judging condition, the values of #1 and #2
will infinite plus until data overflow and raising alarm.
For example:
……
N1 #1 = 1 ;
N2 #2 = 0 ;
N3 DO 5 ;
N4 #2 += #1 ;(Calculating 1+2+3+……+100)
N5 #1 += 1 ;
N6 END 5;
……
▲The mark m could be reused, using nested cycle is allowable (Max. Nested8 layers), but there
are some limits as follows:
1 DO and ENDm must be used in pairs (same m value), and DO must appeared earlier than
ENDm .
2 Two cycles can not inter-cross.
3 If you use cycle nested, marks of sub-cycle can not be same with parent-cycle.
3 GOTO statement could be transferred from interior-cycle to exterior-cycle, but can not be
transferred from exterior-cycle to interior-cycle, or the alarm will be raised when conduct to END
statement.
G92 X X2 Y Y2 Z Z2
Then to set the origin of the workpiece from starting point of the tool, that is, X= -X2, Y=-Y2 and
Z= Z2.
1.1.3 selection of the workpiece coordinates G54-G59
coordinates of the
workpiece
G54 origin coordinates of the workpiece
G59 origin
the origin of
machine tool
the origin of
machine tool
That is, in the instruction format of the original G02 and G03, a third axis movement command is
perpendicular to the processing plane, so that the arc feed is performed while the third axis
direction is being fed, whose composite track refers to spatial spiral.X, Y and Z are the end points
of the projected arc, and the third coordinate refers to the end point of the axis perpendicular to the
selected plane.
G92 X150.0 Y160.0 Z120.0 create coordinates of workpiece and zero of the program
G90 G00 X100.0 Y60.0 move quickly to X=100,Y=60
2-2,0 S100 M03 move Z axis quickly to Z = -2, spindle
G01 X75.0 F100 make linear interpolation at X=75,Y= 60
X35.0 make linear interpolation at X=35, Y=60
G02 X15.0 R10. 0 make circular interpolation at X=15,Y=60
G01 Y70.0 make linear interpolation at X=15, Y=70
G03 X-15.0 R15.0 make circular interpolation at X=-15,Y=70