# Using the NJ "Cycle Time" in a math equation

## 5 posts in this topic

I would like to use the actual Cycle Time (in seconds) of the NJ101 CPU in a Structured Text  math equation.  You might also call it the Task Period... However it's called, It needs to be the amount of time that has elapsed from the last calculation of the ST math equation.  It must be a variable that also satisfies this looping equation: Time:= Time +cycle time .. so that the master equation, which is calculating position information, based on TIME .. is up to date with each calculation in the loop.

How do I insert that cycle-time, which might not be identical for each loop, (or, is it) ?  Thanks, Regards, Michael

##### Share on other sites

NJ uses a fixed cycle time, you set it in task settings, and it never changes.  No need to see it in calculation.

The cycle time is fixed, but the actual process time for each cycle can be seen in a system variable.

##### Share on other sites

Hi Crossbow...  Thanks... Actually, I think I do need to see it... or at least a cycle count that increases with each count by 1*CycleTime...   Time is an element in the equation.  Without time, the Frequency or Period of a sine wave could not be constructed.  Time must be in the calculation.  Is it perhaps just a system global variable?   Easily, called, normalized to zero, and modified by each "cycle time"?

Perhaps I won't care about the "Process Time"... because it must fit inside of the cycle time...  If the cycle time is 1ms,  Time would start at zero with the first cycle, and increase by 1ms for each additional cycle.. until the sequence is stopped.?

OK .. I get it.  The cycle time is fixed. (1ms, 2,ms or 4ms) but, Omron doesn't count the cycles, I'll have to.   Thanks again.

Edited by lamboom

##### Share on other sites

There's a function called Get***Cnt which is free running counters, incrementing once per time frame, and there are several time frames that you can select from.

1 person likes this

##### Share on other sites

Thanks... You're a wonderful person... don't ever change....

## 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