BASE wrote:One question I have is what prevents the IF !SpindleEnableOut_O from evaluating True after it's started, but before the timer has finished, and perpetually resetting the timer? I used another memory bit that's set when the timer is running. Maybe that was an unnecessary complication?
The line
Code: Select all
IF !SpindleEnableOut_O THEN SpindleStopped_T = SV_MACHINE_PARAMETER_175 * 1000, SET SpindleStopped_T
does "run" every scan while the spindle is off.
However, assigning to the timer preset value, and setting the active bit, does not "reset" the timer. If the timer is already active and running, it will just continue to run (little different than SETting an output or memory bit that is already on).
The only condition that resets the timer, so that it starts over at zero next time it gets set, is if SpindleEnableOut_T is true (i.e. the spindle starts running again).
Fusion: if you used the Wizard to assign "SpindleCooling" to OUT7, then your PLC program source should already have a line in it that says
In the example I posted, I only included code that would have to be new or changed.