Sign in to follow this  
Followers 0
Van

Clarification of TKON and TKOF and task interruption

8 posts in this topic

Do you need to call TKOF at the end of an interrupt task? In my cyclical (main) task I use the TKON instruction to execute an interrupt task. Do I need to call TKOF within (i.e. the end of) the interrupt task? Or, because the task is defined in CX-Programmer as an interrupt task, once it reaches the END statement the PLC automatically turns the task off?

Share this post


Link to post
Share on other sites
I don't have any hands on experience with these instructions but given your questions I suggest you download the following manual. For quick reference CX-Programmer has an instruction reference as well but this manual handles all instructions in CJ/CS series in detail with examples. W340-E1-11 CS-CJ Instructions Reference Manual

Share this post


Link to post
Share on other sites
Interrupt task 4-255 can be used as cyclic Task same like cyclic Task 0-31. So in order to run them just once TKOF(821) should be use. FOR EXAMPLE: int249, at end of the int program 249 this code should be written LD P_On TKOF(821) 8249 8000 + 249(int task number)

Share this post


Link to post
Share on other sites
Well, I add that instruction to the final RUNG in the task just above the END rung and my code STOPPED working. I removed it and it worked. Is this model dependent? I'm running a CJ1M.

Share this post


Link to post
Share on other sites
Perhaps it is better if you post your code?

Share this post


Link to post
Share on other sites
We used TKON and TKOF only for cycle time issues. When we have to perform certain calculations we put that task on and afterwards we put it off. I have never used it with interrupt tasks. (and I think you don't need it) You can use the MSKS command to mask your interrupts. Be careful monitoring when you use it to reduce cycle time you could get confused if you don't take a look at the task status at that moment (it is not so much fun to debug) Beegee

Share this post


Link to post
Share on other sites
The TKON and TKOFF instructions CANNOT be used in interrupts, it's all IN THE MANUAL if you bother to read it. OMRON is usually very detailed in specifying in their documentation how/when/where each instuction works, which data areas can be used as well as a sample of how it works. tkof.pdf

Share this post


Link to post
Share on other sites
It isn't model dependent. Why do you need to use an interrupt task? Are you using I/O interrupt on CJ1M-CPU21,22,23?? There is no need to use TKON TKOF with I/O interrupt. In this code each time w0.0 go from off to on Task 249 run just one time. This is not interrupt, it is an extra cyclic task that run just one time. Once you run interrpt task as extra cyclic task you can use TKOF AND TKON inside this interrupt task. int249.cxp Edited by Yair

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