1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Forum
  3. Industrial Robot Support and Discussion Center
  4. KUKA Robot Forum
Your browser does not support videos RoboDK Software for simulation and programming
Visit our Mainsponsor
IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Sponsored Ads

INTERRUPT PROGRAM

  • robot-cnc
  • January 30, 2023 at 1:37 PM
  • Thread is Unresolved
  • robot-cnc
    Reactions Received
    11
    Trophies
    4
    Posts
    432
    • January 30, 2023 at 1:37 PM
    • #1

    Hi,

    Can you check if my INTERRUPT 10 is well declared in main program also if subroutine is ok?

    Thank you.


    DEF NONAME1()

    GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( )

    INTERRUPT ON 3

    INTERRUPT DECL 10 WHEN $IN[6]==TRUE DO STOP_MOVE()

    INTERRUPT ON 10

    $APO.CDIS = 0.5000

    BAS (#INITMOV,0)

    BAS (#VEL_PTP,20)

    BAS (#ACC_PTP,20)

    $BASE=BASE_DATA[1]

    ;$BASE={X 2000, Y 0, Z 1200, A 90, B 0, C 0}

    $TOOL=TOOL_DATA[1]

    ;$TOOL={X 503.173, Y 1.337, Z 101.069, A 0, B 90, C 0}

    $OUT[1]=TRUE

    $OUT[3]=TRUE

    $advance=3

    $VEL.CP=0.167

    PTP {A1 0.000, A2 -90.000, A3 90.000, A4 0.000, A5 0.000, A6 0.000, E1 0, E2 0, E3 0, E4 0, E5 0, E6 0}

    PTP {A1 3.745, A2 -90.330, A3 101.473, A4 -113.300, A5 26.474, A6 115.693, E1 0, E2 0, E3 0, E4 0, E5 0, E6 0}

    LIN {X 0, Y 0, Z 10, A 110.424, B 0, C 180} C_DIS

    LIN {X 0, Y 0, Z 0, A 110.424, B 0, C 180} C_DIS

    LIN {X 731, Y 0, Z 0, A 130.502, B 0, C 180} C_DIS

    LIN {X 731, Y 243, Z 0, A 133.014, B 0, C 180} C_DIS

    LIN {X 0, Y 243, Z 0, A 110.424, B 0, C 180} C_DIS

    LIN {X 0, Y 0, Z 0, A 110.424, B 0, C 180} C_DIS

    LIN {X 0, Y 0, Z 10, A 110.424, B 0, C 180} C_DIS

    PTP {A1 0.000, A2 -90.000, A3 90.000, A4 0.000, A5 0.000, A6 0.000, E1 0, E2 0, E3 0, E4 0, E5 0, E6 0}

    $OUT[1]=FALSE

    $OUT[3]=FALSE

    INTERRUPT OFF 10

    END

    DEF STOP_MOVE()

    BRAKE

    WAIT FOR $IN[6]==FALSE

    WAIT SEC 0.2

    RESUME

    END

  • Go to Best Answer
  • panic mode
    Reactions Received
    1,280
    Trophies
    11
    Posts
    13,083
    • January 30, 2023 at 2:52 PM
    • #2

    individually interrupt declaration, ISR STOP_MOVE() and programmed motions are ok but they do not fit together. they need to form a functional structure and that is not the case. also it is not clear what the objective it.

    if you want to use it to pause and then continue program, remove RESUME command.

    if you want to use it to stop motion (and cancel it), you need RESUME but motions need to be moved into own subprogram with something to stop arp from leaving that subprogram early..

    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

  • Online
    SkyeFire
    Reactions Received
    1,052
    Trophies
    12
    Posts
    9,427
    • January 30, 2023 at 3:00 PM
    • #3

    What are you trying to accomplish? The way you have set up the STOP_MOVE subroutine, it seems like you only want to pause the motion. But the RESUME command (which is very badly named) will terminate the motion that was in progress when the Interrupt fired, and try jumping to the next motion command. And with Approximated motions, this can get... interesting.

    Also, any Interrupt subroutine should start with an INTERRUPT OFF for the Interrupt that calls it. You can also add an INTERRUPT ON at the end if you want to keep monitoring the Interrupt, but you don't want the Interrupt to be re-triggered while the robot is at that WAIT SEC 0.2, for example.

  • robot-cnc
    Reactions Received
    11
    Trophies
    4
    Posts
    432
    • January 30, 2023 at 4:17 PM
    • #4

    the scope is untill spindle reach up working frequency, my IN[6] is true, when reach target frequency, for ex. 50 hz, IN[6] become false.

    While IN 6 is true I want robot don't move, when is false , spindle run on 50hz, robot can move.

    That means eveen when spindle stop from any error , robot will stop not keeping frequency of 50 hz cause will decrease to 0

  • panic mode
    Reactions Received
    1,280
    Trophies
    11
    Posts
    13,083
    • January 30, 2023 at 5:25 PM
    • #5

    that is not going to work...

    interrupts are edge sensitive, not level sensitive. and logic is reverse.

    you can simply get rid of the interrupt and after first PTP motion add

    WAIT FOR $IN[6]==FALSE ; spindle speed reached

    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

  • robot-cnc
    Reactions Received
    11
    Trophies
    4
    Posts
    432
    • January 30, 2023 at 6:01 PM
    • #6

    it's ok, but I want when $IN[6]==TRUE robot to stop, when become false to restart from last point remained

  • panic mode
    Reactions Received
    1,280
    Trophies
    11
    Posts
    13,083
    • January 30, 2023 at 6:21 PM
    • #7
    Quote from panic mode

    if you want to use it to pause and then continue program, remove RESUME command.

    Quote from panic mode

    interrupts are edge sensitive, not level sensitive.

    input is a BOOL so changing signal has two transition edges: rising edge and falling edge.https://www.scilab.org/signal-edge-detection

    normally interrupt reacts only to one of them so if goal is to respond to both, one would need two interrupts (one for rising, one for falling edge) unless additional flag is used and signal compares the two.

    when you start, spindle is off and input6 is already TRUE... but your interrupt is looking for transition to TRUE. but there is no transition (change of state) when going from TRUE to TRUE.

    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

  • robot-cnc
    Reactions Received
    11
    Trophies
    4
    Posts
    432
    • January 30, 2023 at 7:24 PM
    • #8

    You mean for pause and continue such a variant:

    DEF NONAME1()

    GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( )

    INTERRUPT ON 3

    INTERRUPT DECL 10 WHEN $IN[6]==TRUE DO STOP_MOVE()

    INTERRUPT ON 10

    .........................................

    INTERRUPT OFF 10

    END

    DEF STOP_MOVE()

    BRAKE

    WAIT FOR $IN[6]==FALSE

    WAIT SEC 0.2

    END

    And this interrupt of program (pause) will occur at any moment while all program running ?

    Would make sense to think on IF conditionality to introduce instead in sps.sub?

    PLC loop section for ex.

    I am thinking that postprocessor that write my src files should be setted to automatically write in each src file, usually being many. So, is excluded to manually do all these instructions .

  • panic mode
    Reactions Received
    1,280
    Trophies
    11
    Posts
    13,083
    • January 30, 2023 at 7:36 PM
    • #9

    yes, that is what code without RESUME would look like. and that should do the trick except on start. because on start first transition is non-existent(your interrupt is looking for TRUE on input 6 and that is already TRUE). so you need to work around that initial case. for example add command

    WAIT FOR $IN[6]==FALSE

    just after interrupt on...

    that will make robot wait first time.... and after that interrupt will take care of it.

    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

  • hermann
    Reactions Received
    407
    Trophies
    9
    Posts
    2,611
    • January 30, 2023 at 10:17 PM
    • Best Answer
    • #10

    One more thing always should be done:

    switch off the interrupt when entering interrupt service routine, and switch on just before leaving it.

  • robot-cnc
    Reactions Received
    11
    Trophies
    4
    Posts
    432
    • January 31, 2023 at 5:47 AM
    • #11
    Quote from panic mode

    yes, that is what code without RESUME would look like. and that should do the trick except on start. because on start first transition is non-existent(your interrupt is looking for TRUE on input 6 and that is already TRUE). so you need to work around that initial case. for example add command

    WAIT FOR $IN[6]==FALSE

    just after interrupt on...

    that will make robot wait first time.... and after that interrupt will take care of it.

    Thank you Panic, will try that.

  • robot-cnc
    Reactions Received
    11
    Trophies
    4
    Posts
    432
    • January 31, 2023 at 5:50 AM
    • #12
    Quote from hermann

    One more thing always should be done:

    switch off the interrupt when entering interrupt service routine, and switch on just before leaving it.

    Just when using Global Interrupt with outside subroutine from main program or even when using Interrupt simple declared with subroutine in main program, as above?

  • hermann
    Reactions Received
    407
    Trophies
    9
    Posts
    2,611
    • January 31, 2023 at 7:19 AM
    • #13

    Always

  • robot-cnc
    Reactions Received
    11
    Trophies
    4
    Posts
    432
    • January 31, 2023 at 10:45 AM
    • #14

    Like that. What about red instructions from main program , remain there .


    DEF NONAME1()

    GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( )

    INTERRUPT ON 3

    INTERRUPT DECL 10 WHEN $IN[6]==TRUE DO STOP_MOVE()

    INTERRUPT ON 10

    .........................................

    INTERRUPT OFF 10

    END

    DEF STOP_MOVE()

    INTERRUPT OFF 10 ; deactivate interrupt

    BRAKE

    WAIT FOR $IN[6]==FALSE

    WAIT SEC 0.2

    INTERRUPT ON 10 ; reactivate interrupt

    END

  • panic mode
    Reactions Received
    1,280
    Trophies
    11
    Posts
    13,083
    • January 31, 2023 at 2:45 PM
    • #15

    those are still needed.

    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

  • Online
    SkyeFire
    Reactions Received
    1,052
    Trophies
    12
    Posts
    9,427
    • January 31, 2023 at 3:47 PM
    • #16
    Quote from robot-cnc

    DEF NONAME1()

    GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( )

    INTERRUPT ON 3

    INTERRUPT DECL 10 WHEN $IN[6]==TRUE DO STOP_MOVE()

    INTERRUPT ON 10

    .........................................

    INTERRUPT OFF 10

    END


    DEF STOP_MOVE()

    INTERRUPT OFF 10 ; deactivate interrupt

    BRAKE

    WAIT FOR $IN[6]==FALSE

    WAIT SEC 0.2

    INTERRUPT ON 10 ; reactivate interrupt

    END

    Display More

    All four are needed, as Panic said. Also, the INTERRUPT ON 10 in the NONAME program should be placed as late in the program as possible, so that the the Interrupt is only active during the motions that may need to be interrupted. Likewise, the INTERRUPT OFF 10 should be as early as possible in the program.

    For example: (the moves to/from Home are not interruptible, only milling moves when the spindle should be at speed)

    Code
    PTP xHOME ; start from Home position
    PTP xAboveStartPoint ; start spindle here
    $OUT[SpindleOn] = TRUE
    WAIT FOR $IN[SpindleAtSpeed]
    WAIT FOR $IN[6]==FALSE ; ensure signal is not in the Interrupt state
    INTERRUPT ON 10 ; arm interrtup
    LIN xMillPoint1 ; plunge into workpiece
    LIN xMillPoint2 ; first leg of cut
    LIN xMillPoint3 ; 2nd leg
    LIN xMillPoint4 ; 3rd leg
    LIN xMillPoint5 ; final leg
    LIN xAbovEndPoint ; pull out of workpiece
    INTERRUPT OFF 10 ; disarm interrupt
    $OUT[SpindleOn] = FALSE ; stop spindle
    PTP HOME ; return Home
    Display More
  • robot-cnc
    Reactions Received
    11
    Trophies
    4
    Posts
    432
    • February 1, 2023 at 8:03 PM
    • #17

    Code that works :

    DEF NONAME1()

    GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( )

    INTERRUPT ON 3

    INTERRUPT DECL 10 WHEN $IN[6]==TRUE DO STOP_MOVE()

    $APO.CDIS = 0.5000

    BAS (#INITMOV,0)

    BAS (#VEL_PTP,20)

    BAS (#ACC_PTP,20)

    $BASE=BASE_DATA[1]

    ;$BASE={X 2000, Y 0, Z 1200, A 90, B 0, C 0}

    $TOOL=TOOL_DATA[1]

    ;$TOOL={X 503.173, Y 1.337, Z 101.069, A 0, B 90, C 0}

    $OUT[1]=TRUE

    $OUT[3]=TRUE

    WAIT FOR $IN[6]==FALSE

    $advance=3

    $VEL.CP=0.167

    INTERRUPT ON 10

    PTP {A1 0.000, A2 -90.000, A3 90.000, A4 0.000, A5 0.000, A6 0.000, E1 0, E2 0, E3 0, E4 0, E5 0, E6 0}

    PTP {A1 3.745, A2 -90.330, A3 101.473, A4 -113.300, A5 26.474, A6 115.693, E1 0, E2 0, E3 0, E4 0, E5 0, E6 0}

    LIN {X 0, Y 0, Z 10, A 110.424, B 0, C 180} C_DIS

    LIN {X 0, Y 0, Z 0, A 110.424, B 0, C 180} C_DIS

    LIN {X 731, Y 0, Z 0, A 130.502, B 0, C 180} C_DIS

    LIN {X 731, Y 243, Z 0, A 133.014, B 0, C 180} C_DIS

    LIN {X 0, Y 243, Z 0, A 110.424, B 0, C 180} C_DIS

    LIN {X 0, Y 0, Z 0, A 110.424, B 0, C 180} C_DIS

    LIN {X 0, Y 0, Z 10, A 110.424, B 0, C 180} C_DIS

    PTP {A1 0.000, A2 -90.000, A3 90.000, A4 0.000, A5 0.000, A6 0.000, E1 0, E2 0, E3 0, E4 0, E5 0, E6 0}

    $OUT[1]=FALSE

    $OUT[3]=FALSE

    INTERRUPT OFF 10

    END

    DEF STOP_MOVE()

    INTERRUPT OFF 10

    BRAKE

    WAIT FOR $IN[6]==FALSE

    WAIT SEC 3

    INTERRUPT ON 10

    END

    Thank you all !

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics

Job Postings

  • Anyware Robotics is hiring!

    yzhou377 February 23, 2025 at 4:54 AM
  • How to see your Job Posting (search or recruit) here in Robot-Forum.com

    Werner Hampel November 18, 2021 at 3:44 PM
Your browser does not support videos RoboDK Software for simulation and programming

Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Thread Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Similar Threads

  • Interrupt when testing in T1

    • Stampy
    • January 26, 2021 at 6:54 PM
    • KUKA Robot Forum
  • Interrupt Example

    • SkyeFire
    • March 18, 2021 at 8:25 PM
    • Manuals, Software and Tools for KUKA Robots
  • Interrupt not working when program is stopped

    • Xerces
    • August 14, 2019 at 6:31 PM
    • KUKA Robot Forum
  • Measurment of tool with interrupt when the toolsetter/button is clicked and then unclicked

    • martenH
    • November 30, 2021 at 4:02 PM
    • KUKA Robot Forum
  • Program stuck executing motion command (LIN_REL), but robot is not moving.

    • RoboterEST
    • July 15, 2021 at 8:50 AM
    • KUKA Robot Forum
  • Wait on input during motion?

    • n0909
    • June 1, 2021 at 10:39 AM
    • KUKA Robot Forum
  • interrupt in the interrup trajectory program

    • watchcat
    • July 24, 2020 at 1:05 PM
    • KUKA Robot Forum
  • Recommendations to search a part?

    • robotecnik
    • December 27, 2019 at 10:54 AM
    • KUKA Robot Forum

Tags

  • KRC4
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download