Timer Input Get

Reads information from the timer input pin.

Description

When using this block, timer input related information is read from pin, such as frequency, duty cycle, etc.

Output
Frequency
The last measured frequency on the pin in Hz.
The used datatype is uint32.

Duty cycle
The last measured duty cycle on the pin as a % with a scaling factor of 100 for improved resolution. So 5000 = 50% for example.
Note that the duty cycle calculation works for frequencies >= 1 Hz.
The used datatype is uint16.

Edge count
The number of edges that were detected on the input pin since startup.
The used datatype is uint32.

Edge state
State of the last edge. 1 if it was a rising edge, 0 if it was a falling edge. Note that this output is only useful for low frequency signals where the time between edges is longer than the block's sample time.
The used datatype is uint8.

Edge timestamp
A 32-bit timestamp value of the last edge. The timestamp is derived from an internal 32-bit free running counter that runs at 24 Mhz (21 MHz for STM32F4xx targets). Note that this output is only useful for low frequency signals where the time between edges is longer than the block's sample time.
The used datatype is uint32.

Counter timestamp
The timestamp value of the internal 32-bit free running counter that runs at 24 Mhz (21 MHz for STM32F4xx targets). Can be used for edge related time measurements in combination with the 'Edge timestamp' value.
The used datatype is uint32.

0 Hz detected
A boolean flag that will go high if no edges were detected for the time specified as the zero Hz detection time. Upon the next edge the flag will go low again.
The used datatype is boolean.

Parameters
Timer input pin
Selects the timer input pin. Note that the timer module this pin belongs to is specified as well. When a timer module is used for timer input measurements, it can not be used for other timer related functionality such as quadrature encoder inputs, PWM outputs, etc.

Zero Hz detection time
Determines after how many milliseconds since the last edge the 0 Hz detected output flag should go high. Specify a value of zero to not use this feature.

Sample time
Sample time of the block. The Sample time (in seconds) defines the rate at which the block is visited by the real-time scheduler of the target. The value of the Sample time has to be an integer multiple of the base sample time of the model.