Sign in to follow this  
Followers 0
FET_Destroyer

fixed program cycle

7 posts in this topic

Hello guys, I always done the programs in cx-programs consider them as a cyclic task, but now I need to create programs that run exactly with a 2ms period. My code takes between 1.3 and 1.5ms to complete, how can I run it at each 2ms? Regards

Share this post


Link to post
Share on other sites
Without saying which PLC model, it's hard to point you in the right direction. But in most of them, you can go into the PLC settings, and on the Timings tab you can set a fixed cycle time.

Share this post


Link to post
Share on other sites
Yap, sorry. My PLC is CJ2M-CPU33. Is this settings contant cycle??? for example, I have 3 programs running. I just want one of them is fixed, the others are not relevant it can be done in the intervals and free time.

Share this post


Link to post
Share on other sites
That is not possible with CJ, but is possible with the newer NJ. In a CJ, like most PLCs, all code runs every cycle.

Share this post


Link to post
Share on other sites
If it a CJ or CP1L then use scheduled interrupt task. Scheduled Interrupts This function executes an interrupt task at a fixed time interval measured by the CPU Unit’s built-in timer. The time interval units can be set to 10 ms, 1 ms, or 0.1 ms. The minimum timer SV is 0.5 ms.

Share this post


Link to post
Share on other sites
I'm not sure that would help in his situation. With the largest setting being 10ms, that may be even shorter than a single scan time depending on the length of the program. That could make certain code run even faster, not slower. But perhaps if critical items were placed in the timed interrupt and the fixed cycle was set much longer, this may work. Much of this depends on how much code.

Share this post


Link to post
Share on other sites
Setup a Scheduled Interrupt Task and move the code your want to run at a fixed cycle time. In a standard cyclic task set the time interval for the Scheduled Interrupt to run using the MSKS instruction. Read the manual. Scheduled Interrupt W473-E1-08_CJ2_Unit_Software_User_Manual.pdf

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