Академический Документы
Профессиональный Документы
Культура Документы
PROGRAMMING MANUAL
I
HNC-21T Programming Manual
CHAPTER 1 INTRODUCTION
3
HNC-21T Programming Manual
4
HNC-21T Programming Manual
The machine reference point can coincide with the machine zero or not,
the distance between machine reference point and machine zero is
defined through parameter selection.
After the machine returns to reference point the machine zero, all the
coordinate reference points are known, and the CNC machine
coordinate system is established.
The maximum and minimum limitation switches decide the
mechanical stroke of every coordinate axis.
The valid strokes of machine coordinate axes, defined by machine
builders, are determined through software limitation. Machine zero
(OM), machine reference point (OM) and the mechanical stroke of
machine coordinate system are shown in Fig.1.2.3.
Available
Z mechanical strokes
area
Z valid strokes
X mechanical strokes
Z plus X Valid strokes
Staring
switch
5
HNC-21T Programming Manual
6
HNC-21T Programming Manual
%1000
%1000
N01 G91 G00 X50 Y60
N01 G91 G00 X50 Y60
Program
N10 G01 X100 Y500 F150 S300 M03
N10 G01 X100 Y500 F150 S300 M03section
N......
Program block
N......M02
N200
N200 M02 command
Command character
7
HNC-21T Programming Manual
8
HNC-21T Programming Manual
Program block
9
HNC-21T Programming Manual
11
HNC-21T Programming Manual
M99
At beginning of the subprogram a number must be set to show the
entrance address of the subprogram. At the end of the subprogram
M99 is used to return to main program after execution of subprogram.
(ii) Formation of subprogram call
M98 P_ L_
P Number of subprogram called
L Times of called
Note Subprogram can be called with parameter. See Appendix
1.
G65 and M98 have the same function and parameter.
12
HNC-21T Programming Manual
13
HNC-21T Programming Manual
14
HNC-21T Programming Manual
G04 00 Dwell P
G20 Inch input
G21 08 Mm input
G28 00 Return to reference point X Z
G29 Return from reference point See above
G32 01 Thread cutting X Z R, E, P, F
G40 Tool radius compensation
cancel
G41 09 Tool compensation, left D
G42 Tool compensation, right D
G52 00 Local coordinate system X Z
selection
G54
G55
G56 11 Zero offset
G57
G58
G59
G65 Macro simple call P A Z
G71 Inner/outer diameter cutting
compound cycle
G72 06 Surface cutting compound X, Z, U, W, C, P, Q,
cycle R, E
G73 Closed-loop cutting
compound cycle
G76 Thread cutting compound
cycle
G80 Inner/outer diameter cutting X Z I K C, P, R,
fixed cycle E
G81 01 Surface cutting fixed cycle
15
HNC-21T Programming Manual
16
HNC-21T Programming Manual
17
HNC-21T Programming Manual
18
HNC-21T Programming Manual
Z
Program zero 30.0
The program block can only establish part coordinate system, the
tool does not move.
G92 is none mode command and always in the first line of part
program.
19
HNC-21T Programming Manual
Description
G54~G59 are 6 preset coordinates in system (shown in Fig.
3.3.3), which can be selected at requirement.
The zero value (part zero offset) of the 6 preset part coordinates
in the coordinate system can be MDI function and system auto
memory.
After the coordinate system is selected, the value commands of
absolute programming in follow-up program section are relative to
coordinate zero.
G54~G59 are mutually cancelable mode function. G54 is default.
Z
Z
X Machine zero
Part zero offset
X
X
30 B Current point A B
X
%1000
40 A
G59 O 30 Z N01 G54 G00 G90 X40 Z30
N02 G59
G54 O 30 Z N03 G00 X30 Z30
Machine zero
20
HNC-21T Programming Manual
Note
Before this command is used, zero value of every coordinate
system in machine coordinate system should be input manually (MDI).
Part coordinate
Description
G36 diameter programming
G37 radius programming
Note See Appendix 2.
Note
Because every axis moves at its differently preset speed in
executing G00, the axes do not get to the destination simultaneously.
So the track of the tool may not be a straight
Line. The operator should be cautious to avoid collision of part
and tool. It is commonly be used to move axis Z to a safety height and
then do G00.
Example 4 In programming with G00, the tool is needed to
move from A to B rapidly shown in Fig. 3.3.6.
22
HNC-21T Programming Manual
When X has the same rapid speed with Y, the rapid positioning
route from A to B is a broken line A C B.
23
HNC-21T Programming Manual
Chamfer
Chamfer function controls inserting linear chamfer and circular
chamfer between two programming blocks, it can only be used in auto
mode.
In appointed linear interpolation (G01) or circular interpolation
(G02 G03) program block end
input C__ insert chamfer program block
input R__ insert circular chamfer program block.
The number behind C is the distance from chamfer beginning and
end to the imaginary cross point, the number behind R is the radius of
circular chamfer.
The imaginary cross point is the cross point of adjacent program
blocks before end chamfer.
X 530.0 O0020
270.0
24
HNC-21T Programming Manual
(3) When preset moving value of axes X and Z is smaller than the
appointed R or C the system will give a alarm.
G02 I_ K_
Format X_ Z_ F_
G03 R_
Description
G02 Circular interpolation CW (shown in Fig. 3.3.9)
G03 Circular interpolation CCW (shown in Fig. 3.3.9)
X, Z In G90, the arc destination is the value in the part
coordinate system; in G91, it is the distance moved
from beginning to arc destination;
I, J, K The offset value (difference of coordinate value of
circle center and the beginning of the arc, shown in
Fig. 3.3.10) of circle center relative to beginning
point of arc is defined incrementally in G90/G91;
R When the arc angle is less than 180 the radius of
the arc is positive, otherwise it is negative;
F Compound speed of two axes programmed.
X X destination (X, Z)
G03
O Z
G02
Beginning
I
O G18 Z center K
25
HNC-21T Programming Manual
X
b Four arc programming methods
(i) Circle a
R30
G91 G02 X30 Z30 R30 F300
destination G91 G02 X30 Z30 I0 K30 F300
a a G90 G02 X30 Z0 R30 F300
G90 G02 X30 Z0 I0 K30 F300
R30 (ii) Circle b
G91 G02 X30 Z30 R−30 F300
Z G91 G02 X30 Z30 I30 K0 F300
beginning O G90 G02 X30 Z0 R−30 F300
G90 G02 X30 Z0 I30 K0 F300
Fig.3.3.11(a) Circular programming
i A circle CW from A
R30 G90 G02 X0 Z30 I0 K-30 F300
Z
G91 G02 X0 Z0 I0 K-30 F300
O A (ii) A circle CCW from B
G90 G03 X−30 Z0 I30 K0 F300
G91 G03 X0 Z0 I30 K0 F300
B
Note
CW and CCW directions are the circular directions
vertical to the coordinate axis of plane where the are in.
Whole-circle programming can use I, J, and K, but can
not use R.
R is valid only when I, J, and K are used in programming
at the same time.
26
HNC-21T Programming Manual
Description
X, Z The end of the thread is the coordinate value in part
coordinate in G90; it is the movement relative to the
thread beginning in G91.
F The thread guidance (spindle feed per revolution) is the
tool feed relative to part.
R, E the withdraw length of the thread. R for Z and R for X.
The recess for off run will not be used when using R and
E. The withdraw function will not be used when omitting
R and E.
P Spindle angle from spindle basic pulse to thread cutting
start
G32 can work on cylindrical thread, taper thread and end face
thread. Fig.3.3.12 shows the parameters of thread cutting.
X
X
Z
δ1
0 Z
Note
(1) The feed override cannot be used during thread cutting
(2) It is very dangerous to stop thread cutting when the spindle is
still running, so the feed keep cannot be used in thread
27
HNC-21T Programming Manual
cutting. .After pressing feed keep, the tool will stop after
thread cutting
(3) Both rough cutting and finish cutting work along the same
track repeatedly, during which the speed of the spindle must
be constant, or the thread guidance will change.
Example 8 : Fig.3.3.13 shows the cylindrical thread
programming.
Given that
F=0.4inch 1=0.3inch; 2=0.15inch cutting depth=0.1inch
cutting for twice and it is inch diameter programming.
O1000
X
M03
G20 G00 G91 X-6.2
6.2 G32 Z-7.45 F0.4
δ2 δ1 G00 X6.2
Z7.45
O X-6.4
Z G32 Z-7.45 F0.4
7
G00 X6.2
Z7.45
M02
Fig.3.3.13 G32 programming
28
HNC-21T Programming Manual
G29 can program all the axes move rapidly to the preset
destination by passing through middle point defined by G28. And it is
generally used after G28.
G29 can be used only in the program section that is specified.
29
HNC-21T Programming Manual
X R
A B C
B
70 Middle point
A
50
G91 G28 X20 Z100
G29 X-40 Z50
30 C
Z
O 30 130 180
This example tells the operator that the actual length from middle
point to reference point shall not be calculated.
Standard tool
30
HNC-21T Programming Manual
Compensation vector
由
Programming track
Programming track with T code
31
HNC-21T Programming Manual
X
100
G90 G01
Tool compensation
track X50 Z100 T0202
Z200
50 X100 Z250 T0200
Programming track M02
Z
100 200 250
G 40
G 00
Format G 41 X_Z_
G 42 G 01
Description
G40 Tool radius compensation cancelled
G41 Tool compensation, left (left side of tool path) shown
in Fig.3.3.19
G42 Tool compensation, right (right side of tool path)
shown in Fig.3.3.19
X, Z Parameter G00/G01 is the end where tool
compensation is preset or cancelled
Note G40, G41 and G42 are mutually cancelable mode code.
32
HNC-21T Programming Manual
X
Z
G42 on the right
side of the part
6
1 2
5 0 7 Z
P
C
4 3
33
HNC-21T Programming Manual
X
%1008
20
C G92 X−10 Z−10
R10
G90 T0202 M03 S900
A B G42 G00 X10 Z4
10
G01 Z20 F500
Z G03 X20 Z30 R10
-10
10 20 30 35 G01 Z40
G00 G40 X35
-10 M02
Tool positioning
Note
(1) Before machining move the tool to positioning point (relative
to programming zero (−10 −10)) manually
(2) The narrow line in figure is programming contour, the dotted
line is the actual path of the tool center.
G04 is none mode code used in the program block that is specified.
G04 makes the tool a short dwell to acquire a smooth and perfect
machining surface. It can accomplish cutting, boring and corner track
control.
34
HNC-21T Programming Manual
35
HNC-21T Programming Manual
X
66
4
8 12
16
Row part
0 Z
part
36
HNC-21T Programming Manual
X Z W
D 4R A
3F 1R U/2
C 2F
B I
X/2
Note
X Z value of cutting destination C in part coordinate in
absolute programming
The directional distance from destination C to cycle
start point A, its code is decided by the direction of
1and 2.
The command works out the track A→B→C→D→A as shown in
Fig.3.3.25.
37
HNC-21T Programming Manual
38
HNC-21T Programming Manual
X
Z W
E
4(R) A
D 1(R) U/2
3(R)
E
C 2(F) B
R X/2
Note
Thread cutting cycle, same to G32, works in feed keep; it stops
after all the movements.
Tapered thread cutting cycle
Format G82 X__Z__ I__R__E__C__P__F__
Description
X Z value of cutting destination C in part coordinate in
absolute programming
The directional distance from destination C to cycle
start point A, its code is decided by the direction of
39
HNC-21T Programming Manual
1and 2.
I the radius difference of thread start B to thread end C.
F thread guidance
R, E cutting withdraw directional value, R is withdraw in Z
direction, E is withdraw in X direction, R and E can be
omitted , meaning no withdraw.
C thread head numb 0 or 1 is sing head thread.
P the spindle corner( default value 0) from spindle basic
pulse to the cutting start in single head thread cutting
the spindle corner of distance between start and end of
adjacent thread head in multi-head thread cutting.
The command works out the track A→B→C→D→A as shown in
Fig.3.3.27.
X Z W
D
E A
C U/2
R B I
X/2
40
HNC-21T Programming Manual
A C
R
B
R
(F)
B' 45° ∆d
F
Programming
track
A′ ∆U/2
∆W
41
HNC-21T Programming Manual
A A
Z
A A
G F
160
E D
100
C A'
50
42
HNC-21T Programming Manual
43
HNC-21T Programming Manual
ns to nf in finish cutting .
∆d
C
A′
A
45°
Programming path
∆U/2
B
∆W
A A
A' A'
A' A A A'
B B
44
HNC-21T Programming Manual
Note
(1) G72 command should have P and Q address or it can not
beused.
(2) ns program block must have G00/G01 command to run from
A to A' and the program block should not have movement
of Z direction.
(3) G02/G03 can be used in program blocks from ns to nf.
Command can be used, but subprogram should not be
included.
Example 15 Machining program in Fig.3.3.34: makes the contour
from A’ to B cycle start is at A(250 370) cutting depth
is 8mm The withdraw is 2mm the finish residual of X
direction is 0.1mm the finish residual of Z direction is
0.2mm.
X
A
250 A
C D
160
E F
100
G B
50
Z
0 50 100 170 230 300 370
45
HNC-21T Programming Manual
46
HNC-21T Programming Manual
Note
I and K are rough feed rough times are d every turning
feed of X and Z are I/d and K/d
P and Q command in G73 make the cycle. Attention must be paid
on the positive and negative marks of U, W I and
K.
Example 16 Machining program in Fig.3.3.36:makes the contour
from A’ to B cycle start is at A(200 250) cutting depth
is 8mm, the rough residual in axis X and Z are 14mm and
14mm, the rough times are 3. The finish residual of X
47
HNC-21T Programming Manual
X I+ u
( K+ W)
100
80
20
40
0
Z
R35
25 15
10 8
58
Format
G76C(m)R(r)E(e)A(a)X(U)Z(W)I(i)K(k)U(d)V( ∆ dmin)Q( ∆ d)P(p)F(L);
Description
Fig. 3.3.37 shows the turning track of thread cutting
compound cycle G76. The single side turning and
48
HNC-21T Programming Manual
E (R) A
(R)
U/2
(F)
e (F) d
X
D B
i
K
r W C
49
HNC-21T Programming Manual
d
1st
k
2nd
dvn
nth
d
50
HNC-21T Programming Manual
(1) Variable
#0 #49 Local variables
#50 #199 System variables
#200 #249 0 layers local variables
#250 #299 1 layers local variables
#300 #349 2 layers local variables
#350 #399 3 layers local variables
#400 #449 4 layers local variables
#450 #499 5 layers local variables
#500 #549 6 layers local variables
#550 #599 7 layers local variables
#600 #699 Tool length memoryH0 H99
#700 #799 Tool length memory D0 D99
#800 #899 Tool life memory
#1000 Current position of machine #1001 Currentpositionofmachine #1002 Current position of
X Y machineZ
#1003 Current position of machine #1004 Currentpositionof machineB #1005 Current position of
A machineC
#1006 Current position of machine #1007 Currentposition ofmachineV #1008 Current position of
U machineW
programmedX programmedY
51
HNC-21T Programming Manual
#1012 Position of machine #1013 Position of machine programmed #1014 Position of machine
programmedZ A programmed B
#1015 Position of machine #1016 Position of machine programmed #1017 Position of machine
programmedC U programmedV
programmedW programmedX
#1021 Position of part programmed #1022 Positionofpart programmed Z #1023 Position of part
Y programmedA
#1024 Position of part programmed #1025 Positionofpart programmedC #1026 Position of part
B programmedU
#1030 Currentzeroof the partX #1031 Currentzeroof the partY #1032 Current zero of the
partZ
#1033 Current zero of the part #1034 Currentzeroof the partB #1035 Current zero of the
A partC
#1036 Current zero of thepartU #1037 Currentzeroof the partV #1038 Current zero of the
partW
establish”
52
HNC-21T Programming Manual
coordinateaxis pointX”
pointA”
pointU”
#1120 Positionof imaginary pointX #1121 Positionofimaginary pointY #1122 Positionofimaginary pointZ
pointW
53
HNC-21T Programming Manual
(2) Constant
PI
54
HNC-21T Programming Manual
(4) Functions
SIN COS TAN ATAN ATAN2
ABS INT SIGN SQRT EXP
(5) Equations
The equations are composed of constants, symbols and variables.
For example 175/SQRT[2] * COS[55 * PI/180 ]
#3*6 GT 14
ELSE
ENDIF
Format (ii) IF Conditional expression
55
HNC-21T Programming Manual
ENDIF
3.4.5 Circulation WHILE ENDW
WIIILE Conditional expression
ENDW
Uses of conditional sentences are illustrated in the examples of
macro programming.
Uses of circulation sentences are illustrated in the examples of
macro programming.
16
Z
0 32
%8002
#10=0 X coordinate
#11=0 Z coordinate4
N10 G92 X0.0 Z0.0
M03 S600
WHILE #10 LE 16
G90 G01 X[#10] Z[#11] F500
#10=#10+0.08
#11=#10*#10/8
ENDW
56
HNC-21T Programming Manual
G00 Z0 M05
G00 X0
M30
57
HNC-21T Programming Manual
command
R I K
Radius transfer/min
58
HNC-21T Programming Manual
59
HNC-21T Programming Manual
#7 H
#8 I
#9 J
#10 K
#11 L
#12 M
#13 N
#14 O
#15 P
#16 Q
#17 R
#18 S
#19 T
#20 U
#21 V
#22 W
#23 X
#24 Y
#25 Z
#26 Mode value of Z-plane in fixed mode
#27 Unavailable
#28 Unavailable
#29 Unavailable
#30 Absolute coordinate of 0- axis when
subprogram called
#31 Absolute coordinate of 1- axis when
subprogram called
#32 Absolute coordinate of 2- axis when
subprogram called
#33 Absolute coordinate of 3- axis when
subprogram called
#34 Absolute coordinate of 4- axis when
60
HNC-21T Programming Manual
subprogram called
#35 Absolute coordinate of 5- axis when
subprogram called
#36 Absolute coordinate of 6- axis when
subprogram called
#37 Absolute coordinate of 7- axis when
subprogram called
#38 Absolute coordinate of 8- axis when
subprogram called
M99
HNC-21T CNC system has nine layers of subprogram can be
used. Every layer of subprogram has its independent local variables, at
most 50. Current local variables are #0-#49 the first layer local
variables are #200-#249, the second layer local variables are
#250-#299 the third layer local variables are #300-#349 and so on.
The definition of local variables is dependent on number of layers
in the last subprogram, for example,
o0099
g92 X0 Z0
N100 #10=98
M98 P100
M30
o100
N200 #10=100 ; The local variable of #10 in subprogram
containing N100 is #210 in the first layer
M98 P110
M99
o110
N300 #10=200 ; The local variable of subprogram
containing N100 is #260 in the second layer
; The local variable of #10 in subprogram containing N100
is #210 in the first layer
M99
62
HNC-21T Programming Manual
O2
; Circle machining program, center is (X,Z), radius is R
; X -> #23 Y -> #24 R -> #17
IF [AR[#17] EQ 0] OR [#17 EQ 0] ; If R is not defined
M99
ENDIF
63
HNC-21T Programming Manual
#0=#23+#17*COS[0];
#1=#25+#17*SIN[0];
G01 X[#0] Z[#1];
#10=1
WHILE [#10 LE 100] ; 100 little line segments form a
circle
#0 = #17*[ COS[#10*2*PI/100]-COS[[#10-1]*2*PI/100] ]
#1 = #17*[ SIN[#10*2*PI/100]-SIN[[#10-1]*2*PI/100] ]
G01 X[#0] Z[#1]
#10=#10+1
ENDW
%0000
;" fixed cycle macro: G73,G74,G76,G80,G81,G82;
; _____________________________________________________________
%0080
; the source codes of inner/outer diameter cutting cycle G80
; before call the program, run spindle with M03 or M04
#40 = #1152
IF [AR[#25] EQ 0] OR [AR[#23] EQ 0]
; if X and Z are not defined
M99 ; return
ENDIF
64
HNC-21T Programming Manual
ENDIF
IF #1009 EQ 0
#41 = 2 ;radius programming
ELSE
#41 = 1 ;diameter programming
ENDIF
g01 X[#30*2/#41] Z[#32]
#42=[#23+#8]*2/[#41]
N20 g00 X[#42]Z[#32] ;move to turning point
#42=[#23]*2/[#41]
N30 G01 Z[#25]X[#42]
#42=[#30]*2/[#41]
N40 G01 X[#42] ;turning
N50 G00 Z[#32] ;return to the initial point
G[#40]
M99
65
HNC-21T Programming Manual
; _____________________________________________________________
%0081
; the source codes of surface cutting cycle G81
; before call the program, run the spindle with M03 or M04
#40=#1152
IF [AR[#25] EQ 0] OR [AR[#23] EQ 0]
; if X and Z are not defined
M99 ; return
ENDIF
ENDIF
IF #1009 EQ 0 ;
#41 = 2 ;radius programming
ELSE
#41 = 1 ;diameter programming
ENDIF
G90g01 X[#30*2/#41] Z[#32]
66
HNC-21T Programming Manual
#42=[#23]*2/[#41] ;
N30 G01 X[#42]Z[#25]
N40 G01 Z[#32] ;turning
#42=[#30]*2/[#41] ;
N50 G00 X[#42] ;return to initial point
G[#40]
M99
; _____________________________________________________________
%0082
; the source codes of thread cutting cycle G82
; before call the program run the spindle with M03 or M04
#40=#1152
IF [AR[#25] EQ 0] OR [AR[#23] EQ 0]
; if X and Z are not defined
M99 ; return
ENDIF
67
HNC-21T Programming Manual
ENDIF
#28 = 0;
IF [#2 EQ 1]
#28 = #15 ; initial angle
#15 = 0
ENDIF
IF #1009 EQ 0 ;
68
HNC-21T Programming Manual
WHILE [#2 GE 1]
#42=[#23+#8]*2/[#41] ;
N20 G00 X[#42] Z[#32] ;move to turning point
#42=[#23]*2/[#41] ;
N30 G32 X[#42] Z[#25] E[#4] R[#17] P[#28] F[#5]
#42=[#30]*2/[#41] ;
N40 G01 X[#42] Z[#25+#17] ;turning
N50 G00 Z[#32] ;return to initial point
#2 = #2 -1
#28 = #28 +#15;
ENDW
G[#40]
M99
; _____________________________________________________________
%0071
; the source codes of inner/outer compound cycle G71
; before call the program, run the spindle with M03 or M04
IF [AR[#20] EQ 0] OR [AR[#17] EQ 0]
; if the cutting depth and tool
withdraw length R are not define
M99 ; return
ENDIF
69
HNC-21T Programming Manual
ENDIF
#0=0
#1=#2000 ;number of the points
IF #1 LE 1 ;if the number of point is less than
1,return
M99;
ENDIF
70
HNC-21T Programming Manual
Z<0
#4=-#17 ;tool withdraw direction is
negative
ENDIF
WHILE [[#1] GT 1]
#6=#[2100+#1]+[#23]*2/#41 ;the absolute coordinate of last X
#7=#[2200+#1]+#25 ;the absolute coordinate of last Z
#8=#[2100+#1-1]+[#23]*2/#41 ; the absolute coordinate of next
X
#9=#[2200+#1-1]+#25 ; the absolute coordinate of next
Z
WHILE [[[#5 GE #8] AND [#5 LE #6]] OR [[#5 LE #8] AND [#5 GE #6]] ]
; X is within the two points with
cross point
#10=#[2000+#1]
71
HNC-21T Programming Manual
#5 = #5 + #2 ;X move
ENDW
#1 = #1 -1;
72
HNC-21T Programming Manual
ENDW
M99
; _____________________________________________________________
%0072
; the source codes of surface rough cutting compound cycle G72
; before call the program run spindle with M03 or M04
73
HNC-21T Programming Manual
M99 ;return
ENDIF
IF [#22 LE 0] OR [#17 LE 0]
M99 ;if W and R are less than 0,
return
ENDIF
#49 = #1152
IF [#1009 EQ 0]
#41 = 2 ;radius programming
ELSE
#41 = 1 ;diameter programming
ENDIF
G90g01 X[#30*2/#41] Z[#32]
#0=0
#1=#2000 ;number of points
IF #1 LE 1 ;if the number≤1 return
M99
ENDIF
74
HNC-21T Programming Manual
WHILE [[#1] GT 1]
#6=#[2100+#1]+[#23]*2/#41 ;the absolute coordinate of last X
#7=#[2200+#1]+#25 ;the absolute coordinate of
last Z
#8=#[2100+#1-1]+[#23]*2/#41 ; the absolute coordinate of
next X
#9=#[2200+#1-1]+#25 ; the absolute coordinate of
next Z
WHILE [ [[#12 GE #9] AND [#12 LE #7]] OR [[#12 LE #9] AND [#12
GE #7]] ] ;Z is within the two points
75
HNC-21T Programming Manual
76
HNC-21T Programming Manual
#1 = #1 -1;
ENDW
M99
; _____________________________________________________________
%0073
; the source codes of closed contour cycle G73
; before call the program the run spindle with M03 or M04
77
HNC-21T Programming Manual
IF #17 LE 0
M99 ;if R is less then 0, return
ENDIF
#49 = #1152
IF #1009 EQ 0
#41 = 2 ;radius programming
ELSE
#41 = 1 ;diameter programming
ENDIF
G90g01 X[#30*2/#41] Z[#32]
#0=#17
#1=1
#2=[#30+#23+#20]*2/#41 ;current coordinate of X: A1
#3=#32+#25+#22 ; current coordinate of Z: A1
G90
G00 X[#2] Z[#3] ;move to A1
WHILE #0 GT 0
WHILE #1 LE #2000
#4=[[#20*2/#41]/#17] ;feed length in X direction
#5=[#22/#17] ; feed length in Z direction
#6=#[2100+#1]+[#23]*2/[#41]+[#4*#0] ;next coordinate of X
#7=#[2200+#1]+#25+[#5*#0] ; next coordinate of Z
#8=#[2000+#1] ;G
#9=#[2300+#1] ;R
IF #8 LT 2 ;straight line
G[#8] X[#6] Z[#7]
ELSE
G[#8] X[#6] Z[#7] R[#9]
78
HNC-21T Programming Manual
ENDIF
#1=#1+1
ENDW
#2=#2-[[#20*2/#41]/#17];
#3=#3-[#22/#17]
G00 X[#2] Z[#3] ;move to next starting point
#1=1
#0=#0-1
ENDW
#0=1
WHILE #0 LE #2000 ;last time
#9=#[2000+#0]
#10=#[2300+#0]
#6=#[2100+#0]+[#23]*2/[#41]; ;next X with finish residual
#7=#[2200+#0]+[#25] ; next Z with finish residual
IF #9 LT 2 ;straight line
G[#9] X[#6] Z[#7]
ELSE
G[#9] X[#6] Z[#7] R[#10]
ENDIF
#0=#0+1
ENDW
M99
; _____________________________________________________________
%0076
the source codes of thread cutting compound cycle G76
before call the program, run spindle with M03 or M04
79
HNC-21T Programming Manual
80
HNC-21T Programming Manual
IF [#1009 EQ 0]
#39 = 2 ;radius programming
ELSE
#39 = 1 ;diameter programming
ENDIF
G90g01 X[#30*2/#39] Z[#32]
81
HNC-21T Programming Manual
ENDIF
#47=INT[[#10/#16]*[#10/#16]] ;calculate N
#48=1
#49=#47
#1=#0/2*PI/180
;K<Q*sqrt(n)
WHILE #49 GT 1
#40=#16*[SQRT[#48]] ;cutting depth in X direction
#41=#16*[SQRT[#48-1]]
IF [#40-#41] LT #21 ;if per cutting feed is less than
V
#40=#41+#21 ;define as V
#47=0
#42=#40*[TAN[#1]] ; cutting depth in Z direction
WHILE #40 LT #10
#38=[#30+[#27]*[#40]]*2/#39
G90 G00 X[#38] Z[#32+[#28]*#42] ;move alone the gear
82
HNC-21T Programming Manual
#38=[#23+#8+#10+#20+[#27]*[#40]]*2/#39
G00 X[#38] ;move to starting
point of the thread
#38=[#23+#10+#20+[#27]*[#40]]*2/#39
G32 X[#38] Z[#25+[#28]*#42] E[#4] P[#15] R[#17] F[#5]
;cutting thread
G00 X[[#30]*2/#39] Z[#32] ;return to A
#40=#40+#21
#42=#40*[TAN[#1]] ;cutting depth in
Z direction
ENDW
#40=#10
#47=0
#42=#40*[TAN[#1]] ; cutting depth in
Z direction
WHILE #47 LT #2 ;finish cutting
#38=[#30+[#27]*[#40]]*2/#39
G90 G00 X[#38] Z[#32+[#28]*#42] ;move alone the gear
#38=[#23+#8+#10+#20+[#27]*[#40]]*2/#39
G00 X[#38] ; move to starting
point of the thread
#38=[#23+#10+#20+[#27]*[#40]]*2/#39
G32 X[#38] Z[#25+[#28]*#42] E[#4] P[#15] R[#17] F[#5]
;thread cutting
G00 X[[#30]*2/#39] Z[#32] ;return to A
#47=#47+1
ENDW
M99
ENDIF
#42=#40*[TAN[#1]] ; cutting depth in
Z direction
#38=[#30+[#27]*[#40]]*2/#39
G90 G00 X[#38] Z[#32+[#28]*#42] ;move alone the
gear
83
HNC-21T Programming Manual
#38=[#23+#8+#10+#20+[#27]*[#40]]*2/#39
G00 X[#38] ;move to starting
point of the thread
#38=[#23+#10+#20+[#27]*[#40]]*2/#39
G32 X[#38] Z[#25+[#28]*#42] E[#4] P[#15] R[#17] F[#5]
;cutting thread
G00 X[[#30]*2/#39] Z[#32] ;return to A
#48=#48+1
#49=#49-1
ENDW
M99
84
Page: 46
[½ð1]
Page: 48
[½ð2]
Page: 49
[½ð3]
Page: 50
[½ð4]