100BBasic instructions
7.3 Counters
Table 7- 26
Operation of the CTUD counter
Counter
The CTUD counter counts up or
down by 1 on the 0 to 1
transition of the count up (CU) or
count down (CD) inputs. The
CTUD timing diagram shows the
operation for an unsigned
integer count value (where PV =
4).
If the value of parameter CV
is equal to or greater than the
value of parameter PV, then
the counter output parameter
QU = 1.
If the value of parameter CV
is less than or equal to zero,
then the counter output
parameter QD = 1.
If the value of parameter
LOAD changes from 0 to 1,
then the value at parameter
PV is loaded to the counter
as the new CV.
If the value of the reset
parameter R is changes from
0 to 1, the current count
value is reset to 0.
Counter data retention after a RUN-STOP-RUN transition or a CPU power cycle
If a run mode session is ended with stop mode or a CPU power cycle and a new run mode
session is started, then the counter data stored in the previous run mode session is lost,
unless the counter data structure is specified as retentive (CTU, CTD, and CTUD counters).
When you accept the defaults in the call options dialog after you place a counter instruction
in the program editor, you are automatically assigned an instance DB which cannot be made
retentive. To make your counter data retentive, you must either use a global DB or a Multi-
instance DB.
180
Operation
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05