Interrupt in queue?
Paba
✭
Hello, i've got this little code example here:
b_ObjectReady is set in a trap routine and everything works fine when its set TRUEWaitUntil 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>
(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?
0
Comments
-
Do you really need an interrupt? What if you just wait until signal from sps?
0 -
I want the coordinates to be read while robot is moving..I'm very new to RAPID and thought an interrupt is the best option0
-
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?
0 -
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.
0 -
You are waiting inside the trap routine and a trap routine cannot been interrupted. You should try to handle the waiting outside.
0 -
Hello,Do you have multi task option?☑️2024 - RobotStudio® User Group0
-
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>(0 -
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.1
-
Thanks Eric.I'll try to set up a new task..But i wonder whats the best way to exchange values between the tasks0
-
Glad to help!I think a shared data module should do that. Configuration->Controller->Automatic Loading of Modules.0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 798 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings