CTUD: CTUD counts up or down by 1 on the 0 to 1 transition of the Count up (CU) or Count
down (CD) inputs. If the value of parameter CV (Current count value) is equal to or greater
than the value of parameter PV (Preset value), 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 (Preset value) is loaded to the counter as the new CV (Current count value). If the value
of the reset parameter R is changes from 0 to 1, the current count value is reset to 0. The
following figure shows a CTUD timing diagram with an unsigned integer count value (where
PV = 4).
6.1.3.2
CTRL_HSC instruction
The CTRL_HSC instruction controls the high-speed counters that are used to count events
that occur faster than the OB execution rate. The counting rate of the CTU, CTD, and CTUD
counter instructions is limited by the execution rate of the OB in which they are placed. Refer
to the CPU technical specifications (Page 284) for the HSC maximum clock input rates.
A typical use for high-speed counters is to count pulses generated by a motion control shaft
encoder.
S7-1200 Programmable controller
System Manual, 11/2009, A5E02486680-02
Each CTRL_HSC instruction uses a structure stored in a
data block to maintain data. You assign the data block when
the CTRL_HSC instruction is placed in the editor.
Create you own "Counter name" that names the counter
Data Block and describes the purpose of this counter in
your process.
Programming instructions
6.1 Basic instructions
105