How can I both load my Simulink model to my Arduino and add also my own code with it?

StackOverflow https://stackoverflow.com/questions/22443002

Вопрос

I can perfectly build simulink models and upload it to my Arduino. But I need some more code that I customly create by myself. So how can I add my own custom code with matlab simulink code as well?

In other words, is there a way to get c++ code of the simulink model including Arduino Hardware Support Blocks and make some changes and add some more code and upload it myself?

Это было полезно?

Решение 2

Depending on what code you are trying to add there are different approaches:

  1. Already mentioned by am304, the Custom Code option in the Configuration Paramters
  2. With custom S-Functions you write your own blocks with code that gets included in the model. (You may need to learn TLC)
  3. A more manual approach is customizing the Template Makefile to compile your source files, together with the generated source code from the model.
  4. The main file (rt_main.c) can also be customized.

Другие советы

Yes you can. If my memory serves me well, it's in Configuration Parameters -> Code Generation -> Custom Code. You can include custom code in source files, header files, initialize function and terminate function. You can also include a list of additional include directories, source files and libraries.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top