Interrupt in queue?

Hello, i've got this little code example here:
   WaitUntil b_PickPosReached=TRUE;<br>   PickObject;<br>ENDIF<br>If b_ObjectReady=TRUE THEN<br>   GoToPickPos;<br>   WaitUntil b_PickPosReached=TRUE;<br>   PickObject;<br>ELSE <br>   WaitUntil b_ObjectReady=TRUE;<br>   GoToPickPos;<br>
b_ObjectReady is set in a trap routine and everything works fine when its set TRUE
(trap routine waits for signal from sps to read coordinates;if there are new coord, then its set TRUE, if there' same coord as before its set to FALSE)
but when it's set FALSE and program waits for it to be set TRUE, i'm not able to 'access' the interrupt.
When stoping the program, it says "interrupt removed from queue"..

Is it normal? How to get it working right?



Tagged:

Comments

  • EricHEricH Germany
    Do you really need an interrupt? What if you just wait until signal from sps?
  • PabaPaba Germany
    I want the coordinates to be read while robot is moving..
    I'm very new to RAPID and thought an interrupt is the best option
  • EricHEricH Germany
    Ok, now I understand. An interrupt seems to be necessary for that. It's not normal that the interrupt is removed from queue while in a wait-instruction. So something weird is going on. How is your interrupt defined?
  • PabaPaba Germany
    The interrupt is only removed from queue when stopping the program.. but this means that it wont execute before, right?
    </code><code>Connect getKoords WITH Read_SPS_Koord;<br>ISignalDI DI_05,1,getKoords;<br><br>TRAP Read_SPS_Koord<br>  pos1:=[...]<br>  IF (same Coords as before) THEN<br>    b_objectReady:=FALSE;<br>    Program;<br>  ELSE <br>    b_objectReady:=TRUE;<br>    target:=[...]<br>    Program;<br>  ENDIF<br>ENDTRAP<br>
     Proc "Program" is the little example code from above.



  • EricHEricH Germany
    edited August 2019
    You are waiting inside the trap routine and a trap routine cannot been interrupted. You should try to handle the waiting outside.
  • DenisFRDenisFR FRANCE ✭✭✭
    Hello,
    Do you have multi task option?
  • PabaPaba Germany
    edited August 2019
    Multitask is activated yes (working with YuMi)

    Eric, but the "Program" is a procedure.. when its called by a trap routine, does it mean the trap routine is still active?
    Can i cancel the interrupt when getting into "program" or smth like this?
    <code>Connect getKoords WITH Read_SPS_Koord;)
    If b_ObjectReady=TRUE THEN<br> GoToPickPos;<br> WaitUntil b_PickPosReached=TRUE;<br> PickObject;<br>ELSE <br> WaitUntil b_ObjectReady=TRUE;<br> GoToPickPos;<br> WaitUntil b_PickPosReached=TRUE;<br> PickObject;<br>ENDIF
    </code></pre><br></div><div>Or maybe use Return instead of calling the proc?<br></div><pre class="CodeBlock"><code>TRAP Read_SPS_Koord<br> pos1:=[...]<br> IF (same Coords as before) THEN<br> b_objectReady:=FALSE;<br> RETURN;<br> ELSE <br> b_objectReady:=TRUE;<br> target:=[...]<br> RETURN;<br> ENDIF<br><span>ENDTRAP</span>PROC program<br>IDelete getKoords;<br>(




  • EricHEricH Germany
    It is still inside a trap routine, therefore the next interrupts are skipped. You have two options:

    1. define a situation in your main task to wait until the next valid coord is sent from the plc ( it is still possible that you dont have to wait, when the next coord is ready before the waypoint is reached.)
    2. use a background task and handle there the digestion of the coords. I think this is also the idea that denis has.
  • PabaPaba Germany
    Thanks Eric.
    I'll try to set up a new task..
    But i wonder whats the best way to exchange values between the tasks
  • EricHEricH Germany
    Glad to help!

    I think a shared data module should do that. Configuration->Controller->Automatic Loading of Modules.
  • lemster68lemster68 United States ✭✭✭
    EricH said:
    Glad to help!

    I think a shared data module should do that. Configuration->Controller->Automatic Loading of Modules.

    To complete the sharing the you must declare PERS in both (or more) tasks with the same name in all tasks.

    Lee Justice
Sign In or Register to comment.