Contenu principal

PIM

R2026b

Measure period and duty cycle of a pulse width modulation (PWM) input signal

Since R2026b

  • PIM block icon

Libraries:
Embedded Coder Support Package for Infineon AURIX TC4x Microcontrollers / AURIX TC4x

Description

Add-On Required: This feature requires the Embedded Coder Support Package for Infineon AURIX TC4x Microcontrollers add-on.

Pulse input measurement (PIM) block measures the period and duty cycle of a PWM input signal. The block uses the timer input module (TIM) of the generic timer module (GTM) or enhanced generic timer module (EGTM) on the Infineon® AURIX™ microcontroller board.

The block outputs the measured period in seconds and the duty cycle in percentage, both as single-precision values. It also outputs status flags for new data availability, timeout detection, and counter overflow as uint8 values.

To configure PIM peripherals, see PIM Peripheral Configuration.

Ports

Output

expand all

The block outputs the measured duty cycle of the input PWM signal as a percentage in the range (0-100) .

Data Types: single

The block outputs the measured period of the input PWM signal in seconds.

Dependencies

To enable this port, select the Period parameter.

Data Types: single

The port outputs the timeout detection status indicator as either 0 or 1.

  • 0 — No timeout detected.

  • 1 — Timeout detected.

Dependencies

To enable this port, select the Timeout status parameter.

Data Types: uint8

The port outputs the new data availability status indicator as either 0 or 1.

  • 0 — No new measurement data available.

  • 1 — New measurement data available since the last read operation.

Dependencies

To enable this port, select the New value notification status parameter.

Data Types: uint8

The port outputs the counter overflow status indicator as either 0 or 1.

  • 0 — No counter overflow detected. The measured value is within the valid range.

  • 1 — Counter overflow detected. The measured value exceeds the maximum measurement range of the timer.

You can increase the CMU_CLKN pre-scaler value to prevent counter overflow.

Dependencies

To enable this port, select the Counter overflow status parameter.

Data Types: uint8

Parameters

expand all

Basic

Select the measurement mode for the TIM channel.

Basic > Output

Select this parameter to enable the period output port, which outputs the measured period in seconds.

Select this parameter to enable the timeout output port, which outputs the timeout detection status.

Specify how often the block reads period and duty cycle of a PWM input signal.

When you specify -1, Simulink® determines the sample time based on the block context within the model.

Note

To monitor new input measurement values and detect counter overflow status or timeout status, set the Sample time parameter to a value sufficiently smaller than the expected signal period.

Advanced

Select this parameter to enable the new value output port, which outputs the new data availability status.

Select this parameter to enable the counter overflow output port, which outputs the counter overflowed status.

Version History

Introduced in R2026b