INTERRUPT PROGRAM

  • 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

  • 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

  • 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.

  • 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

  • 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

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

    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

  • 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 .

  • 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

  • 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.

  • 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?

  • 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

  • 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 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 !

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now