Technology instructions
10.1 Counting (High-speed counters)
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
567
Refer to Input functions (Page 578) for information on how to configure the Synchronization
function.
Many applications require counting processes to be started or stopped in accordance with
other events. In such cases, counting is started and stopped using the internal gate function.
Each HSC channel has two gates: a software gate and a hardware gate. The state of these
gates determines the state of the internal gate. See the table below.
The internal gate is open if the software gate is open and the hardware gate is open or has
not been configured. If the internal gate is open, counting is started. If the internal gate is
closed, all other count pulses are ignored and counting is stopped.
Table 10- 7 Gate function states
Closed Closed Closed
The term "open" is defined to be the active state of the gate. Similarly, the term "closed" is defined to
be the inactive state of the gate.
You control the software gate with the "HSC_Count.EnHSC" enable bit in the SDT attached
to the CTRL_HSC_EXT instruction. To open the software gate, set the "HSC_Count.EnHSC"
bit true; to close the software gate, set the "HSC_Count.EnHSC" bit false. Execute the
CTRL_HSC_EXT instruction to update the software gate’s state.
The hardware gate is optional, and you can enable or disable it in the HSC properties
section. To control a counting process with only the hardware gate, the software gate must
remain open. If you do not configure a hardware gate, the hardware gate is considered to be
always open and the internal gate state is the same as the software gate state.