Sign in to follow this  
Followers 0
Van

More TKON - Interrupt Tasks

3 posts in this topic

Equipment: Omron CJ1M-CPU11 I read the programming manual and the instruction manual. Either the manual is missing something (doubt it) or I am overlooking something obvious (more likely)... I am attempting to use an interrupt task as a subroutine/function to be called from the main code (cyclical tasks) to populate memory space. According to the manual, when an interrupt task is called (via. TKON) from a cyclical task the execution is immediate: branches at TKON; executes the interrupt task; returns to the TKON interrupt point. I see this working however if I make multiple calls to my interrupt task from the same cyclical task (but separate rungs) in the same pass only the last called TKON is executed (i.e. last condition set for the TKON routeine to work from). I can see this by monitoring the memory space the interrupt task is writing too (a circular buffer). There should be TWO buffer (memory) writes but only the last call is writing to the buffer memory space. The PLC appears to be acting as if the changes to the memory space have not been committed at the end of the interrupt task. That is, only the last "push to stack" is being executed. Now, If I disable either rung it works properly. I did see this little blurb in the instruction manual: ?Immediate Refreshing Specification Not supported. I have a sneaky suspension I am about to learn what this really means. Do I have to wait for the cycle to finish before making the next TKON call? pseudo code: === BEGIN PASS === *** Cyclical Task 00 START -- SECTION 01 BEGIN RUNG 1: Set Data for TKON RUNG 2: CONDITION TRUE--->TKON(8011) RUNG 3: Set Data for TKON RUNG 4: CONDITION TRUE--->TKON(8011) -- SECTION 01 END *** Cyclical Task 00 END === END PASS === *** Interrupt Task 8011 START (do stuff here) *** Interrupt Task 8011 END Edited by Van

Share this post


Link to post
Share on other sites
I have not dug into the manuals, but I can explain how it works from experience. The feature that you are using (using an interrupt task as a cyclic task) is intended to add more cyclic tasks to a project. When you do a TKON of an interrupt task number (#8xxx), you are not calling it to execute immediately, you are simply enabling it to execute when the ladder processor gets to that task in the list (ie after all other cyclic tasks). What you are trying to do is probably better done with a subroutine. That will jump to the subroutine and then jump back, executing the code 2 times in a scan if you call it 2 times in the scan. Right now you are enabling the task, and only the last set of data you are trying to pass will be processed.

Share this post


Link to post
Share on other sites
What you have described is exactly what is happening. I will look into "subroutines". Thank you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0