Simulink Arduino MKR1000: Problem with digital input inside ISR

조회 수: 2 (최근 30일)
AM
AM 2021년 8월 19일
댓글: Aditya Chari 2022년 6월 19일
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
Aditya Chari
Aditya Chari 2022년 6월 19일
Did you get the solution? i am working on a similar project using arduino.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Arduino Hardware에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by