S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05
315
Technology instructions
9
9.1
High-speed counter
Table 9- 1
CTRL_HSC instruction
LAD / FBD
SCL
Description
"CTRL_HSC_0_DB" (
hsc:=_hw_hsc_in_,
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_);
Each CTRL_HSC instruction uses a structure stored in
a DB to maintain data. You assign the DB when the
CTRL_HSC instruction is placed in the editor.
1
STEP 7 automatically creates the DB when you insert the instruction.
2
In the SCL example, "CTRL_HSC_0_DB" is the name of the instance DB.
Table 9- 2
Data types for the parameters
Parameter and type
Data type
Description
HSC
IN
HW_HSC
HSC identifier
DIR
1, 2
IN
Bool
1 = Request new direction
CV
1
IN
Bool
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_DIR
IN
Int
New direction: 1= forward, -1= backward
NEW_CV
IN
DInt
New counter value
NEW_RV
IN
DInt
New reference value
NEW_PERIOD
IN
Int
New period value in seconds: 0.01, 0.1, or 1
(only for frequency measurement mode)
BUSY
3
OUT
Bool
Function is busy
STATUS
OUT
Word
Execution condition code
1
If an update of a parameter value is not requested, then the corresponding input values are ignored.
2
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.