Van Posted June 18, 2008 Report Posted June 18, 2008 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?
PdL Posted June 18, 2008 Report Posted June 18, 2008 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
Yair Posted June 18, 2008 Report Posted June 18, 2008 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)
Van Posted June 18, 2008 Author Report Posted June 18, 2008 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.
beegee Posted June 18, 2008 Report Posted June 18, 2008 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
BITS N BYTES Posted June 18, 2008 Report Posted June 18, 2008 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
Yair Posted June 18, 2008 Report Posted June 18, 2008 (edited) 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 June 18, 2008 by Yair
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now