Hello,
i have an issue with my programs: if i call an interrupt during execution of another interrupt program, after coming back to first interrupt pointer moves one line. I checked it on KSS V8.3.28 and KSSV8.6.5 and it behaves the same. I have a structure:
main_program:
sub_program in loop
interrupt to call loading trajectory "StopAndGoToMagazine"
interrupt to stop the robot with PLC HMI stop button "halt_robot"
Robot runs main_program and then subprogram, at any point an interrupt can open trajectory "StopAndGoToMagazine", meanwhile operator can also press button to stop the robot and interrupt "halt_robot" can be called. When conditions are met and start is send, robot leaves interrupt "halt_robot" but it goes to NEXT line of "StopAndGoToMagazine"
DEF mainProgram( )
;FOLD INIT
DECL CHAR DMY[3]
DMY[]="---"
;ENDFOLD (INIT)
;FOLD BASISTECH INI
init_user=FALSE
FileInit()
;ENDFOLD (BASISTECH INI)
LOOP
Interr_StopRob_ON()
subprogram()
ENDLOOP
END
Display More
Subprogram:
DEF subprogram( )
;FOLD INI;%{PE}
;FOLD BASISTECH INI
FileInit()
;ENDFOLD (BASISTECH INI)
;FOLD USER INI
;Make your modifications here
wait for ($cycflag[NrInterruptLoadMag]==FALSE)
INTERRUPT DECL NrInterruptLoadMag WHEN $cycflag[NrInterruptLoadMag]==TRUE DO StopAndGoToMagazine()
INTERRUPT ON NrInterruptLoadMag
;ENDFOLD (USER INI)
;ENDFOLD (INI)
WAIT sec 1
;FOLD PTP P1 Vel=100 % PDAT1 Tool[1]:szpikulec1 Base[0];%{PE}%R 8.3.42,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:P1, 3:, 5:100, 7:PDAT1
$BWDSTART=FALSE
PDAT_ACT=PPDAT1
FDAT_ACT=FP1
BAS(#PTP_PARAMS,100)
PTP XP1
;ENDFOLD
;FOLD PTP P2 Vel=100 % PDAT2 Tool[1]:szpikulec1 Base[0];%{PE}%R 8.3.42,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:P2, 3:, 5:100, 7:PDAT2
$BWDSTART=FALSE
PDAT_ACT=PPDAT2
FDAT_ACT=FP2
BAS(#PTP_PARAMS,100)
PTP XP2
;ENDFOLD
;FOLD PTP P3 Vel=100 % PDAT3 Tool[1]:szpikulec1 Base[0];%{PE}%R 8.3.42,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:P3, 3:, 5:100, 7:PDAT3
$BWDSTART=FALSE
PDAT_ACT=PPDAT3
FDAT_ACT=FP3
BAS(#PTP_PARAMS,100)
PTP XP3
;ENDFOLD
END
Display More
interrupt with movements :
DEF StopAndGoToMagazine( )
INTERRUPT OFF NrInterruptLoadMag
PTP {A6 -230}
PTP {A6 -200}
PTP {A5 -55}
;loading magazine
PTP {A6 -200}
PTP {A6 -230}
wait for ($cycflag[NrInterruptLoadMag]==FALSE)
INTERRUPT ON NrInterruptLoadMag
wait sec 0.2
END
Display More
interrupt to stop robot:
global DEF halt_robot()
INTERRUPT OFF NrInterrruptStopRob
BRAKE
HALT
WAIT FOR (SignalToStopRob)
WAIT SEC 0.1
INTERRUPT ON NrInterrruptStopRob
end
and additional definitions:
GLOBAL DEF FileInit()
CONTINUE
IF ( not init_user) THEN
;FOLD BASISTECH INI
GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( )
INTERRUPT ON 3
BAS (#INITMOV,0 )
;ENDFOLD (BASISTECH INI)
;FOLD USER INI
Init_interrupt()
;ENDFOLD (USER INI)
init_user=TRUE
UstawPredkosc(v_ostatnia)
ptp $POS_ACT
ENDIF
END
GLOBAL DEF Init_interrupt()
InitStopRob_defined = FALSE
END
GLOBAL DEF Interr_StopRob_ON()
IF (InitStopRob_defined==FALSE) THEN
GLOBAL INTERRUPT DECL NrInterrruptStopRob WHEN $cycflag[NrInterrruptStopRob]==FALSE DO halt_robot()
InitStopRob_defined = TRUE
ENDIF
wait for ($cycflag[NrInterrruptStopRob]==true)
INTERRUPT ON NrInterrruptStopRob
END
GLOBAL DEF Interr_StopRob_OFF()
IF (InitStopRob_defined==TRUE) THEN
INTERRUPT OFF NrInterrruptStopRob
ENDIF
END
Display More
Sounds maybe complicated but all is about calling an interrupt during execution of another interrupt. Why coming back from second interrupt to fist one, that was called, makes current line to be change into next one?