' ע:
' 1: ע͵ĸʽ űʾע͵β
' 2: ༭ļʱ4λƱ(TAB)ע롣
' 3: ʱϸע
'
' ӳд涨
' 0~999 ϵͳӳϵͳʹãûֻIJеãʹЩбдӳ
' :
' 0~199 Ncstudioʹõӳ
' 200~999 ɽڲʹõӳ
' ӳÿŴһ̶ĺ壬дڸóǰעͱ
'
' 1000~9999 ûӳûɱдɵ
' M1000~9999 ' 1000~9999 ûӳһһӦ
' ̶#-1 #-64ʹΪ
' #-1(Q63) λmm, Ե
' #-2(Q62) λmm, ̶Ե뵶ӴʱĹ
' #-3(Q61) λ, (ֹͣ)ʱ
' #-4(Q60)
' #-5(Q59) ֵ, ǷԶػλ
' #-6(Q58) λmm, λXе
' #-7(Q57) λmm, λYе
' #-8(Q56) λmm, λZе
' #-9(Q55) λmm, ̶ԵXе
' #-10(Q54) λmm, ̶ԵYе
' #-11(Q53) λmm, Ե뵶ӴʱĻе
' #-12(Q52) λmm, ߶νޣСڴ˳ȵ߶ΪǶ߶
' #-13(Q51) λmm, ߳ʱ뵶ӴʱĻе
' #-14(Q50) λdeg, ϸڼӹʶǶ
' #-15(Q49) λms, תʱʱ
' #-16(Q48) λms, ӹʱʱ
' #-17(Q47) λmm/min, ϸڼӹٶ
' #-18(Q46) λmm, ̶ԵµλãZе꣩
' #-19(Q45) ȫ߶ݴ
' #-20(Q44) ģʽݴ
' #-22(Q42) Xеݴ(ֶλ)
' #-23(Q41) Xеݴ(λ)
' #-24(Q40) Xֶλźź;λź֮ľ
' #-25(Q39) Yеݴ(ֶλ)
' #-26(Q38) Yеݴ(λ)
' #-27(Q37) Yֶλźź;λź֮ľ
' #-28(Q36) Zеݴ(ֶλ)
' #-29(Q35) Zеݴ(λ)
' #-30(Q34) Zֶλźź;λź֮ľ
' #-39(Q25) X˾
' #-40(Q24) Y˾
' #-41(Q23) Z˾
' #-42(Q22) ӹɺص̶X
' #-43(Q21) ӹɺص̶Y
' #-44(Q20) ӹɺص̶Z
' #-31(Q33) ~ -64(Q0) Reserverd for future use
' #-46(Q18) Ե̧߶
'
'0~199 for Ncstudio
'
'200~999 ɽڲʹõӳ
' 200~599 ΪMָʹô :+200
' 600~999 ΪGָʹô :+600
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Note:
' 1: The format of a comment: a single quotation in front indicates its a comment to the end of line.
' 2: 8-bit Tab recommend to be used for the alignment when editing the file.
' 3: The comments should be easy to understand.
'
' Compiling rules for subprogram
' Subprograms NO.0-999 are only valid for System.
' Users are allowed to adjust parameters and call these subprograms but forbidden to write subprograms with NO.0~999.
' Subprograms NO.0-199 are confined to utility in Ncstudio main program.
' Subprograms NO.200-999 are for Interpreter.
' Each NO represents a functional subprogram, please give detailed comments when programming new one.
'
' Subprograms NO.1000-9999 are users subprograms which can be compiled and called freely by users.
' Commands M1000-9999 are exactly corresponding to subprograms NO.10000-9999.
' Static/constant parameters in this system vary from #-1 to #-64, whose descriptions are as follows:
' #-1(Q63) unit:mm Thickness of touch probe
' #-2(Q62) unit:mm Coordinate (Z) of cutter tip in WCS when touching fixed touch probe
' #-3(Q61) unit:ms Delay of spindle ON (or OFF)
' #-4(Q60)
' #-5(Q59) unit:logicals Whether automatically back to tool change position
' #-6(Q58) unit:mm Coordinate(X) of tool change position
' #-7(Q57) unit:mm Coordinate(Y) of tool change position
' #-8(Q56) unit:mm Coordinate(Z) of tool change position
' #-9(Q55) unit:mm Coordinate(X) of fixed tool touch probe
' #-10(Q54) unit:mm Coordinate(Y) of fixed tool touch probe
' #-11(Q53) unit:mm Coordinate (Z) of cutter tip in MCS when touching mobile tool touch probe
' #-12(Q52) unit:mm Maximum length of Short Line, line segment shorter are described as Short Line
' #-13(Q51) unit:mm Coordinate (Z) of cutter tip in MCS when touching work piece during measuring tool length
' #-14(Q50) unit:deg Identify angles in minutia machining
' #-15(Q49) unit: ms Delay in rapid turn
' #-16(Q48) unit: ms Delay in contouring
' #-17(Q47) unit:mm/min Connection speed in minutia machining
' #-18(Q46) unit: mm Coordinate (Z) in MCS where spindle stops rapid motion and slowly moves to fixed tool touch probe
' #-19(Q45) Temporal save for SAFETY HEIGHT
' #-20(Q44) Temporal save for MACHINING MODE
' #-22(Q42) Temporal save for coordinate(X) during rough positioning
' #-23(Q41) Temporal save for coordinate(X) during fine positioning
' #-24(Q40) Distance between signals of rough positioning and fine positioning (X-axis)
' #-25(Q39) Temporal save for coordinate(Y) during rough positioning
' #-26(Q38) Temporal save for coordinate(Y) during fine positioning
' #-27(Q37) Distance between signals of rough positioning and fine positioning (Y-axis)
' #-28(Q36) Temporal save for coordinate (Z) during rough positioning
' #-29(Q35) Temporal save for coordinate (Z) during fine positioning
' #-30(Q34) Distance between signals of rough positioning and fine positioning (Z-axis)
' #-39(Q25) Distance retracted (X-axis)
' #-40(Q24) Distance retracted (Y-axis)
' #-41(Q23) Distance retracted (Z-axis)
' #-42(Q22) Coordinate(X) of fixed point spindle back to after finishing machining
' #-43(Q21) Coordinate(Y) of fixed point spindle back to after finishing machining
' #-44(Q20) Coordinate(Z) of fixed point spindle back to after finishing machining
' #-31(Q33) ~ -64(Q0) Reserved for future use
' #-46(Q18) Tool retract height after tool touch
'
' 0~199 for Ncstudio
'
' 200-599 are code numbers for M command: +200
' 600-599 are code numbers for G command: +600
' Details: NO.[subprogram]=NO.[command M]+200
' E.g.M06 is a universal M code, M206 (206=6+200) is a code used in subprogram.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'ϵͳԶִ
'System Start automated execution
O11
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'عԭ
'Back to WCS zero
O12
'#-19 -- ȫ߶
'Parameter: #-19 -- Safe Height
' #-20 -- ӹģʽ
' #-20 -- machining mode
'˶ԭϷȫ߶ȴ
'Traverse to Safe Height above the Work piece Zero
G00 G90 X0 Y0 Z=#-19
'˷ӳF7ԭ⣨ʱԭݶʧʱƫλżȻ
'Ҷ˵µ2.8Gͻ⣬Ǹͻɾɵԣܳʱû
'ͼ⡣ --zzk
G04 P100
G906
G04 P100
'ָӹģʽ
'Resume the machining mode
M802 P=#-20
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'ļԶִԴ
'Cycle Start automated execution
'#1 -- 趨ת
'Parameter: #1 C- set spindle speed
O14
'ͬ
'Synchronization
G906
IF(#ENABLEARRAY) G906; G992 X = #SSCURPOS0-#TEMPORIGIN0 Y = #SSCURPOS1-#TEMPORIGIN1
IF(#ARRAYFIRSTTASK) M3
'ȴ
'Spindle Coolant on
M901 H6 P1;
M801 ""
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'ļԶִн
'Cycle Stop automated execution
O15
'ͬ
'Synchronization
G906
IF (!#ARRAYLASTTASK) M17
IF(#STOPSPINWHENRECYCLE && #ONRECYCLE)M5;
IF(!#ONRECYCLE && #STOPSPINEND)M5;
'رȴ
'Spindle Coolant off
M901 H6 P0;
M801 ""
IF(#AXISENDACTION = 1) M801 "|D|spindle back to fixed point"; G53 G00 G90 X=#-42 Y=#-43 Z=#-44
IF(#AXISENDACTION = 2) M801 "|D|Spindle back to Work piece Zero"; G00 G90 X=0 Y=0 Z=#-19
'صλ
'Back to tool change position
IF(#-5) G53 G00 G90 X=#-6 Y=#-7 Z=#-8
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Ե:
'Tool measurement with mobile tool touch probe: to work piece surface
O13
'ͬ
'Synchronization
G906
'ֹͣ
'Spindle OFF
M5
M801 ""
G04 P10
'رջ
'Buffer zone off
M802 P196609
G04 P10
'˶ֱӴԵ
'Cutter moves downward till touching tool touch probe
G904 Z-50 K15 H1
G904 Z200 K15 H0
G904 Z-50 K15 H1
G04 P10
G906
#1=#SSCURPOS2
G904 Z100 K15 H0
G904 Z-50 K15 H1
G04 P10
G906
#1=(#SSCURPOS2+#1)
G904 Z60 K15 H0
G904 Z-50 K15 H1
G04 P10
G906
#1=(#SSCURPOS2+#1)/3
'
'Buffer zone on
M802 P196608
G04 P10
G53 G00 Z=#1
'Ե˶һ߶ȣԱ
'After tool touching, cutter moves certain distance upward to protect the tip
G905 G903 G00 G91 Z=#-46 F2000
'ͬ
'Synchronization
G906
'õǰZ, #-1 ǶԵ
'Set Current point Z coordinate in WCS, #-1 is the thickness of the tool touch probe
G92 Z=#-1 + #-46
G906
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'̨
'To measure work plane surface
O18
'ͬ
'Synchronization
G906
'ֹͣ
'Spindle OFF
M5
M801 ""
G04 P10
'رջ
'Buffer zone off
M802 P196609
G04 P10
'˶ֱӴԵ
'Cutter moves downward till touching surface of tool touch probe
G904 Z-100 K15 H1
G904 Z200 K15 H0
G904 Z-60 K15 H1
G04 P10
G906
#1=#SSCURPOS2
G904 Z100 K15 H0
G904 Z-60 K15 H1
G04 P10
G906
#1=(#SSCURPOS2+#1)
G904 Z60 K15 H0
G904 Z-60 K15 H1
G04 P10
G906
#1=(#SSCURPOS2+#1)/3
G04 P10
'
'Buffer zone on
M802 P196608
G04 P10
'Ե˶һ߶ȣԱ
'After tool touching, cutter moves certain distance upward to protect the tip
G903 G00 G91 Z=#-46
'ͬ
'Synchronization
G906
'ų̀λ
'Set software limits of work plane surface
#1=#1-(#-1)
M801 "func//:_OnSetLimitLowerZ"
G906
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'̶ԵУ˳֮һ
'Tool measurement with fixed touch probe: the first step getting the standard
O16
'ͬ
'Synchronization
G906
'ֹͣ
'Spindle OFF
M5
M801 ""
'Z
'Z-axis moves to top
G53 G00 G90 Z-1
'̶ԵĻе
'MCS coordinate of fixed tool touch probe
G53 G00 G90 X=#-9 Y=#-10 Z=#-18
G04 P10
'رջ
'Buffer zone off
M802 P196609
G04 P10
'˶ֱӴԵ
'Cutter moves downward till touching surface of tool touch probe
G904 Z-400 K15 H1
G904 Z200 K15 H0
G904 Z-60 K15 H1
G04 P10
G906
#-2=#SSCURWORKCOOR2
G904 Z100 K15 H0
G904 Z-60 K15 H1
G04 P10
G906
#-2=(#SSCURWORKCOOR2+#-2)
G904 Z60 K15 H0
G904 Z-60 K15 H1
G04 P10
G906
#-2=(#SSCURWORKCOOR2+#-2)/3
G04 P10
'
'Buffer zone on
M802 P196608
G04 P10
'Ϊ˱һֱӴԵ飬˶һ߶
'After tool touching, cutter moves certain distance upward to protect the tip
G00 G91 Z=#-46
G906
G04 P100
'¼ǰZṤ
'Save coordinate(Z) in WCS
#-2=#-2+ #-46
'Z
'Z-axis moves to top
G53 G00 G90 Z-1
'صԭϷ
'Back to zero in WCS
G00 G90 X0Y0
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'̶ԵУ˳֮ڶ
'Tool measurement with fixed touch probe: the second step measuring changed tool
O17
'ͬ
'Synchronization
G906
if(#SSOUTPORT4)M5;
M801 ""
'Z
'Z-axis moves to top
G53 G00 G90 Z-1
'̶ԵĻе
'MCS coordinate of fixed tool touch probe
G53 G00 G90 X=#-9 Y=#-10 Z=#-18
G04 P10
'رջ
'Buffer zone off
M802 P196609
G04 P10
'˶ֱӴԵ
'Cutter moves downward till touching surface of tool touch probe
G904 Z-400 K15 H1
G904 Z200 K15 H0
G904 Z-60 K15 H1
G04 P10
G906
#30 = #SSCURWORKCOOR2
G904 Z100 K15 H0
G904 Z-60 K15 H1
G04 P10
G906
#30 = #SSCURWORKCOOR2 + #30
G904 Z100 K15 H0
G904 Z-60 K15 H1
G04 P10
G906
#30 = #SSCURWORKCOOR2 + #30
#30 = #30 / 3
'
'Buffer zone on
M802 P196608
G04 P10
G00 Z=#30
'Ϊ˱һֱӴԵ飬˶һ߶
'After tool touching, cutter moves certain distance upward to protect the tip
G00 G91 Z=#-46
G04 P500
G906
'ָǰZṤ
'resume coordinate(Z) in WCS
G92 Z=#-2
G906
'Z
'Z-axis moves to top
G53 G00 G90 Z-1
'صԭϷ
'Back to zero in WCS
G00 G90 X0 Y0
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'߳ȣʹøԵӳԵ뵶ƫ
'To measure tool length: call subprogram Measuring with mobile touch probe
'and save the result to TOOL OFFSET in tool management list.
O20
'ͬ
'Synchronization
G906
'ֹͣ
'Spindle OFF
M5
M801 ""
G04 P10
'رջ
'Buffer zone off
M802 P196609
G04 P10
'˶ֱӴԵ
'Cutter moves downward till touching surface of tool touch probe
G904 Z-400 K15 H1
G904 Z200 K15 H0
G904 Z-60 K15 H1
G04 P10
G906
#-13=#SSCURPOS2
G904 Z100 K15 H0
G904 Z-60 K15 H1
G04 P10
G906
#-13=(#SSCURPOS2+#-13)
G904 Z60 K15 H0
G904 Z-60 K15 H1
G04 P10
G906
#-13=(#SSCURPOS2+#-13)/3
G04 P10
'
'Buffer zone on
M802 P196608
G04 P10
'Ե˶һ߶ȣԱ
'After tool touching, cutter moves certain distance upward to protect the tip
G905 G903 G00 G91 Z=#-46 F2000
'ͬ
'Synchronization
G906
'ֱӽԵ±е뵶ƫ
'Save coordinate in MCS of touch probe lower surface into TOOLOFFSET
'±е = ǰе - Ե
'coordinate in MCS of touch probe lower surface = current coordinate in MCS - touch probe thickness
#-13=#-13 - #-1
'õǰƫ
'Set offset of current tool
G923 Z=#-13
G906
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'ȫػеԭ
'All axes back to REF
O1
'Zػеԭ
'Z axis back to REF
G65 P103 L1
'XYͬʱػеԭ
'X\Y axes back to REF simultaneously
G65 P104 L1
M801 ""
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Xᵥػеԭ㣨ο㣩
'X-axis back to REF
O101
'ֶλ
'Rough positioning
'λ
'Shield limit signal
M802 P131072
'XḺ˶ֱXźų
'X-axis moves in minus direction until appearance of switch zero signal(X-axis)
G904 X=#BKREFSPEEDROUGH0 * #REFDIRROUGH0 I0 P1
G04 P10
'X˶ֱXźų
'X-axis moves in plus direction until appearance of switch zero signal (X-axis)
G904 X=#BKREFSPEEDROUGH0 / 3 * #REFDIRROUGH0 * -1 I0 P1
G04 P10
'X˶ֱXźʧ
'X-axis moves in plus direction until disappearance of switch zero signal (X-axis)
G904 X=#BKREFSPEEDROUGH0 / 9 * #REFDIRROUGH0 * -1 I0 P0
G04 P10
'λ
'Fine positioning
'رջ
'Buffer zone off
M802 P196609
G04 P10
'XḺ˶ֱXźų
'X-axis moves in minus direction until appearance of encoder zero signal (X-axis)
G904 X=100 * #REFDIRROUGH0 I0 P1
G04 P10
'X˶ֱXźʧ
'X-axis moves in plus direction until disappearance of encoder zero signal (X-axis)
G904 X=-60 * #REFDIRROUGH0 I0 P0
G04 P10
'
'Buffer zone on
M802 P196608
G04 P10
'X˶X˾룬ź
'X-axis moves [distance retracted] in plus direction to deviate from signal sensitive area
G905 G903 G91 G00 X=#-39 * #REFDIRROUGH0 * -1 F500
'ͬ
'Synchronization
G906
'ָλ
'Reset Limit
M802 P131073
'ϵͳָʾXػеԭ
'Feedback to system: X-axis back to REF is done
M902 H0
G906
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Yᵥػеԭ㣨ο㣩
'Y-axis back to REF
O102
'ֶλ
'Rough positioning
'λ
'Shield limit signal
M802 P131072
'YḺ˶ֱYźų
'Y-axis moves in minus direction until appearance of switch zero signal(Y-axis)
G904 Y=#BKREFSPEEDROUGH1 * #REFDIRROUGH1 J3 Q1
G04 P10
'Y˶ֱYźų
'Y-axis moves in plus direction until appearance of switch zero signal (Y-axis)
G904 Y=#BKREFSPEEDROUGH1 / 3 * #REFDIRROUGH1 * -1 J3 Q1
G04 P10
'Y˶ֱYźʧ
'Y-axis moves in plus direction until disappearance of switch zero signal (Y-axis)
G904 Y=#BKREFSPEEDROUGH1 / 9 * #REFDIRROUGH1 * -1 J3 Q0
G04 P10
'λ
'Fine positioning
'رջ
'Buffer zone off
M802 P196609
G04 P10
'YḺ˶ֱYźų
'Y-axis moves in minus direction until appearance of encoder zero signal (Y-axis)
G904 Y=100 * #REFDIRROUGH1 J3 Q1
'Y˶ֱYźʧ
'Y-axis moves in plus direction until disappearance of encoder zero signal (Y-axis)
G904 Y=-60 * #REFDIRROUGH1 J3 Q0
G04 P10
'
'Buffer zone on
M802 P196608
G04 P10
'Y˶Y˾룬ź
'Y-axis moves [distance retracted] in plus direction to deviate from signal sensitive area
G905 G903 G91 G00 Y=#-40 * #REFDIRROUGH1 * -1 F500
'ͬ
'Synchronization
G906
'ָλ
'Reset Limit
M802 P131073
'ϵͳָʾYػеԭ
'Feedback to system: Y-axis back to REF is done
M902 H1
G906
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Zᵥػеԭ㣨ο㣩
'Z-axis back to REF
O103
'ֶλ
'Rough positioning
'λ
'Shield limit signal
M802 P131072
'Z˶ֱZźų
'Z-axis moves in plus direction until appearance of switch zero signal (Z-axis)
G904 Z=#BKREFSPEEDROUGH2 * #REFDIRROUGH2 K6 H1
G04 P10
'ZḺ˶ֱZźų
'Z-axis moves in minus direction until appearance of switch zero signal(Z-axis)
G904 Z=#BKREFSPEEDROUGH2 / 3 * #REFDIRROUGH2 * -1 K6 H1
G04 P10
'ZḺ˶ֱZźʧ
'Z-axis moves in minus direction until disappearance of switch zero signal (Z-axis)
G904 Z=#BKREFSPEEDROUGH2 / 9 * #REFDIRROUGH2 * -1 K6 H0
G04 P10
'λ
'Fine positioning
'رջ
'Buffer zone off
M802 P196609
G04 P10
'Z˶ֱZźų
'Z-axis moves in plus direction until appearance of encoder zero signal (Z-axis)
G904 Z=100 * #REFDIRROUGH2 K6 H1
'ZḺ˶ֱZźʧ
'Z-axis moves in minus direction until disappearance of encoder zero signal (Z-axis)
G904 Z=-60 * #REFDIRROUGH2 K6 H0
G04 P10
'
'Buffer zone on
M802 P196608
G04 P10
'ZḺ˶Z˾룬ź
'Z-axis moves [distance retracted] in minus direction to deviate from signal sensitive area
G905 G903 G91 G00 Z=#-41 * #REFDIRROUGH2 F500
'ͬ
'Synchronization
G906
'ָλ
'Reset Limit
M802 P131073
'ϵͳָʾZػеԭ
'Feedback to system: Z-axis back to REF is done
M902 H2
G906
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'XYͬʱػеԭ㣨ο㣩
'X/Y-axis back to REF
O104
'ֶλ
'Rough positioning
'λ
'Shield limit signal
M802 P131072
'X(Y)Ḻ()˶ֱX(Y)źų
'X/Y-axis moves in minus direction until appearance of switch zero signal(X/Y-axis)
G904 X=#BKREFSPEEDROUGH0 * #REFDIRROUGH0 I0 P1 Y=#BKREFSPEEDROUGH1 * #REFDIRROUGH1 J3 Q1
G04 P10
'X(Y)()˶ֱX(Y)źų
'X/Y-axis moves in plus direction until appearance of switch zero signal(X/Y-axis)
G904 X=#BKREFSPEEDROUGH0 / 3 * #REFDIRROUGH0 * -1 I0 P1 Y=#BKREFSPEEDROUGH1 / 3 * #REFDIRROUGH1 * -1 J3 Q1
G04 P10
'X(Y)()˶ֱX(Y)źʧ
'X/Y-axis moves in plus direction until disappearance of switch zero signal(X/Y-axis)
G904 X=#BKREFSPEEDROUGH0 / 9 * #REFDIRROUGH0 * -1 I0 P0 Y=#BKREFSPEEDROUGH1 / 9 * #REFDIRROUGH1 * -1 J3 Q0
G04 P10
'λ
'Fine positioning
'رջ
'Buffer zone off
M802 P196609
G04 P10
'X(Y)Ḻ()˶ֱX(Y)źų
'X/Y-axis moves in minus direction until appearance of encoder zero signal(X/Y-axis)
G904 X=100 * #REFDIRROUGH0 I0 P1 Y=100 * #REFDIRROUGH1 J3 Q1
G04 P10
'X(Y)()˶ֱX(Y)źʧ
'X/Y-axis moves in plus direction until disappearance of encoder zero signal(X/Y-axis)
G904 X=-60 * #REFDIRROUGH0 I0 P0 Y=-60 * #REFDIRROUGH1 J3 Q0
G04 P10
'
'Buffer zone on
M802 P196608
G04 P10
'X(Y)()˶X(Y)˾룬ź
'X/Y-axis moves [distance retracted] in plus direction to deviate from signal sensitive area
G905 G903 G91 G00 X=#-39 * #REFDIRROUGH0 * -1 Y=#-40 * #REFDIRROUGH1 * -1 F500
'ͬ
'Synchronization
G906
'ָλ
'Reset Limit
M802 P131073
'ϵͳָʾXػеԭ
'Feedback to system: X-axis back to REF is done
M902 H0
'ϵͳָʾYػеԭ
'Feedback to system: Y-axis back to REF is done
M902 H1
G906
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'ת(ֻ֧һ)
'spindle CW (only available for one single direction )
O203
G906
if(#SSOUTPORT0)M901 H0 P0; M801 "|D|spindle speed is increasing.."; G04 P=#-3
if(!#SSOUTPORT1)M901 H1 P1; M801 "|D|spindle speed is increasing.."; G04 P=#-3
G906
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'ᷴת(ֻ֧һ)
'spindle CCW (only available for one single direction )
O204
G906
if(#SSOUTPORT1)M901 H1 P0; G04 P=#-3
if(!#SSOUTPORT0)M901 H0 P1; G04 P=#-3
G906
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'ͣת
'Spindle OFF
O205
G906
if(#SSOUTPORT0)M901 H0 P0; M801 "|D|Spindle OFF";G04 P=#-3
if(#SSOUTPORT1)M901 H1 P0;M801 "|D|Spindle OFF"; G04 P=#-3
G906
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'#15 ǰߺ
'#16 Ŀ굶ߺ
'#CHANGETOOL_AHEAD_POS0 ǰõX
'#CHANGETOOL_AHEAD_POS1 ǰõY
'#CALIPOS0 ɺԵX
'#CALIPOS1 ɺԵY
'#CALIPOS2 ɺԵZ
'#CHANGETOOL_XYAXISSPEED ˮƽƶʱٶ
'#CHANGETOOLSPEED ʱƶٶ
'#17 G90(TRUE)/G91(FALSE)ģ̬Ϣ
'#18 ǰλX
'#19 ǰλY
'#20 ǰλZ
'#21 Ŀ굶λX
'#22 Ŀ굶λY
'#23 Ŀ굶λZ
'ɵź˿ڵַ43
'еź˿ڵַ44
'̧ź˿ڵַ45
'رշź˿ڵַ6
'жеź˿ڵַ7
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'#15 current tool number
'#16 target tool number
'#CHANGETOOL_AHEAD_POS0 Tool change ahead position coordinate(X)
'#CHANGETOOL_AHEAD_POS1 Tool change ahead position coordinate(Y)
'#CALIPOS0 Tool measuring coordinate(X) after tool change
'#CALIPOS1 Tool measuring coordinate(Y) after tool change
'#CALIPOS2 Tool measuring coordinate(Z) after tool change
'#CHANGETOOL_XYAXISSPEED Tool change speed of XY axes movement
'#CHANGETOOLSPEED Tool change speed
'#17 G90(TRUE)/G91(FALSE)module information
'#18 coordinate(X) of current tool position
'#19 coordinate(Y) of current tool position
'#20 coordinate(Z) of current tool position
'#21 coordinate(X) of target tool position
'#22 coordinate(Y) of target tool position
'#23 coordinate(Z) of target tool position
'Input port address of unclamping signal: 43
'Input port address of clamping signal: 44
'Input port address of Dust Cover Up arrived detection: 45
'Output port address of Dust Cover Up/Down: 6
'Output port address of Clamp/Unclamp tool: 7
'
'O"CHANGETOOL"
O206
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Զ-ɵӳ
'Automatic Tool Change-subprogram for tool-unclamping detection
o2061
'ȴɵ˿źţɵź˿ںΪ9ȴ5s
'wait for Signal from tool-unclamping input signal, port address 9, wait for 5seconds
G906 H9 P1 L5000
IF(#SYNTIMEOUT<0) M801 "|P|Tool-unclamping signal is not detected"; M30;
G04 P50
M17
'Զ-еӳ
'Automatic tool change-subprogram for tool-clamping detection
o2062
'ȴе˿źţеź˿ںΪ10ȴ5s
'wait for Signal from tool-clamping input port, port address 10, wait for 5seconds
G906 H10 P1 L5000
IF(#SYNTIMEOUT<0) M801 "|P|Tool-clamping signal is not detected"; M30;
G04 P50
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'ȴ
'coolant on
O208
M901 H5 P1
G04 P5
G906
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'ȴ
'coolant off
O209
M901 H5 P0
G04 P5
G906
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
'FANUC̶ѭָϳϵͳʹá
'̶ѭжı弰:
' X--#1----Xֵ
' Y--#2----Yֵ
' Z--#3----ZƽĹ(ȣӦΪֵ)
' R--#4----RƽĹ(RƽתΪֵ)
' Q--#5----ÿһεļӹ(ֵΪֵ)
' P--#6----(λΪms)
' F--#7----ٶȣģֵ̬Ӱָ
' L--#8----ϳ,ԭΪӹظĴ
' I--#9----ʱXƫ
' J--#10---ʱYƫ
' K--#11---ָӹظĴ
' G99/G98--#12---G99->1; G98->0
' G90/G91--#13---G91->1; G90->0
' Z0--#14---Initial point height
'ע⣺ڵ¹̶ѭʱڷʽ(G90)
' ѭָеõӳʹ#1 - #13
'FANUC command for Fixed repetition, only used in milling machine system
'Meanings and order of the variables defined in Fixed repetition.
' X--#1----coordinate(X) of the boring center
' Y--#2----coordinate(Y) of the boring center
' Z--#3----work piece coordinates on plane Z(depth of the hole, minus)
' R--#4----work piece coordinates on plane R (quick feed turn into )
' Q--#5----machining depth each time (incremental and positive)
' P--#6----(unit is ms)
' F--#7----feed speedmodal valueaffecting subsequent commands
' L--#8----aborted, machining repeat times originally
' I--#9----offset on X axis in boring
' J--#10--- offset on Y axis in boring
' K--#11---set repeat times of hole machining
' G99/G98--#12---G99->1; G98->0
' G90/G91--#13---G91->1; G90->0
' Z0--#14---Initial point height
'Note: The following Fixed Repetitions are called under non-incremental mode (G90)
' Subprograms called in cycling commands must not use parameters #1-#13, or errors will arise.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'̶ѭ, G73м
'Fixed repetition, G73, Drilling cycle - high speed peck-drilling (deep hole)
'
'Parameter:
' #50---˵
' #50---tool retracting distance
O673
G65 P873 L=#11
M17
O773
G90 G0 Z=#4-#52*ABS(#5)
#52=#52+1
G90 G1 Z=#4-#52*ABS(#5) F=#7
G91 G0 Z=#50
M17
O873
G90
IF(#13)G91
G0 X=#1 Y=#2
G90 G0 Z=#4
#52=0
G65 P773 L=INT(ABS(#3-#4)/ABS(#5))
G90 G0 Z=#4-#52*ABS(#5)
G90 G1 Z=#3 F=#7
G04 P100
G90 G0 Z=#4
IF(!#12)G90 G0 Z=#14
IF(#13)G91
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'̶ѭ, G76,
'Fixed repetition, G76, Boring cycle - presicion
O676
G90
IF(#13)G91
G0 X=#1 Y=#2
G91
G0 Z=#4
G1 Z=#3 F=#7
G4 P=#6
G1 X=#9 Y=#10
G4 P=#6
G0 Z=#4
G90
IF(!#12)G90 G0 Z=#14
IF(#13)G91
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'̶ѭ, G81һ
'Fixed repetition, G81, drilling cycle
O681
G90
IF(#13)G91
G0 X=#1 Y=#2
G90 G0 Z=#4
G1 Z=#3 F=#7
G04 P100
G0 Z=#4
G90
IF(!#12)G90 G0 Z=#14
IF(#13)G91
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'̶ѭ, G82
'Fixed repetition, G82, Drilling cycle - spot-drilling (with Dwell)
' ѭG81ͬΨһڣ
' Its generally the same with G81, and the only difference is:
' G82ڿͣʱP__
' G82 allows the preset of lingering time P at the hole-bottom
O682
IF(#13)G91
G0 X=#1 Y=#2
G90 G0 Z=#4
G1 Z=#3 F=#7
G4 P=#6 F=#7
G0 Z=#4
G90
IF(!#12)G90 G0 Z=#14
IF(#13)G91
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'̶ѭ, G83
'Fixed repetition, G83, Drilling cycle - peck-drilling (deep hole)
O683
G90
IF(#13)G91
G0 X=#1 Y=#2
G90 G0 Z=#4
#52=0
G65 P783 L=INT(ABS(#3-#4)/ABS(#5))
G90 G0 Z=#4-#52*ABS(#5)
G90 G1 Z=#3 F=#7
G04 P100
G90 G0 Z=#4
IF(!#12)G90 G0 Z=#14
IF(#13)G91
M17
O783
G90 G0 Z=#4-#52*ABS(#5)
#52=#52+1
G90 G1 Z=#4-#52*ABS(#5) F=#7
G90 G0 Z=#4
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'̶ѭ, G85ۿ
'Fixed repetition, G85, boring cycle
' ѭG81ͬΨһڣ
' Its generally the same with G81, and the only difference is:
' G85ᵶʱüӹʱĽٶȣG81ÿٶλʱĽٶȡ
' When retracting tool, G85 adopts the feed speed of machining while G81 adopts the feed speed in rapid positioning
O685
G90
IF(#13)G91
G0 X=#1 Y=#2
G91
G0 Z=#4
G1 Z=#3 F=#7
G1 Z=#4
G65 P785 L=#11-1
G90
IF(!#12)G90 G0 Z=#14
IF(#13)G91
M17
O785
G0 X=#1 Y=#2
G1 Z=#3 F=#7
G1 Z=#4
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'̶ѭ, G86ۿ
'Fixed repetition, G86, Boring cycle - spindle stop at the depth
O686
G90
IF(#13) G91
G0 X=#1 Y=#2
G91
G0 Z=#4
G1 Z=#3 F=#7
M5
G0 Z=#4
M3
G65 P786 L=#11-1
G90
IF(#13) G91
M17
O786
G0 X=#1 Y=#2
G1 Z=#3 F=#7
M5
G0 Z=#4
M3
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'̶ѭ, G89,ۿ,(G82IJֻᵶʱG89Ϊ)
'Fixed repetition, G89, Boring cycle - dwell at the depth
'ע: ַʽӹ,ӹĿС,ֵܳѾλһ
' ļӹλöδ涨ת,Ϊ˿ڸ֮ͣG04.
'NoteIn such machining mode, given gaps between neighboring holes are too narrow in continuously machining,
'tool may be positioned to the next hole while spindle is still under set speed.
'To this end, command G04 for pause is added.
O689
G90
IF(#13) G91
G0 X=#1 Y=#2
G91
G0 Z=#4
G1 Z=#3 F=#7
G4 P=#6
G1 Z=#4
G65 P789 L=#11-1
G90
IF(#13) G91
M17
O789
G0 X=#1 Y=#2
G1 Z=#3 F=#7
G4 P=#6
G1 Z=#4
M17
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@