Terry Woods
Member
- Join Date
- Apr 2002
- Posts
- 3,170
Timers and counters are essentially the same thing...
Actually, Timers and Counters are Actually the same thing!
One is subject to a "regular" event (a timed update by the system).
The other is subject to relatively "random" events.
In many PLC's you can't have a Timer-12 and a Counter-12. This is because the "12" identifies a particular memory location in the Timer/Counter Memory Area.
Once you specify that the particular location is to be used as a Timer, that location is updated CONSTANTLY by the system. Part of the scan process is to bring in a copy of the Timer/Counter Memory area.
So, while the ladder is executing, it is working with a snap-shot of the Timer/Counter Table. That's why a Timer value doesn't change if you examine the value in the first rung and then again in the last rung.
If the memory location is specified as being a "Counter" then the "copy" of that memory location is subject to modification by the Ladder. The ladder can then reference that copy of the counter location and always get the latest value.
Now, at the end of the ladder, I think, the Timer/Counter Table is copied back to the original location through a MASK. The mask filters out all timer values. The value of each bit in the MASK is simply, 0=Timer, 1=Counter or Vice-versa.
Now, the original Timer/Counter Table has the latest Counter values AND, the latest Timer Values which were being updated all through the scan.
As someone already indicated, the particular timers are updated ("ticked") by the system. The system-cycles are counted by a counter which provides a pulse every so-many counts to another counter which provides a pulse every so-many counts to another counter... until there are .001, .01, and .1 type pulses.
Having identified a particular timer with a particular time-base, that timer watches for the specified pulse.
Actually, Timers and Counters are Actually the same thing!
One is subject to a "regular" event (a timed update by the system).
The other is subject to relatively "random" events.
In many PLC's you can't have a Timer-12 and a Counter-12. This is because the "12" identifies a particular memory location in the Timer/Counter Memory Area.
Once you specify that the particular location is to be used as a Timer, that location is updated CONSTANTLY by the system. Part of the scan process is to bring in a copy of the Timer/Counter Memory area.
So, while the ladder is executing, it is working with a snap-shot of the Timer/Counter Table. That's why a Timer value doesn't change if you examine the value in the first rung and then again in the last rung.
If the memory location is specified as being a "Counter" then the "copy" of that memory location is subject to modification by the Ladder. The ladder can then reference that copy of the counter location and always get the latest value.
Now, at the end of the ladder, I think, the Timer/Counter Table is copied back to the original location through a MASK. The mask filters out all timer values. The value of each bit in the MASK is simply, 0=Timer, 1=Counter or Vice-versa.
Now, the original Timer/Counter Table has the latest Counter values AND, the latest Timer Values which were being updated all through the scan.
As someone already indicated, the particular timers are updated ("ticked") by the system. The system-cycles are counted by a counter which provides a pulse every so-many counts to another counter which provides a pulse every so-many counts to another counter... until there are .001, .01, and .1 type pulses.
Having identified a particular timer with a particular time-base, that timer watches for the specified pulse.