
adccommunitymod (AutomationDirect) asked a question.
Created Date: May 15,2016
Created By: GlennLee
**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****
Gents! Thank you first of all for your previous help. I now face an interesting problem...again...and seek your advice. I am translating a Direct-Soft program that is using subroutines. I have converted the subroutines to tasks and CALL the tasks where the DirectSoft program called SUBR. One task had a RTC (Connditional Return). I don't see a way to end a task early to mimic this subroutine function. I used the condition that caused the RTC to block any further code execution in the task but I wonder if there is a better way. Any suggestions would be welcome. Regards, Glenn
Created Date: May 15,2016
Created by: GlennLee
Gents! Thank you first of all for your previous help. I now face an interesting problem...again...and seek your advice. I am translating a Direct-Soft program that is using subroutines. I have converted the subroutines to tasks and CALL the tasks where the DirectSoft program called SUBR. One task had a RTC (Connditional Return). I don't see a way to end a task early to mimic this subroutine function.
I used the condition that caused the RTC to block any further code execution in the task but I wonder if there is a better way. Any suggestions would be welcome.
Regards,
Glenn
Created Date: May 16,2016
Created by: winterrossi
I 've never tried this, but what about putting a for loop with a setting of 1 at the beginning of the task, then use a for loop break to end early? Just a thought
Created Date: May 16,2016
Created by: g.mccormick
I 've never tried this, but what about putting a for loop with a setting of 1 at the beginning of the task, then use a for loop break to end early? Just a thought
Going on winterrossi's thoughts, I created the attached. I don't have hardware, but this did not throw any compile errors.
Created Date: May 16,2016
Created by: GlennLee
Thank you Mr. McCormick. I will test your example soonest.
Created Date: May 19,2016
Created by: kewakl
I don't have the P2000 hardware available, so I did this on P3-550.
It works as described (with bits instead of inputs) by winterossi/g.mccormick earlier.
Something to consider - even with a loop limit of 1, you should use an EDGE trigger to limit entry into the loop - or reset loop enable bit immediately after breaking out of loop - or reset the the task call enable logic.