Simulink Arduino MKR1000: Problem with digital input inside ISR

3 vues (au cours des 30 derniers jours)
AM
AM le 19 Août 2021
Commenté : Aditya Chari le 19 Juin 2022
Hi. I'm trying to get the motor position using a model on Simulink and Arduino MKR1000. I use Monitor and Tune to be able to see communicate while the code is running.
The encoder signal pins are connected to Pin 1 & 3.
There is an external interrup on Pin 1. In the ISR, I read Pin 3 using a Digital Input block.
Problem: the Digital Input block is never triggered.
What I have tried:
1- The same Simulink model works on an Arduino Mega.
2- The same procedure and pins work when I write the code in Arudino IDE.
3- I verified that the External Interrupt block is triggered.
4- I verified that reading Digital Input on Pin 3 works, if it's outside the interrupt ISR block.
In short, it seems that the combination of the External Interrupt block and the Digital Input block in the downstream function call is the culprit. Perhaps there is a bug in the generated code in that case?
Thanks
  1 commentaire
Aditya Chari
Aditya Chari le 19 Juin 2022
Did you get the solution? i am working on a similar project using arduino.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Arduino Hardware dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by