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 Arduino pin mapping table. 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
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||Set 1|
|Mega 2560/ADK||Timer 5||Set 1|
|Timer 1||NA||Set 2|
|Timer 3||NA||Set 3|
|Timer 4||Set 4|
|Leonardo, Robot Control Board, Robot Motor Board, Micro||Timer 1||Set 1|
|MKR 1000, MKR Wifi 1010, MKR Zero||Timer TCC0||NA|
|Timer TC3||Set 1|
|Nano 33 IoT||Timer TCC0||NA|
|Timer TC4||Set 1|
|Timer TC2_CH2||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 and cannot use Servo blocks in the model.
For the Arduino Mega 2560/ADK board, if your Simulink model uses the PWM block that is connected to pin number 11 or 12, then you cannot use Servo blocks in the model.
Pin Mapping for Arduino Timer Independent Blocks | PWM | Input Capture | Standard Servo Read | Standard Servo Write | Continuous Servo Write