"Actually binding the Vmem makes it much simpler to program. How much extra time and more complex would it be if you had to assign memory for each timer?? Quite a bit. Additionally if you dont use the timer; for example timer T21, then V21 would be available as user memory. So it's only dedicated if your using that timer."
Why would referencing a V-Mem location be any easier and less complex than referencing a Timer location? There is absolutely no difference in the effort required.
Nothing I spoke of even suggested that a programmer had to assign memory locations for Timers. To reference a timer by "type" automatically allocates the appropriate amount of memory... just as in AD, except there is no possibility of "stepping" on another timer. And, all timer references are available unless explicitly used. No matter how you use T1, T2 is available until you use it.
So... even though it is available, you don't use T21. However, you end up using V21 for something. Now, T21 is not available. And, if T19 is already being used as a Standard Timer... then T20 can only be used as a Standard Timer.
This scheme is reminiscent of the days when all logic had to be run through a minimization procedure because there was simply not enough logic available.
"It's entirely possable that a program might require two references, or more then one timer using the same timer reference. Your "Smart" package would preclude that possability. I've done many application where "stepping" on a particular Vmem location was intentional."
The "smart" package timer allows constant values or V-mem references for Preset values. V-xxx can be used by any number of timers. Nothing is precluded in that respect. As far as Accumulated values, any instruction that "writes" can write to any Accumulated value. Again, nothing is precluded. Any instruction that "reads" can access the Preset or Accumulated values of any timer by simply referencing the timer. You don't have to remember which V-Mems might be associated with a particular Timer.
"Stepping" is the act (usually unintentional) of crossing a boundary... as in stepping on someone's toes. If a valid double-word exists at V100/V101, and then, you write a double-word to V99... you would be "stepping" on V100.
For a given double-word at V100/V101, having a legitimate reason to write a single word to V100 -or- V101 would not be "stepping".
In AD, if you use T1 as an Accumulating Timer, and then you try to use T2 as either a Standard Timer or an Accumulating Timer, T2 would be "stepping" on T1... not good. The AD method
allows this "stepping" to occur.
In a free-range, or open, memory system, where you are not restricted as to how you use the V-mem (as is the case with Integer-Files, Real-Files, etc.) the programmer must, of course, be mindful of his data-types and where they reside. It is very easy to "step" on data if one isn't careful. But this simply shouldn't be the case for Timers and Counters.
The only difference between a Timer and a Counter is the manner in which the accumulated value is updated. In timers the accumulated value is updated on a time-basis. In counters, the accumulated value is updated on an event-basis. Aside from that there is no difference.
In TI, all timers and counters are maintained in the same memory area. They belong to the element group called T/C (Timer/Counter). As such, you assign the reference numbers from the pool of T/C numbers, like so...
T/C
Ref # Usage
1 TMRF
2 CTR
3 TMR
4 TMRF
5 CTR
.
All of the timers (TMR & TMRF) and counters use only 2 words. One word is for the Preset value. The other word is for the Accumulated, or Current value. All values are maintained in Binary-Decimal... not BCD. The range of the counters and timers is as follows:
CTR: 00000 to 32767
TMR: 0000.0 sec to 3276.7 sec (tenth-second time-base)
TMRF: 00.000 sec to 32.767 sec (milli-second time-base)
Notice that the ranges are numerically the same except for the positions of the decimal points.
The actual value in the preset location and the accumulated location, in all of those, ranges from 00000 to 32767. The decimal point is "virtual", and it is determined by the T/C-type. For counters, there is no decimal point. For TMR, the decimal point "exists virtually" at the tenth-second location. For TMRF, the decimal point "exists virtually" at the milli-second location.
Simply declaring the timer-type tells the timer what time-base to use. If you want to use a time-base other than tenth-second or millisecond, then create a timer that is preset to that time-base and use the output from that timer to increment, or decrement, a counter. Since the counter is now driven by a time-base, the counter now becomes a timer. (Timers and Counters are the same... except for the nature of the trigger.)
Preset values can be explicitly assigned with a constant value when the T/C is created, or they can be assigned dynamically by means of a V-Mem reference.
T/C
Ref # Usage Preset Used as...
1 TMRF 32000 32.000
2 CTR 500 500
3 TMR 32000 3200.0
4 TMRF V100 V100 value read in milli-seconds
5 CTR V200 V200 value read as an integer
.
Some PLCs update their timers and counters from the Preset value towards 0, while others update from 0 towards the Preset value. Regardless, the Accumulated (Current) values are initialized when the T/C is first scanned. After that point, the Current value can be accessed at any time simply by referring to the current value reference of the particular T/C.
If you want to "read" from, or "write" to, the Preset value, or the Current value, of T/C-3, you simply reference TCP-3 and TCC-3, respectively.
T/C Preset Current
Ref # Usage (TCP) (TCC)
1 TMRF TCP-1 TCC-1
2 CTR TCP-2 TCC-2
3 TMR TCP-3 TCC-3
4 TMRF TCP-4 TCC-4
5 CTR TCP-5 TCC-5
.
If you want to perform math operations with an accumulated (current) value, you simply need to know what that value represents; integers, tenth-seconds, milli-seconds, or custom. You then have to design your math to accomodate the particular type.
For example, using a basic ADD Instruction... TCC-1 + V105 = TCP-4. Is that complex?
All of this happens without having one timer/counter accidently "stepping" on another timer/counter just because you didn't remember the type of a particular timer. This method precludes that from happening.
"...but after doing hundreds of applications with AD PLCs, I can see the logic in it."
Well, of course you can. It is "logical". However, it is "logical" only in the sense that it works; in the same way that logic, extensively reduced by a K-Map, works... but is it user-friendly? Clearly, it is not.
Mike, you have simply come to terms with AD being as it is. Does that make it good?
"If it ain't broke, don't fix it." <<== That... is a matter of perception!
Eric said...
"Sorry Terry, but this 'idiocy' has never caused me any grief. DirestSOFT is just soooooo intuitive to use...
On the other hand, GE's use of 3 registers for a timers HAS aggravated me. Who counts comfortably by 3?..."
Since when is having to manage Timer Memory more intuitive than not having to do so?
Regarding GE, at the least, you can
always know that GE uses 3 words to maintain their timers; not one, or perhaps two.
As I recall from my days with Logicmaster, the timer/counter registers were, and I assume, still are, drawn from the general V-Mem pool (%R). This certainly was a pain in the neck... until I figured out that, since GE Timers ALWAYS used 3 words. It was quite beneficial to use Base-3 math to manage Timer/Counter addressing. Don't choke on it... it really ain't that bad!
I would set aside a region of memory just for timers and counters. It would always be prudent to put aside twice as much as one would anticipate needing. I would generally put aside the area between %R-1000 to %R-1999. That would be enough for 334 Timers and/or Counters starting at T/C-0.
Then, "knowing" that Timer/Counter addresses are based on the Timer/Counter BASE-ADDRESS Number (%R-1000) and subsequent Timer/Counter addresses specified in Base-3, relative to %R-1000, the addresses become apparent.
It was an extra step, but you ALWAYS knew that the locations were available.
That is more reasonable than trying to manage Timer/Counter Memory locations that might, or might not, be available.