Operation Of The High-Speed Counter - Siemens SIMATIC S7 System Manual

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

The current count value is not available in the CTRL_HSC parameters. The Process Image
address that stores the current count value is assigned during the high-speed counter
hardware configuration. You may use program logic to directly read the count value and the
value returned to your program will be a correct count for the instant in which the counter
was read. The counter will continue to count high-speed events. Therefore, the actual count
value could change before your program completes a process using an old count value.
CTRL_HSC parameter details:
● If an update of a parameter value is not requested, then the corresponding input values
● The DIR parameter is only valid if the configured counting direction is set to "User
● For a S7-1200 HSC on the CPU or on the Signal Board, the BUSY parameter always has
Condition codes: In the case of an error, ENO is set to 0, and the STATUS output contains a
condition code.
6.1.3.3

Operation of the high-speed counter

A high-speed counter (HSC) can be used as an input for an incremental shaft encoder. The
shaft encoder provides a specified number of counts per revolution and a reset pulse that
occurs once per revolution. The clock(s) and the reset pulse from the shaft encoder provide
the inputs to the HSC.
The HSC is loaded with the first of several presets, and the outputs are activated for the time
period where the current count is less than the current preset. The HSC provides an interrupt
when the current count is equal to preset, when reset occurs, and also when there is a
direction change.
As each current-count-value-equals-preset-value interrupt event occurs, a new preset is
loaded and the next state for the outputs is set. When the reset interrupt event occurs, the
first preset and the first output states are set, and the cycle is repeated.
Since the interrupts occur at a much lower rate than the counting rate of the HSC, precise
control of high-speed operations can be implemented with relatively minor impact to the scan
cycle of the CPU. The method of interrupt attachment allows each load of a new preset to be
performed in a separate interrupt routine for easy state control. (Alternatively, all interrupt
events can be processed in a single interrupt routine.)
S7-1200 Programmable controller
System Manual, 11/2009, A5E02486680-02
are ignored.
program (internal direction control)". You determine how to use this parameter in the HSC
device configuration.
a value of 0.
STATUS value
Description
(W#16#...)
0
No error
80A1
HSC identifier does not address a HSC
80B1
Illegal value in NEW_DIR
80B2
Illegal value in NEW_CV
80B3
Illegal value in NEW_RV
80B4
Illegal value in NEW_PERIOD
Programming instructions
6.1 Basic instructions
107

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-1200

Table of Contents