Technology instructions
10.1 Counting (High-speed counters)
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
585
Table 10- 13 Data types for the parameters
DIR
1, 2
IN Bool 1 = Request new direction
1
1 = Request to set new counter value
RV
1
IN Bool 1= Request to set new reference value
PERIOD
1
IN Bool 1 = Request to set new period value
(only for frequency measurement mode)
New direction: 1= forward, -1= backward
NEW_PERIOD IN Int New period value is in milliseconds (only for frequency meas-
urement mode). The only allowed values are 10, 100, or 1000
milliseconds:
1000 = 1 second
100 = 0.1 second
3
If an update of a parameter value is not requested, then the corresponding input values are ignored.
The DIR parameter is only valid if the configured counting direction is set to "User program (internal direction control)".
You determine how to use this parameter in the HSC device configuration.
3
For an HSC on the CPU or on the SB, the BUSY parameter always has a value of 0.
You configure the parameters for each HSC in the device configuration for the CPU for
counting/frequency function, reset options, interrupt event configuration, hardware I/O, and
count value address.
Some of the parameters for the HSC can be modified by your user program to provide
program control of the counting process:
● Set the counting direction to a NEW_DIR value
● Set the current count value to a NEW_CV value
● Set the reference value to a NEW_RV value
● Set the period value (for frequency measurement mode) to a NEW_PERIOD value
If the following Boolean flag values are set to 1 when the CTRL_HSC instruction is executed,
the corresponding NEW_xxx value is loaded to the counter. Multiple requests (more than
one flag is set at the same time) are processed in a single execution of the CTRL_HSC
instruction.
● DIR = 1 is a request to load a NEW_DIR value, 0 = no change
● CV = 1 is a request to load a NEW_CV value, 0 = no change
● RV = 1 is a request to load a NEW_RV value, 0 = no change
● PERIOD = 1 is a request to load a NEW_PERIOD value, 0 = no change
If an error occurs, ENO is set to "0" and the STATUS output indicates a condition code: