Main Content

Input Capture

Measure frequency and duty cycle of external input signal

  • Library:
  • Simulink Support Package for Arduino Hardware / Common

  • Block icon for the Input Capture

Description

The Input Capture block measures the frequency and duty cycle of the external input signal on the digital pin of the Arduino®hardware board. The block utilizes the timer counters available on the Arduinohardware board along with the interrupt service routines to compute the frequency and duty cycle of the external input signal.

Limitation

Arduino Board ArchitectureMaximum Measurable FrequencyMeasurable Duty Cycle Range
AVR50KHz20% to 80%
SAMD400KHz
SAM400KHz

Ports

Output

expand all

The block outputs the frequency of the external input signal in Hertz.

Data Types: uint32

The block outputs the duty cycle of the external input signal as a percentage.

Data Types: uint8

Parameters

expand all

Enter the Arduino hardware board pin number to which the external input signal is connected.

Note

Do not assign the same pin number to multiple blocks within a model.

To know more on how to assign pins or to view the fixed pins for the Input Capture block, see Arduino Pin Mapping for Timer Dependent Blocks.

Enter the time interval in seconds at which the block reads the external input signal from the specified pin number.

Introduced in R2020b