Is there a way to overwrite simulink encoder block pins?

2 次查看(过去 30 天)
Hi! I'm having some issues using 'Simulink Support Package for Arduino Hardware' with my Arduino Uno and Arduino Motor Shield Rev3.
The support package includes a built in encoder block to read the position of a motor, however for the Uno it locks the encoder pins to Pin 2 and Pin 3, but the motor sheild uses pin 3 as pwm control for the motor duty cycle. I'm trying to use pins 2 and 4 for my encoder, leaving pin 3 for the pwm conrtrol, but the encoder block does not allow this.
Any support, advice, or workaround would be greatly appreciated.

回答(1 个)

Dhruv
Dhruv 2023-2-21
The best possible solution which could help work out this issue is trying to use a different microcontroller that has more available pins or a built-in hardware encoder interface. (I would recommend Arduino Mega or Due)
Following is the list of Arduino Board/Digital pins usable for interrupts:
  • Uno, Nano, Mini, and other ATMega328-based boards - 2, 3
  • Mega, Mega2560, MegaADK - 2, 3, 18, 19, 20, 21 (20 and 21 are not available when they are used for I2C communication)
  • Micro, Leonardo, and other 32u4-based boards - 0, 1, 2, 3, 7
  • Nano 33 IoT - 2, 3, 9, 10, 11, 13, A1, A5, A7
  • Due - All digital pins

类别

Help CenterFile Exchange 中查找有关 Arduino Hardware 的更多信息

产品


版本

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by