programing for cycles

Hello all!

I am writing a program to run 1000000 cycles with a Cnd Jump if the temperature get above a certain level and when it get below another temperature it starts again. the problem I’m having is how do I keep the 1000000 cycles from reseting when the temperature becomes low enough that it starts again? here is the program. the 0 point is just a transition behavior.

I’m a little unclear on how exactly you want this to behave. If the temperature becomes greater than x, you want to start 1000000 cycles is clear, but what exactly should happen when it gets below a certain temperature? Do you want to restart the 1000000 count? If not, then why even have the check for being less than a certain temperature? Do you only want it to start after reaching a lower temperature only if the 1000000 is already done?

As long as the temperature is below 120 in step 3 the test will start but if it goes over 130 it jumps back to step 3 and waits untill it is less then 120 at which time the test will start again. the problem is when it restarts it also restarts the cycles counter and I want to know of a why to have it run X number of cycles even with it is stopping and starting again?

You can do this:

  1. Make a variable called “CyclesToGo” of type DINT to keep track of how many cycles are left.
  2. Somewhere in the beginning of the user program, set the variable to the total number of cycles:
    expression.png
  3. In the Sine Start command, use the CycleToGo variable in the Cycles command parameter.
  4. Each time the cycling stops due to the temperature rise, update the CyclesToGo parameter:
    expression2.png
    The expression makes use of the Axis Status register (Axis Tools>Axis Status Registers>All tab>Target) that reports how many cycles have been completed since the command was issued.