Insert Custom Code into Built Code (Simulink Embedded Coder)
이전 댓글 표시
I have created an application for a TI F28035 microcontroller in Simulink using the TI C2000 hardware add-on. Everything works just fine. However, I was wondering if there was a way to insert custom lines of c code into the auto-generated code. I'm not talking about S functions or ceval calls or using the custom code portion of the Model Parameters. I'm talking about a simple block that lets you enter some simple lines of c code that when built will just plop those lines of code into the built code. Does anything like that exist?
답변 (2개)
Fangjun Jiang
2018년 1월 30일
0 개 추천
In your version of Simulink, check Simulink Coder, Custom Code, Model Source block. It allows to add source code at either Top or Bottom of the model source code.
댓글 수: 3
Adam Truelove
2018년 1월 30일
Fangjun Jiang
2018년 1월 30일
In that case, use a Stateflow chart inside a triggered subsystem. You can pretty much write any manual code inside the Stateflow chart.
Adam Truelove
2018년 1월 30일
편집: Adam Truelove
2018년 1월 30일
Mark McBroom
2018년 3월 10일
0 개 추천
Only way I know of is to create in-lined s-function. For Simulation, s-function would have no inputs, no outputs and therefore do nothing. For code generation, the TLC code for the s-function could emit the above code.
카테고리
도움말 센터 및 File Exchange에서 Simulink Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!