SDT: HSC_Period
The "HSC_Period" data type corresponds to an HSC configured for "Period" mode. The
CTRL_HSC_EXT instruction provides program access to the number of input pulses over a
specified measurement interval. This instruction allows for the time period between input
pulses to be calculated with a fine nanosecond resolution.
Table 10- 5
HSC_Period structure
Structure element Declaration
ElapsedTime
OUT
EdgeCount
OUT
EnHSC
IN
EnPeriod
IN
NewPeriod
IN
ElapsedTime returns the time, in nanoseconds, between the last counting events of
sequential measurement intervals. If no counting events occurred during a measurement
interval, ElapsedTime returns the cumulative time since the last counting event.
ElapsedTime has a range from "0" to 4,294,967,280 nanoseconds (0x0000 0000 to 0xFFFF
FFF0). The return value 4,294,967,295 (0xFFFF FFFF) indicates that period overflow has
occurred. Overflow indicates that the time between pulse edges is greater than 4.295
seconds and the period cannot be calculated using this instruction. The values from 0xFFFF
FFF1 to 0xFFFF FFFE are reserved.
EdgeCount returns the number of counting events received during the measurement interval.
The period can only be calculated when the value of EdgeCount is greater than zero. If
ElapsedTime is either "0" (no input pulses received) or 0xFFFF FFFF (Period overflow), then
EdgeCount is not valid.
When EdgeCount is valid, use the following formula to calculate the period in nanoseconds:
Period = ElapsedTime/EdgeCount
The calculated time period value is an average of the time periods of all of the pulses that
occur during the measurement interval. If the period of an incoming pulse is greater than the
measurement interval (10, 100, or 1000 ms), then the period calculation requires multiple
measurement intervals.
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
Data type
Description
UDInt
See description below.
UDInt
See description below.
Bool
Enables the HSC for Period measurement when true; disables
Period measurement when false.
Bool
Enables NewPeriod value to take effect.
Int
Specifies the measurement interval time in milliseconds. The
only allowed values are 10, 100 or 1000 ms.
Technology instructions
10.1 Counting (High-speed counters)
563