필터 지우기
필터 지우기

Simulink support package for Arduino - Combining with cusom code?

조회 수: 1 (최근 30일)
Alex
Alex 2014년 4월 8일
댓글: Florian M. Faessler 2014년 5월 18일
I've recently purchased Matlab 2014a, and with it I've downloaded the Arduino Due support package. This is great, as I can essentially implement my controller on the arduino with no programming whatsoever - which is great, apart from the fact that I need to actually use code and libraries to obtain the value of the gyroscope over I2C, amongst many other things which are impossible (as far as I am aware) to do in Simulink.
Is there a way to somehow combine custom code with the power of the 'Run on target hardware' capability of Simulink? If not, isn't this a massive oversight?
If this is indeed the case, is there a way to obtain the Arduino code generated by Simulink to implement into my own code?

답변 (2개)

Mischa Kim
Mischa Kim 2014년 4월 8일
편집: Mischa Kim 2014년 4월 8일
Alex, you can implement MATLAB code (is this what you are referring to as custom code?) in Simulink, e.g., via the MATLAB function block (in User-Defined Functions).
To actually read the generated code you'd need the Embedded Coder Toolbox.
  댓글 수: 3
Mischa Kim
Mischa Kim 2014년 4월 8일
Check out the Legacy Code Tool.
Alex
Alex 2014년 4월 9일
Thanks. I've had a look and it can't seem to compile C++ files, which is what the libraries I'm using are compiled in. Any other solutions?

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


Florian M. Faessler
Florian M. Faessler 2014년 5월 10일
Hallo together!
I wondered about the same thing. I would like to combine the capabilities of the Arduino support for Simulink with self written C-code. In my case it doesn't need to be the modified c-code used in Arduino sketches but "plain"/"real" c-code is just fine. Beeing able to use both I could design controller and filter in MATLAB/Simulink and at the same time code the rest in c.
So I'd be happy about ideas, too.
Best Regrads, Florian
  댓글 수: 2
Alex
Alex 2014년 5월 10일
In the end, I just ended up turning the Simulink controller into C code using the embedded coder, then integrated this with my existing code. Hope this helps.
Florian M. Faessler
Florian M. Faessler 2014년 5월 18일
Hey! Thank you for the reply. I will try this!

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by