EasyManua.ls Logo

Siemens S7-1200 - Operation of the High-Speed Counter

Siemens S7-1200
1028 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Technology instructions
9.1 High-speed counter
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
411
High-speed counters use a DInt value to store the current count value. A DInt count value
has a range of -2147483648 to +2147483647. The counter rolls over from the maximum
positive value to the maximum negative value when counting up, and from the maximum
negative value to the maximum positive value when counting down.
HSC
Current value data type
Default current value address
HSC1
DInt
ID1000
HSC2
DInt
ID1004
HSC3
DInt
ID1008
HSC4
DInt
ID1012
HSC5
DInt
ID1016
HSC6
DInt
ID1020
If an error occurs, ENO is set to 0 and the STATUS output indicates a condition code.
Table 9- 3 Execution condition codes
STATUS (W#16#)
Description
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
80C0
Multiple access to the high-speed counter
80D0
High-speed counter (HSC) not enabled in CPU hardware configuration
9.1.1
Operation of the high-speed counter
High-speed counters (HSC) can count events that occur faster than the cyclic OB execution
rate. If the events to be counted occur slower than the execution rate of the OB, you can use
CTU, CTD, or CTUD standard counter instructions. If the events occur faster than the OB
execution rate, then use the faster HSC device. The CTRL_HSC instruction allows your
program to programmatically change some of the HSC parameters.
For example: You can use the HSC 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.

Table of Contents

Other manuals for Siemens S7-1200

Related product manuals