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.
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 Type | Arduino Timer | Arduino Pin Connections for Input Capture Block | Arduino Pin Connections for PWM Block | Servo Block Usage Conflict |
---|---|---|---|---|
Uno, Nano 3.0 | Timer 1 | 8 | 9 , 10 | Set 1 |
Mega 2560/ADK | Timer 5 | 48 | 44 , 45 ,
46 | Set 1 |
Timer 1 | NA | 11 , 12 | Set 2 | |
Timer 3 | NA | 2 , 3 ,
5 | Set 3 | |
Timer 4 | 49 | 6 , 7 ,
8 | Set 4 | |
Leonardo, Robot Control Board, Robot Motor Board, Micro | Timer 1 | 4 | 9 , 10 | Set 1 |
Timer 4 | 13 | 6 , 13 | NA | |
MKR 1000, MKR Wifi 1010, MKR Zero | Timer TCC0 | 10 | 6 , 7 ,
11 , 18 (A3),
19 (A4) | NA |
Timer TCC1 | 6 | 2 , 3 | NA | |
Timer TCC2 | 19 (A4) | 8 | NA | |
Timer TC3 | 20 | 0 , 1 | Set 1 | |
Timer TC4 | 10 | NA | ||
Nano 33 IoT | Timer TCC0 | 10 | 5 , 6 , 9 ,
10 , 16 ,
17 | NA |
Timer TCC1 | 6 | 4 | NA | |
Timer TCC2 | 19 | 11 | NA | |
Timer TC3 | 20 | 12 | NA | |
Timer TC4 | 19 | Set 1 | ||
Due | Timer TC0_CH0 | 2 | 2 , 13 | NA |
Timer TC2_CH2 | 11 | NA | Set 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
Pin Mapping for Arduino Timer Independent Blocks | PWM | Input Capture | Standard Servo Read | Standard Servo Write | Continuous Servo Write | Supported Default PWM Frequencies and Pins on Arduino Compatible Teensy Boards