Detailed description
2.11 Subroutine call through NC language replacement
Basic logic functions: Mode group, channel, program operation, reset response (K1)
196 Function Manual, 11/2006, 6FC5397-0BP10-2BA0
Example of replacement subroutine for spindle positioning
Using the system variables $P_SUB_LA and $P_SUB_CA
N1000 PROC LANG_SUB DISPLOF SBLOF
N1010 DEF AXIS _LA
;
Auxiliary memory for leading axis / leading spindle
N1020 DEF AXIS _CA
;
Auxiliary memory for following axis / following
spindle
N1030 DEF INT _LSPI
;
Auxiliary memory for leading spindle no.. (progr.
spindle)
N1040 DEF INT _CSPI
;
Auxiliary memory for following spindle number
...
N2100 IF($P_SUB_AXFCT==2)
N2110
;Replacement due to SPOS/SPOSA/M19 command during active synchronous spindle
coupling
N2120
_LA=$P_SUB_LA ;
Save axis identifier of the leading spindle
temporarily
N2130
_CA=$P_SUB_CA ;
Save axis identifier of the following spindle
temporarily
N2140
_LSPI=AXTOSPI(_LA) ;
Save the number of the leading spindle
temporarily
N2180
_CSPI=AXTOSPI(_LA) ;
Save the number of the following spindle
temporarily
N2185
DELAYFSTON ;
Start Stop Delay Area
N2190
COUPOF(_CA,_LA) ;
Deactivate synchronous spindle coupling
N2200
;Position leading and following spindle:
N2210
IF($P_SUB_SPOS==TRUE) OR ($P_SUB_SPOSA==TRUE)
N2220
;Position spindle with SPOS
N2230
CASE $P_SUB_SPOSMODE OF 0 GOTO LABEL_DC\
1 GOTO LABEL_IC 2 GOTO LABEL_AC 3 GOTO LABEL_DC\
4 GOTO LABEL_ACP 5 GOTO LABEL_ACN\
DEFAULT GOTOF LABEL_ERR
LABEL_DC:
SPOS[_LSPI]=DC($P_SUB_SPOSIT) SPOS[_CSPI]=DC($P_SUB_SPOSIT)
GOTOF LABEL_CONT
LABEL_IC:
DELAYFSTOF
SPOS[_LSPI]=IC($P_SUB_SPOSIT) SPOS[_CSPI]=IC($P_SUB_SPOSIT)
DELAYFSTON
GOTOF LABEL_CONT
LABEL_AC:
SPOS[_LSPI]=AC($P_SUB_SPOSIT) SPOS[_CSPI]=AC($P_SUB_SPOSIT)
GOTOF LABEL_CONT
LABEL_ACP:
SPOS[_LSPI]=ACP($P_SUB_SPOSIT)
SPOS[_CSPI]=ACP($P_SUB_SPOSIT)
GOTOF LABEL_CONT
LABEL_ACN:
SPOS[_LSPI]=ACN($P_SUB_SPOSIT)
SPOS[_CSPI]=ACN($P_SUB_SPOSIT)
LABEL_CONT:
N2250
ELSE
N2260
;Position spindle with M19
N2270
M[_LSPI]=19 M[_CSPI]=19 ;
Position leading and following spindle
N2280
ENDIF
N2285
DELAYFSTOF ;
End of Stop Delay Area
N2290
COUPON(_CA,_LA) ;
Activate synchronous spindle coupling