Main Content

Pin Mapping for Arduino Timer Dependent Blocks

Simulink® Support Package for Arduino® Hardware supports these blocks whose operation is dependent on the timer of the Arduino hardware board.

To view the pin mapping for these blocks, click View pin map in the Block Parameters dialog box. This opens the pin mapping table for Arduino boards and Arduino compatible ESP32 boards. For example, to find which pins you can use in the Standard Servo Write block for the Uno board, look for the Standard Servo Write entry under the Blocks column vertically down and Uno board horizontally across. Pins 0-13 can be used for the Uno board.

Arduino timer dependent blocks pin mapping table

Arduino ESP32 timer dependent blocks pin mapping table

Conflicting Pin Configurations on Arduino Timer

Use one Arduino timer for only one block functionality at a time. For example, if your model uses the PWM block, you cannot connect the Input Capture and Servo blocks to the same timer. Similarly, if your model uses the Input Capture block, you cannot connect the PWM and Servo blocks to the same timer. And, if your model uses the Servo blocks, you cannot connect the PWM and Input Capture blocks to the same timer.

If your Simulink model utilizes multiple timer-dependent blocks, you can use the following table to avoid timer conflicts.

Arduino Board TypeArduino TimerArduino Pin Connections for Input Capture BlockArduino Pin Connections for PWM BlockServo Block Usage Conflict
Uno, Nano 3.0Timer 189, 10Set 1
Mega 2560/ADKTimer 54844, 45, 46Set 1
Timer 1NA11, 12Set 2
Timer 3NA2, 3, 5Set 3
Timer 4496, 7, 8Set 4
Leonardo, Robot Control Board, Robot Motor Board, MicroTimer 149, 10Set 1
Timer 4136, 13NA
MKR 1000, MKR Wifi 1010, MKR ZeroTimer TCC0106, 7, 11, 18 (A3), 19 (A4)NA
Timer TCC162, 3NA
Timer TCC219 (A4)8NA
Timer TC3200, 1Set 1
Timer TC410NA
Nano 33 IoTTimer TCC0105, 6, 9, 10, 16, 17NA
Timer TCC164NA
Timer TCC21911NA
Timer TC32012NA
Timer TC419Set 1
DueTimer TC0_CH022, 13NA
Timer TC2_CH211NASet 4

Consider these example combinations for different Arduino boards:

  • For the Arduino Leonardo board, if your Simulink model uses the Input Capture block that is connected to pin number 4, then you cannot connect the PWM block to pin number 9 and 10, and you cannot use Servo blocks in the model.

  • For the Arduino Nano 33 IoT board, if your Simulink model uses the Input Capture block that is connected to pin number 10, then you cannot connect the PWM block to pin numbers 5, 6, 9, 10, 16, and 17.

See Also

| | | | | |