Siemens SIMATIC S7-1200 Manual page 116

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

Advertisement

Programming made easy
6.6 High-speed counter (HSC)
Table 6- 27
CTRL_HSC instruction
LAD / FBD
The CTRL_HSC instruction is typically 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 executes the
CTRL_HSC instruction and can change the reference value by loading a NEW_RV value.
Note
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 hardware configuration of
the high-speed counter. You may use program logic to directly read the count value. 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.
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.
● Setting DIR = 1 loads a NEW_DIR value.
● Setting CV = 1 loads a NEW_CV value.
● Setting RV = 1 loads a NEW_RV value
● Setting PERIOD = 1 loads a NEW_PERIOD value.
116
SCL
"counter_name"(
hsc:=_hw_hsc_in_,
HSC:= ,
DIR:=_bool_in_,
CV:=_bool_in_,
RV:=_bool_in_,
Period:=_bool_in_,
New_DIR:=_int_in_,
New_CV:=_int_in_,
New_RV:=_dint_in_,
New_Period:=_int_in_,
Busy:=_bool_out_,
Status:=_word_out_);
Description
Each CTRL_HSC instruction uses a structure stored
in a DB to maintain data.
The HSC uses a structure stored in a data block to
maintain counter data. For SCL, you must first create
the DB for the individual counter instruction before
you can reference it. For LAD and FBD, STEP 7
automatically creates the DB when you insert the
instruction.
Manual, 11/2011, A5E02486774-04
Easy Book

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents