continued from previous post ...
basic idea: just before the TON gets executed, we jump into a subroutine ... that subroutine stores:
(a) the current value from the timer’s accumulator BEFORE the TON instruction gets scanned ... and
(b) the current condition of the timer’s status bits (etc.) BEFORE the TON instruction gets scanned ...
once we’ve run through the subroutine, we come back to our original ladder and execute the TON instruction ...
and then just after the TON gets executed, we jump into another subroutine ... that subroutine stores:
(a) the current value from the timer’s accumulator AFTER the TON instruction gets scanned ... and
(b) the current condition of the timer’s status bits (etc.) AFTER the TON instruction gets scanned ...
think about it ... now we can have a series of scan-by-scan snapshots to show us exactly what was going on inside the timer both BEFORE and AFTER it gets executed ... this is the type of technique that can take you WAY BEYOND what the “books” can teach you about the nuts-and-bolts of how the PLC instructions and scan sequences operate ...
[attachment]
here’s a quick rundown of what this data is showing us ... I’m skipping over some details but you’ll be able to figure out what I’m leaving out once you’ve looked at the .RSS program file ...
here’s scan #13 ...........................
A. on scan #13 BEFORE the TON gets executed, the timer’s accumulator contains the value “99” ...
B. on scan #13 BEFORE the TON gets executed, the timer’s done bit (bit 13) is off (=0) ...
C. on scan #13 AFTER the TON gets executed, the timer’s accumulator contains the value “100” ...
D. on scan #13 AFTER the TON gets executed, the timer’s done bit is on (=1) ...
here’s scan #14 ...........................
E. on scan #14 BEFORE the TON gets executed, the timer’s accumulator contains the value “100” ...
F. on scan #14 BEFORE the TON gets executed, the timer’s done bit (bit 13) is on (=1) ...
G. on scan #14 AFTER the TON gets executed, the timer’s accumulator contains the value “0” ...
H. on scan #14 AFTER the TON gets executed, the timer’s done bit is off (=0) ...
that should give you a good idea of what kind of detail this technique will provide ... and if you want to go deeper and explore the inner workings of exactly how the timer “keeps time”, then take a look at those “extra” bits that are being recorded in files N10 and N12 ... you can find the details of what’s going on there by reading that “overkill” thread that Allen Nelson (and others) and I worked on some time ago ... 93lt1 provided a link to it just a few posts back ...
now on to the next post for the .RSS program ...