RobotStudio event

New to Interrupts

Goodmorning All,
                            I am trying to implement an interrupt that is tied to a toggle switch input.  I want this interrupt to stop the robot in place when toggled high, and resume movement when toggled back to low.  I have gotten this operation to work, however, I want this operation to be repeatable...which it is not.  If the interrupt is used once, it cannot be activated again, until I restart the program.  I am in teach pendant mode.  Any suggestions?

Thank you,
Kris 

Comments

  • kioog
    kioog ✭✭
    Hello,
    what error do you get, that the interrupt is already declared?
    best use is that you define your interrupts at the beginning of your program, before your main loop
    and that you use Iwatch en Isleep in your program to put them active or inactive when you want.
    best use is also to put an Isleep in the beginning of your trap routine for your interrupt, otherwise you can nest down your interrupts when you have fast multiple flanks of your interrupt signal.
    also when you declare your interrupt, put Idelete just the line before, so when the interrupt is declared, it is deleted and you can redefine the interrupt, otherwise you get an error that the interrupt already exist.
    when you do "PP at main" all interrupt are deleted, that is probably why it always works only 1 time.

    BR
    Peter
  • In the routine called by your interrupt:

    - stop the robot motion

    -WaitDI for the input to go low

     then the program will carry on from where it got interrupted.


    Will this for your situation?

  • It is important to delete your interrupt declaration at the beginning of each cycle as in the example below:

        PROC main()
            IDelete sig1int;

            CONNECT sig1int WITH iroutine1;
            ISignalDI diInput,1,sig1int;

            WHILE TRUE DO

            !continious program here

            ENDWHILE
        ENDPROC

    /Pavel