5/28/2018 8:47 AM | |
Joined: 2/6/2015 Last visit: 11/26/2023 Posts: 44 Rating: (4) |
Dear All, If cycle time of OB1 be more than specific interrupt OBx, how many times the specific OBx will call in one cycle of OB1 ? In other hand i want to know after finishing of specific interrupt OBx, the OBx wait for new cycle of OB1 or continue new cycle in same OB1 cycle that is not finished yet ? Thanks ------------------------------------------------------------------------------------------ |
Last edited by: sepehr.hsn at: 5/28/2018 8:48:23 AMLast edited by: Jen_Moderator at: 5/28/2018 11:06:43 AMNew subject after splitting |
|
5/28/2018 5:46 PM | |
Joined: 11/5/2012 Last visit: 3/15/2024 Posts: 487 Rating: (63) |
Hello sepehr.hsn, good day. Lets suppose that OB1 has a 110ms cycle time for particular cycle, you are using an cyclic interrupt OBxx that executes, with 10 ms execution time, every 25ms. In this particular cycle, OB1 start cycle coincides with the end of OBxx: - OB1 executes for 25ms. - OB1 gets interrupted to execute OBxx, which takes 10 ms to execute. - OBxx finishes its executions and OB1 is resumed at breakpoint. - OB1 executes 25 more ms and then gets interrupted again. OB1 cycle time = 60 = 25ms + 10ms (OBxx execution time) + 25ms. (Still is one scan of OB1). - OBxx executes again, finishes and return to OB1 break point. - OB1 cycle time = 25ms + 10ms + 25ms + 10ms + 25ms = 95ms. Then it gets interrupted again. - OBxx finished and OB1 finished its execution. Cycle time after OBxx finishes = 95ms + 10ms = 105ms then OB1 finishes its execution, after 5 more miliseconds and restarts its execution. On next cycle OBxx is going to execute, not at 25ms of OB1's cycle time, but at 20ms, since 5 ms has passed already on previous cycle. I hope I made myself clear and this can help you to clear your doubts. Regards. Edit: To answer your question, an interrupt OB can execute as many times as called by OS, and OB1 cycle will be interrupted every time an interrupt OB is called by OS. So be careful using interrupts at low intervals because they could, as #dp said, increase the execution time thus, the updates of I/O, trigger the watch dog, slower main code execution, etc. |
Last edited by: Rescobedo at: 5/28/2018 9:44:09 PM |
|
This contribution was helpful to3 thankful Users |
7/18/2018 11:53 AM | |
Joined: 2/6/2015 Last visit: 11/26/2023 Posts: 44 Rating: (4) |
Dear #dP Thank you very much. BR |
7/18/2018 11:54 AM | |
Joined: 2/6/2015 Last visit: 11/26/2023 Posts: 44 Rating: (4) |
Dear Rescobedo Thank you very much. BR |
Follow us on