Question regarding event triggering an Interrupt

  • Hello there,


    I'm using a KRC4 with KSS 8.3.21, to control a KR500 in ext_auto via a Siemens PLC.


    What I want to do is to trigger a global interrupt when receiving a command from the PLC AND from the robot.
    - The PLC command is sent via profinet
    - The robot command is set/reset inside robot subprograms , which are called by CELL.src
    - The global interrupt is declared and activated in CELL.src


    So, the interrupt declaration looks like that:


    INTERRUPT DECL 6 WHEN (cmdFromPLC == TRUE) AND (cmdFromRobot == TRUE) DO ABORT_INTERRUPT() ;
    INTERRUPT ON 6


    But the behaviour of the interrupt doesn't seem to behave as expected: I was hoping it would trigger, and call ABORT_INTERRUPT() if one of the 2 command is TRUE, and there is a rising edge on the second one.



    All of this to ask: how does the interrupt trigger behave when the event is a simple logic operation ? Does it need to have a rising edge on both signals, ...


    Thank you in advance !

  • [size=2]interrupt condition MUST be simple expression (cannot use compound expression with logix operators as you are trying to do).[/size]


    [size=2]that is where cyclical flags come in handy:[/size]


    Code
    $CYCFLAG[1] = (cmdFromPLC == TRUE) AND (cmdFromRobot == TRUE)
    
    
    INTERRUPT DECL 6 WHEN $CYCFLAG[1] DO ABORT_INTERRUPT() ;
    INTERRUPT ON 6
    ; do something...
    INTERRUPT OFF 6

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • Thank you panic mode, I tought it was possible, since it is written in Kuka KSS 83 SI (14/05/2015) documentation, page 417


    But cyclical flags should do the trick, do you have an idea about the frequency of the cyclical evaluation? I did try something similar but using the SPS instead, and the SPS is just too slow.


    To be more precise, the idea is to trigger an interrupt when the robot finishes a motion (PTP or LIN), using "trigger when distance = 0 DO", without stopping the advance run.
    But I just realised I will have to stop the advance run anyway, otherwise, the robot will still have to decelerate after the interrupt is triggered, which I don't want...

  • Hm... yes, that is in the manual. Never noticed that. I wonder if that's a misprint, or a change for KSS 8.x?


    Classically, KRL did not allow any Boolean logic beyond single comparisons in the INTERRUPT DECL statement. That's one of the reasons that Cyclic Flags exist. I don't have a KRC4 handy to try out the AND/OR/etc on right now....


    Aside from that, your basic understanding of the Interrupt was correct, however -- the Interrupt only triggers on a change of the logical condition. One "gotcha" here is that, if the condition is already true when you execute the INTERRUPT ON, the Interrupt will not trigger until after the condition becomes false, then true again. So, whether putting the AND logic into the DECL is allowed, or you have to use a Cyclic Flag, the Interrupt will trigger as soon as the "output" of the AND transitions from False to True.


    As to whether the robot will have to decelerate, that depends entirely on what you're doing inside your Interrupt Routine.

  • Thank you skyeFire, I come back with another issue I have regarding the interrupt-advance run behaviour (yes, again...)


    I have been playing with our kuka simulator (KRC4), and have found something quite strange:


    When I run the code below with advance run to 1, everything is working as expected, the interrupt is triggered after its condition is switched to TRUE (after the interrupt is set to ON)





    BUT, when setting the advance run to 2, the interrupt is not triggered ! It looks like the advance run is setting the interrupt condidtion to TRUE before that the Interrupt is properly activated, even if it is activated two motions before...



    Any idea why?

  • My bad, I saw that INTERRUPT ON is activated by the main run and not the advance run as I thought, it explains everything

Advertising from our partners