PWM Capture

<< Click to Display Table of Contents >>

Navigation:  STM32F4 Target > Block References > On-chip Peripherals > TIM >

PWM Capture

Previous pageReturn to chapter overviewNext page

User Interface

How this block appears in a Simulink model?


What can be configured?


Configuration item

Selectable option/ Value



1 | 2 | 3 | 4 | 5 | 8

Select timer module for PWM capture.

Capture Pin

<Select pin from available list>

Pins available for selection depending on Timer module.

Capture Pin Type (Pull-Up/Pull-Down)

None | Pull Up | Pull Down

Pull-Up/Down configuration.

Capture Edge

Rising | Falling

Select begin position of PWM period, Rising or Falling edge.

Output data type

single | double

PWM capture result data type

Sample time (Sec)

(Sample time in unit of seconds)

Time interval to update capture data.

Capture Edge


Output port


Return status of PWM capture operation, value is non-zero when data is ready.

2. +Width (sec)

Positive pulse width value, in unit of seconds.

3. +Duty (%)

Positive duty cycle value, in percentage.

4. Frequency (Hz)

PWM frequency, in unit of Hz.

When to use this block?

Use this block when input signal is PWM, to analyze its frequency and duty cycle. Maximum input frequency should lower than 10kHz, and minimum is 0.33Hz.


1. Selected timer module must not conflicted with other timer function.

2. Selectable pin for capture the input signal (available pins depending of selected Timer module).

3. The block use input capture interrupt approach, it may effect to overall system timing if input frequency too High (Lower than 10kHz is recommended).


Ultrasonic sensor demo