大家好,
之前我发了一个《840DSL 主轴功能 技术咨询》的帖子,得到了很多大师的指点。
之后我也在类似的设备上取得了NC程序的备份(老外写的)。我查看了一下关于设置主轴激活的一些程序段。
但有一些没看懂,所以我把相关程序贴上来,还请各位大师帮我看看,他的原理是什么?谢谢了!
========================================================================================
/_N_CYCPE_US_SPF CYCPE_US.SPF 73773 7 060418 1643 1467721679 5058 * /_N_CMA_DIR/ CMA.DIR\ Proc CYCPE_US SAVE SBLOF DISPLOF
;
; // SAVE - returns control to original modal states after subroutine
; // SBLOF - inhibits single block in the subroutine
; // DISPLOF - inhibits display of subroutine
;
DEF REAL PREV_SWORD1,PREV_SWORD2,PREV_SWORD3
DEF INT PREV_SDIR1,PREV_SDIR2,PREV_SDIR3
DEF BOOL NO_ACTIVE = 0
;
;
PREV_SWORD1 = $P_SEARCH_S[1]
PREV_SDIR1 = $P_SEARCH_SDIR[1]
PREV_SWORD2 = $P_SEARCH_S[2]
PREV_SDIR2 = $P_SEARCH_SDIR[2]
PREV_SWORD3 = $P_SEARCH_S[3]
PREV_SDIR3 = $P_SEARCH_SDIR[3]
;
SP1_ACT = $A_DBB[0] B_AND 'B10'
SP2_ACT = $A_DBB[0] B_AND 'B100'
SP3_ACT = $A_DBB[0] B_AND 'B1000'
;
;
IF (SP1_ACT == 2)
; S1 Master if Active
S=PREV_SWORD1
M=PREV_SDIR1
ELSE
IF (SP2_ACT == 4)
; S2 Master if Active
S=PREV_SWORD2
M=PREV_SDIR2
ELSE
IF (SP3_ACT == 8)
; S3 Master if Active
S=PREV_SWORD3
M=PREV_SDIR3
ELSE
NO_ACTIVE=1
ENDIF
ENDIF
ENDIF
IF (SP1_ACT == 2) AND (SP2_ACT == 4)
; If S1 not Active S2 becomes Master if Active
S2=PREV_SWORD1
M2=PREV_SDIR1
ENDIF
IF (SP3_ACT == 8) AND (SP1_ACT == 2)
; If S1 and S2 not Active S3 becomes Master if Active
S3=PREV_SWORD1
M3=PREV_SDIR1
ELSE
IF (SP3_ACT == 8) AND (SP2_ACT == 4)
; If S1 and S2 not Active S3 becomes Master if Active
S3=PREV_SWORD2
M3=PREV_SDIR2
ENDIF
ENDIF
IF (NO_ACTIVE)
IF ((PREV_SDIR1 + PREV_SDIR2 + PREV_SDIR3) < 0)
SETAL(66500)
ENDIF
ENDIF
M17
======================================================================================
/_N_SPINDLES_SPF SPINDLES.SPF 73773 7 060418 1457 1467721680 5003 * /_N_CMA_DIR/ CMA.DIR\ Proc Spindles SAVE SBLOF DISPLOF
;
; // SAVE - returns control to original modal states after subroutine
; // SBLOF - inhibits single block in the subroutine
; // DISPLOF - inhibits display of subroutine
;
DEF REAL PREV_SWORD1
DEF REAL PREV_SWORD2
DEF INT PREV_SDIR1
DEF INT PREV_SDIR2
PREV_SWORD1 = $P_S[1]
PREV_SDIR1 = $P_SDIR[1]
PREV_SWORD2 = $P_S[2]
PREV_SDIR2 = $P_SDIR[2]
SET_ACT = $A_DBB[0] B_AND 'B01'
SP1_ACT = $A_DBB[0] B_AND 'B10'
SP2_ACT = $A_DBB[0] B_AND 'B100'
SP3_ACT = $A_DBB[0] B_AND 'B1000'
;
;
Disable(5)
; Set First Active Spindle as Master
;
IF (SET_ACT == 1)
IF (SP1_ACT == 2)
SETMS(1)
ELSE
IF (SP2_ACT == 4)
SETMS(2)
ELSE
IF (SP3_ACT == 8)
SETMS(3)
ELSE
SETMS(1)
ENDIF
ENDIF
ENDIF
ELSE
IF (SP1_ACT == 2) AND (SP2_ACT == 4)
; If S1 not Active S2 becomes Master if Active
S2=PREV_SWORD1
M2=PREV_SDIR1
ENDIF
IF (SP3_ACT == 8) AND (SP1_ACT == 2)
; If S1 and S2 not Active S3 becomes Master if Active
S3=PREV_SWORD1
M3=PREV_SDIR1
ELSE
IF (SP3_ACT == 8) AND (SP2_ACT == 4)
; If S1 and S2 not Active S3 becomes Master if Active
S3=PREV_SWORD2
M3=PREV_SDIR2
ENDIF
ENDIF
ENDIF
SET_ACT=0
Enable(5)
REPOSA
M17
=======================================================================================
CYCPE_US.SPF 在prog_event中会执行