AS Drbitboy has re-iterated, the accumulators have been explained, my previous post gave that information, however, DR has made it a lot clearer. Not sure in CLX/SLC but on some systems the pre-set if set say at 200 the .DN (counter reached it's pre-set value will be true when the Actual = or is greater than), some systems the counter would stop counting anything above the pre-set (this is to stop the integer value going above 32767) as this would make the accumulated value go negative & cause the fault light to come on & stop the processor. If the counter never goes above the maximum then you could lower the pre-set, so just to re-iterate.
The counter has a number of possible modes:
When the Accumulated count is = to (or possibly above) then it will turn on it's .DN bit (other platforms vary it is either something like the counter number i.e. C5, CC5 (in Mitsubishi) or in IEC is often a variable bit that is put on the counter function block output). Again depending on the PLC the count will either stop at the accumulated value or carry on until the maximum positive value 32767 & stop, or go over giving a negative .ACC value & possibly put the PLC in fault.
Giving a Pre-set above the expected maximum count you are likely to accumulate and using either count down or a compare of the ACC value & then possibly reset the .ACC value is very common so programmers tend to set the pre-set higher than actual required count.
There are some exceptions to some of the above, for example some PLC's have 32 bit counters as well as 16 bit so the pre-set limit is not limited to 32767 but the maximum limit of a 32 bit double integer.
Attached is a quick list of some of the types of timers the first one is generally the type the older generation PLC's had i.e. the coil, DN & ACC variables are programmed separately (will depend on platform)
The others are IEC equivalents.
Hope this explains fully some of the parts of the timer functions.
Sorry it's not in AB CLX money but I only use them if forced (personal hate of RW, this has very little to do with the platform which is quite good).
In ALL Allen-Bradley processors, a Counter preset or accumulator can indeed be negative, and no faults will be generated. This is ONLY the case for Timers, where a negative preset or accumulator will cause a major fault.
All that happens with A-B counters is that when the maximum positive value is reached, the next Count-Up will cause the value to be incremented, which pushes it to the maximum negative value. At the same time, the "Overflow" (.OV) bit will get set.
Subsequent CTU's increment the counter towards zero, then beyond that to the maximum positive value again. So in fact, by looking at the .OV bit, the "positive" count is 3 times the maximum value allowed in the accumulator.
Absolute overflow is when the OV bit is set, and the counter changes from maximum positive to negative yet again. Thatt is when you have "lost" the count, and you should do something about it.
A similar arrangement occurs on a CTD counter, but this time when the counter reaches maximum negative, the next Count Down flips the accumulator to maximum positive, and the "Underflow" (.UN) bit gets set.
Subsequent CTD's decrement the counter towards zero, then beyond that to the maximum negative value again. So in fact, by looking at the .UN bit, the "negative" count is 3 times the minimum value allowed in the accumulator.
With careful programming therefore, by inspection of the .OV and .UN bits, and by trapping any "true" overflow and underflow, you can usefully count
6 times the counter's "range" of values - something that is sometimes needed.
So a 16-bit counter (SLC/Micrologix et al) can count from -32,768 to +32,767 : a "range" of 65,535 counts : 6 times that is 393,210
A 32-bit counter (Logix5000) can count from -2,147,483,648 to
+2,147,483,647 : a "range" of 4,294,967,295 : 6 times that is 25,769,803,770
A counter's .DN bit
never stops the counter counting (unless you program it in the CTU or CTD "enable" input yourself). Because of that, many people use a counter as a "flip-flop", by inspecting the counter accumulator bit 0, which continues to "toggle" forever. You can safely do this, completely ignoring any of the flag bits, or the actual value in the accumulator.
One of the advantages of using a counter as a toggle or a "flip-flop" is that the accumulator value is retentive, and survives the pre-scan operations at start-up. Many of the bit-based toggles do not .....