I’ve got a clock setup to time when the conveyor on our plant is stop, it’s working off a trap routine using the output C1NullSpeed as a trigger, the trouble we’re having is if we stop the conveyor and Reset PP to Main then restart the conveyor the timer reads as 0 seconds irrespective of how long it’s stopped for.
Does PP to Main reset all clocks?
Here’s the code we’re using:
connect irConvStop with tpConvStop;
ISignalDI c1NullSpeed, 1, irConvStop;
connect irConvStart with tpConvStart;
ISignalDI c1NullSpeed, 0, irConvStart;
trap tpConvStop
log_stop;
if DOutput(sdoCycleOn) = 1 then
if bCTSyncInfo
ErrWrite \I, “Conveyor Stopped”, “Conveyor Stopped”;
endif
ClkReset clkConv2;
ClkStart clkConv2;
endtrap
trap tpConvStart
if DOutput(sdoCycleOn) = 1 then
ClkStop clkConv2;
nStopTime := nStopTime + ClkRead(clkConv2) + nConvRamping;
!writes downtime to logfile.
log_start;
if bCTSyncInfo
ErrWrite \I , “Conveyor Started”, "StopTime: " + ValToStr(nStopTime);
endif
endtrap