Problem in generating code for a simple model

조회 수: 1 (최근 30일)
Vijith Natarajan
Vijith Natarajan 2013년 1월 16일
Hi, I did a small state flow model, which should produce a output 1 when the input is 0 and produce ouput 0 when the input is 1. i simulated it and worked well.
1. when i tried generating code i used grt.tlc and generated code, the code runs for 3 to 4 pages for such a simple model, why?. and also i could see lot of supporting files, is it normal or i did something wrong when generating code?
2. I wanted to generate code for micro controller 8051 of the same model. i couldn't see any difference from the previous code and the code generated for 8051,also how can i select the input and output port pins of the microcontroller??
any help would be really appreciated.....
Thanks Vijith

채택된 답변

Ryan G
Ryan G 2013년 1월 16일
This answer regarding GRT versus ERT targets may help. GRT is a generic target and is not optimized for readability or speed. ERT is much more optimized and readable.
I cannot comment directly on how GRT chooses how to generate code as I do not know that answer, but in general you can expect ERT (embedded coder) code to be much more efficient.
  댓글 수: 2
Vijith Natarajan
Vijith Natarajan 2013년 1월 18일
편집: Vijith Natarajan 2013년 1월 18일
I tried with ert.tlc, now i can see some readable efficient code, but i want to configure the port pins for the input and output, how can i do that??
can anyone pls answer for the second question?????
Ryan G
Ryan G 2013년 1월 19일
You can create a new question for this, but do you know if Simulink directly supports your controller? For example, the simulink support for arduino allows you to generate code and implement it directly with the additional blockset on file exchange.
To do this with your controller it may be supported or you may need to write an s-function. You can also use input and output port blocks and then use the generated code to configure them as pins.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by