G
Hi All,
I don't wish to offend anybody, but I think the discussions about how to implement timers have gone off the deep end! I don't believe they
require anything like an 'engine'. To my mind they could and should be implemented as a simple subroutine in the logic solver.
The essential data for a timer is stored in a 3-word structure in the data table: preset, accumulator (elapsed time), and control. When the
program (ladder, IL, ST, etc.) encounters a timer instruction it (the solver) calls the subroutine and passes the data structure as a parameter (by reference). The control word contains status bits
(enabled, timing, done), time base info., and a reference count. The subroutine has access to a free-running timer/counter in the nether regions of the solver or OS that counts "heartbeats" of the system which are frequent enough and consistent enough to give the desired timing
resolution and accuracy. When called, the subroutine compares the count in the passed structure's control word with the heartbeat counter, then updates the accumulator and the control word count and status and returns.
Three subroutines or one with 3 entry points to handle TON, TOF, RTO.
Gerry
_______________________________________________
LinuxPLC mailing list
[email protected]
http://linuxplc.org/mailman/listinfo/linuxplc
I don't wish to offend anybody, but I think the discussions about how to implement timers have gone off the deep end! I don't believe they
require anything like an 'engine'. To my mind they could and should be implemented as a simple subroutine in the logic solver.
The essential data for a timer is stored in a 3-word structure in the data table: preset, accumulator (elapsed time), and control. When the
program (ladder, IL, ST, etc.) encounters a timer instruction it (the solver) calls the subroutine and passes the data structure as a parameter (by reference). The control word contains status bits
(enabled, timing, done), time base info., and a reference count. The subroutine has access to a free-running timer/counter in the nether regions of the solver or OS that counts "heartbeats" of the system which are frequent enough and consistent enough to give the desired timing
resolution and accuracy. When called, the subroutine compares the count in the passed structure's control word with the heartbeat counter, then updates the accumulator and the control word count and status and returns.
Three subroutines or one with 3 entry points to handle TON, TOF, RTO.
Gerry
_______________________________________________
LinuxPLC mailing list
[email protected]
http://linuxplc.org/mailman/listinfo/linuxplc