INTERRUPT issues

  • Greetings,


    I'm trying to create a simple interrupt program that stops motion once a certain value is set to condition. I have:





    Code
    DEF SubFindposZ()
    
    
    LIN_REL {Z -50}
    WAIT SEC 0   ; make SURE (!!!) that advance run pointer is here when interrupt is triggered
    END




    Code
    DEF subBrakez()
    INTERRUPT OFF 2
    BRAKE
    RESUME
    END


    I think it should work by going negative 50mm in Z until the condition is set then brake?


    :help:

  • your start position values are axis specific. what is the cartesian position or more specifically - what is the Z value?
    also loose those dashes.

    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

  • :hmmm:


    Sorry i added the dashes to visually see subprograms. I don't think the axis specific start point matters. I can get the robot to move in the -50 mm in z and i CAN see the $CYCFLAG[112] turn TRUE but motion still continues....


    Its like i can't interrupt a relative motion..or any motion for that matter.


  • Here is the code now, it still does not want to stop motion, it wants to reach -50mm before motion will stop, but again i see my CYCflag change when condition is met.

  • what the heck is "Measur_OUT1" and where is it declared? when does cyclical flag change? your interrupt condition change must occur at least 12ms after "interrupt on 2" command. also how fast robot moves? 50mm is a very short distance and unless speed is very low, this will be impossible to observe accurately (cannot tell if it happened at the begin, after or during motion).

    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

    Edited once, last by panic mode ().

  • The Measur_OUT would be a dot laser signal in distance in mm. I have the robot moving very slow, about 1.5 mm per second. The condition is true for the flag when a set point of the laser is greater than or equal to zero. I can rule out speed is not the issue, and the condition does become true, but interrupt just simply does not stop the motion.
    With adding the Wait For True it should of caught the advanced run.


    Does there need to be a move before I turn on the interrupt?

  • that means you are not telling us everything...
    btw your test code changed. ISR motion is different (do you still get interrupt triggered?).


    here is same situation but adapted so everyone can try it (not dependent on tool or base).
    i start with initial position which is mechanical zero (A4=0 deg). then tell it to move to 40deg.
    before motion interrupt is set to stop motion if A4 exceeds 20deg. and of course - it works as expected - it stops when A4 value exceeds 20deg. overshoot shown here is current robot position ($AXIS_ACT) and depending on speed will be larger or smaller but always over 20deg.

  • Yes i did greatly simplify the code, the full code will be finding the x,y,z,a,b,c. but for this case I would just like to get this code to work. I have other code that works with interrupts but for some strange reason this one will not have it. Still does not make sense to me yet why "even the simple code that was attached" the cycflag is TRUE at the correct time, but the sub program with motion continues to have motion and never goes into the interrupt brake subprogram.


    Thanks for the sample code, seems like they are both fundamentally the same, just different conditions.

  • i just modified it too by adding another interrupt off after motion call. this ensures interrupt is used correctly and only inside motion routine (and not after it!). also added a bit of code to capture position where interrupt occurred, may be helpful in your debugging.


    since you still have problem, i suggest checking if, when and where interrupt is triggered.

    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

  • and definitely check speed... if i run above example at 100%, A4 will still reach 40deg despite interrupt being triggered at 20deg.

    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