- Download the files within the attached zip file and put them in the same folder.
- Navigate to the folder created in step 1 above in MATLAB.
- Run the 'applyPatch.m' file from MATLAB command prompt.
- Restart MATLAB.
Encoder block in Simulink not resetting properly
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Richard Balogh
il 15 Giu 2023
Commentato: Osama Ahmad
il 21 Feb 2024
Since the R2021b, Simulink hardware support for Arduino introduced also the rotary Encoder block: https://www.mathworks.com/help/supportpkg/arduino/ref/encodersensors.html
This block offers an ability to reset counter either regularly at sample time or using an external signal. Unfortunately, external signal reset simply doesn't work. It resets the counter in regular intervals, regardless of the reset input state. To me, it seems like a bug, but maybe I didn't catch something.
As you can see from the following image, Encoder is counting (blue line) regardless of the state at the Reset input (yellow), but then it's zeroing itself regularly.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1411429/image.png)
I am using R2023a, Simulink Support Package for Arduino Hardware with Arduino UNO, and operating in Connected IO mode
Any advices, please?
0 Commenti
Risposta accettata
Swathi
il 21 Giu 2023
The issue of not being able to leverage the external signal to reset the Rotary Encoder block has now been fixed.
To resolve this issue follow the instructions given below:
2 Commenti
Osama Ahmad
il 21 Feb 2024
I am trying to get encoder values using the rotary Encoder block. The encoder is reading the ticks generated by a pendulum.It is working perfectly fine for Arduino Uno but for a Due board, it shows a drift in the aquired sensor value over time. the difference between the two results can be seen in the attached screenshots (1: Arduino Uno - 2: Arduino Due). Everything works fine if I use the Arduino IDE and the encoder library(therefore the Arduino Due hardware is working fine).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1623513/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1623518/image.png)
Is it a bug or am i doing soemthing wrong here?
Più risposte (1)
Cris LaPierre
il 16 Giu 2023
I get the same behavior when I test it. I would suggest reporting this here: https://www.mathworks.com/support/contact_us.html
Vedere anche
Categorie
Scopri di più su Modeling in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!