Interrupt Example

  • There have been a lot of redundant questions about Interrupt handling lately, so I decided to make a heavily-commented example file that should (Hopefully!) point people with the same questions to as a starting point.


    I don't have a KRC handy to test this on, though, so I can't guarantee I haven't missed something subtle here.


  • no, that should stay....


    the issue with 136 is that it would only be processed IF the interrupt is triggered... but if there was no trigger, interrupt would remain active even after program returns to line 42. and that is bad.... if for whatever reason that input get triggered after that line, bad things could happen. this is why programming interrupts requires good housekeeping:


    declare interrupt

    activate it

    use it

    deactivate it !!!


    this last part should be done unconditionally... regardless if it was triggered or not.

    the way example is structured, this would only happen IF interrupt was triggered and ISR was visited. this is something to be avoided, specially when RESUME was used.

    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

  • Hold on... Line 136 should only ever execute if the Interrupt doesn't trigger. If the Interrupt does trigger, the RESUME command at line 160 should jump the program pointer straight back to line 42, because everything in the stack below the level where the interrupt was DECL'd gets cancelled.


    Line 136 is my "cleanup" in the event that the Interrupt doesn't fire.

  • i am trying to change bad habit of skimming through volume of text and picking out details, specially when responding... :winking_face:


    btw. kudos for effort on such detailed example.

    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

  • There have been a lot of redundant questions about Interrupt handling lately, so I decided to make a heavily-commented example file that should (Hopefully!) point people with the same questions to as a starting point.


    I don't have a KRC handy to test this on, though, so I can't guarantee I haven't missed something subtle here.


    Code
    &ACCESS RVO1
    &COMMENT 
    DEF InterruptExample ( )
    .....

    Thank you for this work!

  • both accomplish the same thing - trigger single advance run stop. it comes to personal preference. some may feel that one is more descriptive than another.

    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

  • There have been a lot of redundant questions about Interrupt handling lately, so I decided to make a heavily-commented example file that should (Hopefully!) point people with the same questions to as a starting point.


    I don't have a KRC handy to test this on, though, so I can't guarantee I haven't missed something subtle here.


    Code

    SkyeFire to the rescue yet again with another awesome post :smiling_face: One day I will get my KUKA programming course, interrupt is probably in course two.
    Thank you all again i'm just lurking around here and trying to learn from all of you. Keep it up!

  • Hi panic mode and SkyeFire. First of all, thanks for your effort in trying to make KUKA ISR to a pretty easy topic...

    Well... I have spend almost the whole day on looking in the forum, and I am struggling with the error "Instruction $ADVANCE in interrupt inadmissible (Module: BAS Line: 154):

    So how it looks in the real world is like this:

    - The red cirlce indicates a sensor on the robots tool.
    - The blue circle indicates a mock-up with a tri-pod with cardboard sticking out, that is used as trigger for the ISR.

    I.e. when the robot starts its search towards the object, which is the mock-up in this example, I would like the robot to stop the movement and drive to home position.

    The things that is happening now is that, when the robot starts its seach path and gets to the triggering point, the interrupt is fired, but I get the prompt error of: Error KSSo1425 - Instruction $ADVANCE in interrupt inadmissible

    For quick overview, I have three positions:

    1) xstack1home. That is a position nearby.
    2) xstack1prep. That is the position, which the robot is in, in the attached left side picture.
    3) xstackCalib. That is the end search position, where the interrupt will happen between the xstack1prep and xstackCalib.


    As a last notice, I was not able to stop the interrupt at the tri-pod cardboard triggering point, unless I in the interrupt decl was using "WITH BRAKE". So if I remove this, the result is that the robot will move from start search position, i.e. xstack1prep to end search position, i.e. xstackCalib (and collide with the mockup) and then throw the error of $ADVANCE.

    Lastly, I am pretty sure that this is all about having in control where the advance run pointer is located. I have seen different attempts to "tame the lion/ARP", but I have tried WAIT FOR TRUE, WAIT 0.1, WAIT 0, $ADVANCE = 0, etc.

    Please notice, that I am using the $OUT[15-20] as pure debugging. Just for me to know if everything has carried out well.

    So I would really appreciate, if there is some clue out there. For reference, the systems information are:

    • Robot: KUKA KR50 R2100
    • Controller: KR C5 dualcabinet
    • KSS 8.7.2 HF3
    • HMI version: 8.7 B394
    • Kernel system version: KS V8.7.53394
    • WorkVisual V6.0.18_Build0748

      The code is below for the three modules, i.e.
      - TestISR.src --> Main program
      - SeachForStacks --> Submodule with starts the seach motion and awaits that the interrupt is fired.
      - ISR_StackIsFound --> The interrupt service rutine, ISR.


    So please, let me know if you need any further information. I would strongly apprecirate your support. Thanks in advance :smiling_face:

    My current system contains the following information:

    • Robot: KUKA KR50 R2100
    • Controller: KR C5 dualcabinet
    • KSS 8.7.2 HF3
    • HMI version: 8.7 B394
    • Kernel system version: KS V8.7.53394
    • WorkVisual V6.0.24_Build1632
  • ISR_StackIsFound() is an ISR and as such it cannot have INI and inline form motions.


    In fact INI and BCO are only needed once - when program is starting. Doing this later on is undesirable in most cases.

    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

  • ISR_StackIsFound() is an ISR and as such it cannot have INI and inline form motions.


    In fact INI and BCO are only needed once - when program is starting. Doing this later on is undesirable in most cases.

    So you are saying, that is should just be like this?

    Code: ISR_StackIsFound
    &ACCESS RV1
    DEF  ISR_StackIsFound()
    INTERRUPT OFF 21
    BRAKE
    RESUME
    END

    My current system contains the following information:

    • Robot: KUKA KR50 R2100
    • Controller: KR C5 dualcabinet
    • KSS 8.7.2 HF3
    • HMI version: 8.7 B394
    • Kernel system version: KS V8.7.53394
    • WorkVisual V6.0.24_Build1632
  • panic mode You are the BEST!!!! I removed it like above, and now the ISR is WORKING!!!!

    So I gave you a :red_heart: like, but I hope the next people do not make the same mistake by using "Modules" generation instead of "Functions".

    My current system contains the following information:

    • Robot: KUKA KR50 R2100
    • Controller: KR C5 dualcabinet
    • KSS 8.7.2 HF3
    • HMI version: 8.7 B394
    • Kernel system version: KS V8.7.53394
    • WorkVisual V6.0.24_Build1632
  • well it should have been the Expert module (if this is external) but KRL is forgiving and all of the templates are just text files that can be easily converted to other types.

    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

Advertising from our partners