Siemens SIMATIC S7-1200 Manual page 83

Hide thumbs Also See for SIMATIC S7-1200:
Table of Contents

Advertisement

Parameter
NEW_PERIOD
BUSY
STATUS
While the counting rate of the CTU, CTD, and CTUD counter instructions is limited by the
CPU scan rate, the HSC operates asynchronously to the CPU scan and allow counting
events up to a 100 kHz count rate (for HSC 1, 2, or 3 and onboard CPU count input
configuration).
You must configure the high-speed counters in the project settings for the CPU device
configuration before you can use high-speed counters in your program. The HSC device
configuration settings select counting modes, I/O connections, interrupt assignment, and
operation as a high-speed counter or as a device to measure pulse frequency. You can
operate the high-speed counter with no program control or with program control.
Many high-speed counter configuration parameters are set only in the project device
configuration. Some high-speed counter parameters are initialized in the project device
configuration, but can be modified later under program control. The CTRL_HSC instruction
parameters 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
The CTRL_HSC instruction is usually placed in a hardware interrupt OB that is executed
when the counter hardware interrupt event is triggered. For example, if a CV=RV event
triggers the counter interrupt, then a hardware interrupt OB code block can execute a
CTRL_HSC instruction to change the reference value by loading a NEW_RV value.
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, but the counter will continue to count high-speed events. The actual count value
could change before your program completes a process using an old count value.
Easy Book
Manual, 11/2009, A5E02486774-01
Data type
Description
INT
New period value in seconds: .01, .1, or 1
(only for frequency measurement mode)
BOOL
Function busy
WORD
Execution condition code
Easy to use the built-in pulse generators
7.1 High-speed counters
83

Advertisement

Table of Contents
loading

Table of Contents