Hi every one,
I want to run spindle after stop.I write the interrupt for this process.But there is some faulty.For example the robot moves the first movement line and then run the interrupt.
Declare interrupt
Code
DEF Sample ( )
;FOLD INI
;FOLD BASISTECH INI
GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( )
GLOBAL INTERRUPT DECL 10 WHEN bSetInterrupt DO SpindleSetAfterStop ( )
INTERRUPT ON 3
INTERRUPT ON 10
BAS (#INITMOV,0 )
;ENDFOLD (BASISTECH INI)
;FOLD USER INI
;Make your modifications here
;ENDFOLD (USER INI)
;ENDFOLD (INI)
WAIT FOR NOT bSetInterrupt
SpindleSet(1, 550) ;StartSpindle
LOOP
PTP $POS_ACT
;FOLD SPTP P1 Vel=10 % PDAT1 Tool[1]:kisa1 Base[0] ;%{PE}
;FOLD Parameters ;%{h}
;Params IlfProvider=kukaroboter.basistech.inlineforms.movement.spline; Kuka.IsGlobalPoint=False; Kuka.PointName=P1; Kuka.BlendingEnabled=False; Kuka.MoveDataPtpName=PDAT1; Kuka.VelocityPtp=10; Kuka.VelocityFieldEnabled=True; Kuka.ColDetectFieldEnabled=True; Kuka.CurrentCDSetIndex=0; Kuka.MovementParameterFieldEnabled=True; IlfCommand=SPTP
;ENDFOLD
SPTP XP1 WITH $VEL_AXIS[1] = SVEL_JOINT(10.0), $TOOL = STOOL2(FP1), $BASE = SBASE(FP1.BASE_NO), $IPO_MODE = SIPO_MODE(FP1.IPO_FRAME), $LOAD = SLOAD(FP1.TOOL_NO), $ACC_AXIS[1] = SACC_JOINT(PPDAT1), $APO = SAPO_PTP(PPDAT1), $GEAR_JERK[1] = SGEAR_JERK(PPDAT1), $COLLMON_TOL_PRO[1] = USE_CM_PRO_VALUES(0)
;ENDFOLD
;FOLD SPTP P2 Vel=10 % PDAT2 Tool[1]:kisa1 Base[0] ;%{PE}
;FOLD Parameters ;%{h}
;Params IlfProvider=kukaroboter.basistech.inlineforms.movement.spline; Kuka.IsGlobalPoint=False; Kuka.PointName=P2; Kuka.BlendingEnabled=False; Kuka.MoveDataPtpName=PDAT2; Kuka.VelocityPtp=10; Kuka.VelocityFieldEnabled=True; Kuka.ColDetectFieldEnabled=True; Kuka.CurrentCDSetIndex=0; Kuka.MovementParameterFieldEnabled=True; IlfCommand=SPTP
;ENDFOLD
SPTP XP2 WITH $VEL_AXIS[1] = SVEL_JOINT(10.0), $TOOL = STOOL2(FP2), $BASE = SBASE(FP2.BASE_NO), $IPO_MODE = SIPO_MODE(FP2.IPO_FRAME), $LOAD = SLOAD(FP2.TOOL_NO), $ACC_AXIS[1] = SACC_JOINT(PPDAT2), $APO = SAPO_PTP(PPDAT2), $GEAR_JERK[1] = SGEAR_JERK(PPDAT2), $COLLMON_TOL_PRO[1] = USE_CM_PRO_VALUES(0)
;ENDFOLD
ENDLOOP
SpindleSet(0) ;StopSpindle
END
Display More
Sub program :
Code
DEF SpindleSetAfterStop ( )
INTERRUPT OFF 10
bStopFlag=TRUE
BRAKE
AE:
SWITCH iMemoryRotation
CASE 1 ;Forward start
;---------------------------------------------
REPEAT
ANOUT_InvFrequency=rMemoryFrequency
OUT_BackwardStart=FALSE
OUT_ForwardStart=TRUE
WAIT SEC 0.3
iMemoryRotation=1
UNTIL(IN_InvRunning AND IN_FreqDetection)
CASE -1 ;Backward start
;---------------------------------------------
REPEAT
ANOUT_InvFrequency=rMemoryFrequency
OUT_ForwardStart=FALSE
OUT_BackwardStart=TRUE
WAIT SEC 0.3
iMemoryRotation=-1
UNTIL (IN_InvRunning AND IN_FreqDetection)
DEFAULT
halt
ENDSWITCH
bStopSpindle=FALSE
bSetInterrupt=FALSE
INTERRUPT ON 10
bStopFlag=FALSE
END
Display More
TRIGGED THE INTERRUPT IN SPS
Code
IF $PRO_STATE1==#P_FREE THEN
rMemoryFrequency=0.0
iMemoryRotation=0
bMemorySetSpindle=FALSE
bStopSpindle=FALSE
bSetInterrupt=FALSE
bStopFlag=FALSE
ENDIF
;EXTERNAL ERROR STOPPING SPINDLE AND PROGRAM
IF NOT IN_InvNoAlarm OR NOT IN_SafetyOK OR NOT IN_ThermalOK OR NOT IN_PressureSensor OR (NOT IN_ToolLocked AND (OUT_ForwardStart OR OUT_BackwardStart)) OR (bAtToolChange AND (OUT_ForwardStart OR OUT_BackwardStart)) THEN
IF bMemorySetSpindle THEN
bStopSpindle=TRUE
ENDIF
OUT_ForwardStart=FALSE
OUT_BackwardStart=FALSE
ANOUT_InvFrequency=0.0
IF $PRO_STATE1<>#P_FREE THEN
;$OV_PRO=0
bRobStop=TRUE
bRobStop=ROB_STOP(#RAMP_DOWN)
ELSE
bRobStop=FALSE
ROB_STOP_RELEASE()
ENDIF
ELSE
bRobStop=FALSE
ROB_STOP_RELEASE()
ENDIF
IF ($PRO_STATE1==#P_ACTIVE) AND bStopSpindle AND NOT bStopFlag THEN
bSetInterrupt=TRUE
ENDIF
Display More