Programming instructions

78
32 bit counters
Presets
Presets are the number of times the rung driving the counter has to go
through a FALSE to TRUE state transition before turning on.
32 Bit counters have a range of –2,147,483,648 to 2,147,483,647.
Counter presets can be either a K constant, or a variable, such as a data
or file register. Having a D device as the preset allows an operator to
make changes to the counter preset from an HMI, or allows the preset to
be changed during operation of the logic.
The accumulated value of the 32 bit counter can exceed the preset value,
or go below 0. Once the counter coil has turned on, it will remain on until
reset, or the counter counts back down. Using the Decrement instruction
to reduce the count will not deactivate the counter coil.
Counting direction
32 bit counters can count up or down. Counting direction for counter
C### is based upon the status of relay M8###. If M8### is off, the
counter counts up. If M8### is on, the counter counts down.
i.e. For C201, direction is determined by M8201.
Reset
The accumulated value of a counter returns to 0 when the RST C#
instruction is activated.
32 bit counters addressed from C220 ~ C234 are latched counters and
retain their count even at power down. C200 ~ C219 will lose their counts
at power down unless they have been declared as battery-backed in PLC
Parameters
Limitations
Using the INCP instruction will make the counter count up and count pass
the preset. However, the counter coil will not be activated by reaching the
preset with the INCP instruction. The final count must come from a
FALSE to TRUE transition of the counter rung.
If a 32 bit counter has a negative preset, the logic works somewhat
differently than what may be expected. If the counter coil will activate only
when the preset is reached by counting UP to it from a SMALLER number
i.e. Counter C200 has a preset of –10. The as the counter counts down
from –9 to –10, the associated coil will not turn on. If the counter counts
down to –11 and then counts up to –10, then the coil will turn on.